mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
chore: fix comma-dangle and react/jsx-sort-props
enable react/jsx-sort-props enable camelcase on ui enable semi global
This commit is contained in:
parent
02b4ce50e5
commit
4c2fed677f
@ -21,5 +21,5 @@ Module.propTypes = {
|
|||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
description: PropTypes.string,
|
description: PropTypes.string,
|
||||||
children: PropTypes.any.isRequired,
|
children: PropTypes.any.isRequired,
|
||||||
className: PropTypes.string
|
className: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
@ -7,5 +7,5 @@ export default function ModuleContentPlaceholder({text}) {
|
|||||||
return <p className={classes.emptyPlaceholder}>{text}</p>;
|
return <p className={classes.emptyPlaceholder}>{text}</p>;
|
||||||
}
|
}
|
||||||
ModuleContentPlaceholder.propTypes = {
|
ModuleContentPlaceholder.propTypes = {
|
||||||
text: PropTypes.string.isRequired
|
text: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
formatLicense,
|
formatLicense,
|
||||||
formatRepository,
|
formatRepository,
|
||||||
getLastUpdatedPackageTime,
|
getLastUpdatedPackageTime,
|
||||||
getRecentReleases
|
getRecentReleases,
|
||||||
} from '../../utils/package';
|
} from '../../utils/package';
|
||||||
import API from '../../utils/api';
|
import API from '../../utils/api';
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ export default class PackageSidebar extends React.Component {
|
|||||||
state = {};
|
state = {};
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
packageName: PropTypes.string.isRequired
|
packageName: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -38,12 +38,12 @@ export default class PackageSidebar extends React.Component {
|
|||||||
packageMeta = await API.request(`sidebar/${packageName}`, 'GET');
|
packageMeta = await API.request(`sidebar/${packageName}`, 'GET');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.setState({
|
this.setState({
|
||||||
failed: true
|
failed: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
packageMeta
|
packageMeta,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,14 +73,14 @@ export default class PackageSidebar extends React.Component {
|
|||||||
<aside className="sidebar-info">
|
<aside className="sidebar-info">
|
||||||
{time && (
|
{time && (
|
||||||
<LastSync
|
<LastSync
|
||||||
recentReleases={recentReleases}
|
|
||||||
lastUpdated={lastUpdated}
|
lastUpdated={lastUpdated}
|
||||||
|
recentReleases={recentReleases}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Infos
|
<Infos
|
||||||
homepage={homepage}
|
homepage={homepage}
|
||||||
repository={repository}
|
|
||||||
license={license}
|
license={license}
|
||||||
|
repository={repository}
|
||||||
/>
|
/>
|
||||||
{/* TODO: Refacor later, when we decide to show only maintainers/authors */}
|
{/* TODO: Refacor later, when we decide to show only maintainers/authors */}
|
||||||
<Maintainers packageMeta={packageMeta} />
|
<Maintainers packageMeta={packageMeta} />
|
||||||
|
@ -32,7 +32,7 @@ const renderDependenciesList = (dependencies, dependenciesList) => {
|
|||||||
const Dependencies = ({dependencies = {}, title = 'Dependencies'}) => {
|
const Dependencies = ({dependencies = {}, title = 'Dependencies'}) => {
|
||||||
const dependenciesList = Object.keys(dependencies);
|
const dependenciesList = Object.keys(dependencies);
|
||||||
return (
|
return (
|
||||||
<Module title={title} className={classes.dependenciesModule}>
|
<Module className={classes.dependenciesModule} title={title}>
|
||||||
{dependenciesList.length > 0 ? (
|
{dependenciesList.length > 0 ? (
|
||||||
renderDependenciesList(dependencies, dependenciesList)
|
renderDependenciesList(dependencies, dependenciesList)
|
||||||
) : (
|
) : (
|
||||||
@ -44,7 +44,7 @@ const Dependencies = ({dependencies = {}, title = 'Dependencies'}) => {
|
|||||||
|
|
||||||
Dependencies.propTypes = {
|
Dependencies.propTypes = {
|
||||||
dependencies: PropTypes.object,
|
dependencies: PropTypes.object,
|
||||||
title: PropTypes.string
|
title: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Dependencies;
|
export default Dependencies;
|
||||||
|
@ -8,7 +8,7 @@ import classes from './style.scss';
|
|||||||
const renderSection = (title, url) => (
|
const renderSection = (title, url) => (
|
||||||
<li>
|
<li>
|
||||||
<span>{title}</span>
|
<span>{title}</span>
|
||||||
<a href={url} target="_blank" rel="noopener noreferrer">
|
<a href={url} rel="noopener noreferrer" target="_blank">
|
||||||
{url}
|
{url}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -16,22 +16,25 @@ const renderSection = (title, url) => (
|
|||||||
|
|
||||||
const Infos = ({homepage, repository, license}) => {
|
const Infos = ({homepage, repository, license}) => {
|
||||||
const showInfo = homepage || repository || license;
|
const showInfo = homepage || repository || license;
|
||||||
return <Module title="Infos" className={classes.infosModule}>
|
return (
|
||||||
{showInfo ? <ul>
|
<Module className={classes.infosModule} title="Infos">
|
||||||
|
{showInfo ? (
|
||||||
|
<ul>
|
||||||
{homepage && renderSection('Homepage', homepage)}
|
{homepage && renderSection('Homepage', homepage)}
|
||||||
{repository && renderSection('Repository', repository)}
|
{repository && renderSection('Repository', repository)}
|
||||||
{license && <li>
|
{license && (
|
||||||
|
<li>
|
||||||
<span>License</span>
|
<span>License</span>
|
||||||
<span>{license}</span>
|
<span>{license}</span>
|
||||||
</li>}
|
</li>)}
|
||||||
</ul> : <ModuleContentPlaceholder text="Not Available!" />}
|
</ul>) : <ModuleContentPlaceholder text="Not Available!" />}
|
||||||
</Module>;
|
</Module>);
|
||||||
};
|
};
|
||||||
|
|
||||||
Infos.propTypes = {
|
Infos.propTypes = {
|
||||||
homepage: PropTypes.string,
|
homepage: PropTypes.string,
|
||||||
repository: PropTypes.string,
|
repository: PropTypes.string,
|
||||||
license: PropTypes.string
|
license: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Infos;
|
export default Infos;
|
||||||
|
@ -24,9 +24,9 @@ const renderRecentReleases = (recentReleases) => {
|
|||||||
const LastSync = ({recentReleases = [], lastUpdated = ''}) => {
|
const LastSync = ({recentReleases = [], lastUpdated = ''}) => {
|
||||||
return (
|
return (
|
||||||
<Module
|
<Module
|
||||||
title="Last Sync"
|
|
||||||
description={lastUpdated}
|
|
||||||
className={classes.releasesModule}
|
className={classes.releasesModule}
|
||||||
|
description={lastUpdated}
|
||||||
|
title="Last Sync"
|
||||||
>
|
>
|
||||||
{recentReleases.length ? (
|
{recentReleases.length ? (
|
||||||
renderRecentReleases(recentReleases)
|
renderRecentReleases(recentReleases)
|
||||||
@ -39,7 +39,7 @@ const LastSync = ({recentReleases = [], lastUpdated = ''}) => {
|
|||||||
|
|
||||||
LastSync.propTypes = {
|
LastSync.propTypes = {
|
||||||
recentReleases: propTypes.array,
|
recentReleases: propTypes.array,
|
||||||
lastUpdated: propTypes.string
|
lastUpdated: propTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LastSync;
|
export default LastSync;
|
||||||
|
@ -7,7 +7,7 @@ export default function MaintainerInfo({title, name, avatar}) {
|
|||||||
let avatarDescription = `${title} ${name}'s avatar`;
|
let avatarDescription = `${title} ${name}'s avatar`;
|
||||||
return (
|
return (
|
||||||
<div className={classes.maintainer} title={name}>
|
<div className={classes.maintainer} title={name}>
|
||||||
<img src={avatar} alt={avatarDescription} title={avatarDescription}/>
|
<img alt={avatarDescription} src={avatar} title={avatarDescription} />
|
||||||
<span className="maintainer-name">{name}</span>
|
<span className="maintainer-name">{name}</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -15,5 +15,5 @@ export default function MaintainerInfo({title, name, avatar}) {
|
|||||||
MaintainerInfo.propTypes = {
|
MaintainerInfo.propTypes = {
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
avatar: PropTypes.string.isRequired
|
avatar: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@ const CONTRIBUTORS_TO_SHOW = 5;
|
|||||||
|
|
||||||
export default class Maintainers extends React.Component {
|
export default class Maintainers extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
packageMeta: PropTypes.object.isRequired
|
packageMeta: PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {};
|
state = {};
|
||||||
@ -57,7 +57,7 @@ export default class Maintainers extends React.Component {
|
|||||||
|
|
||||||
handleShowAllContributors() {
|
handleShowAllContributors() {
|
||||||
this.setState({
|
this.setState({
|
||||||
showAllContributors: true
|
showAllContributors: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,10 +70,10 @@ export default class Maintainers extends React.Component {
|
|||||||
).map((contributor, index) => {
|
).map((contributor, index) => {
|
||||||
return (
|
return (
|
||||||
<MaintainerInfo
|
<MaintainerInfo
|
||||||
key={index}
|
|
||||||
title="Contributors"
|
|
||||||
name={contributor.name}
|
|
||||||
avatar={contributor.avatar}
|
avatar={contributor.avatar}
|
||||||
|
key={index}
|
||||||
|
name={contributor.name}
|
||||||
|
title="Contributors"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -86,17 +86,17 @@ export default class Maintainers extends React.Component {
|
|||||||
{author &&
|
{author &&
|
||||||
author.name && (
|
author.name && (
|
||||||
<MaintainerInfo
|
<MaintainerInfo
|
||||||
title="Author"
|
|
||||||
name={author.name}
|
|
||||||
avatar={author.avatar}
|
avatar={author.avatar}
|
||||||
|
name={author.name}
|
||||||
|
title="Author"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{this.renderContributors()}
|
{this.renderContributors()}
|
||||||
</ul>
|
</ul>
|
||||||
{!this.showAllContributors && (
|
{!this.showAllContributors && (
|
||||||
<button
|
<button
|
||||||
onClick={this.handleShowAllContributors}
|
|
||||||
className={classes.showAllContributors}
|
className={classes.showAllContributors}
|
||||||
|
onClick={this.handleShowAllContributors}
|
||||||
title="Current list only show the author and first 5 contributors unique by name"
|
title="Current list only show the author and first 5 contributors unique by name"
|
||||||
>
|
>
|
||||||
Show all contributor
|
Show all contributor
|
||||||
@ -110,7 +110,7 @@ export default class Maintainers extends React.Component {
|
|||||||
let author = this.author;
|
let author = this.author;
|
||||||
const contributors = this.renderContributors();
|
const contributors = this.renderContributors();
|
||||||
return (
|
return (
|
||||||
<Module title="Maintainers" className={classes.maintainersModule}>
|
<Module className={classes.maintainersModule} title="Maintainers">
|
||||||
{contributors.length || has(author, 'name') ? (
|
{contributors.length || has(author, 'name') ? (
|
||||||
this.renderAuthorAndContributors(author)
|
this.renderAuthorAndContributors(author)
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
Reference in New Issue
Block a user