From 74576bda1237b42f168a174458ecfef681455138 Mon Sep 17 00:00:00 2001 From: Gagan Deep <34858937+gagandeepp@users.noreply.github.com> Date: Thu, 3 Oct 2019 01:22:27 +0530 Subject: [PATCH] fix: linter error fixed (#143) --- src/App/AppError.tsx | 4 ++-- .../DetailSidebar/DetailSidebar.tsx | 22 +++++++++---------- src/components/Developers/Developers.tsx | 4 ++-- src/pages/Version/Version.tsx | 2 +- src/utils/package.ts | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/App/AppError.tsx b/src/App/AppError.tsx index 1583fee..5042e40 100644 --- a/src/App/AppError.tsx +++ b/src/App/AppError.tsx @@ -16,11 +16,11 @@ export default class ErrorBoundary extends Component this.state = { hasError: false, error: null, info: null }; } - componentDidCatch(error, info) { + public componentDidCatch(error, info) { this.setState({ hasError: true, error, info }); } - render() { + public render(): JSX.Element { const { hasError, error, info } = this.state; const { children } = this.props; diff --git a/src/components/DetailSidebar/DetailSidebar.tsx b/src/components/DetailSidebar/DetailSidebar.tsx index 66777ea..832ecbd 100644 --- a/src/components/DetailSidebar/DetailSidebar.tsx +++ b/src/components/DetailSidebar/DetailSidebar.tsx @@ -16,7 +16,7 @@ import { DetailContext } from '../../pages/Version'; import { TitleListItem, TitleListItemText } from './styles'; -const renderLatestDescription = (description, version, isLatest: boolean = true) => { +const renderLatestDescription = (description, version, isLatest: boolean = true): JSX.Element => { return (
{description}
@@ -25,15 +25,15 @@ const renderLatestDescription = (description, version, isLatest: boolean = true) ); }; -const renderCopyCLI = () => ; -const renderMaintainers = () => ; -const renderContributors = () => ; -const renderRepository = () => ; -const renderAuthor = () => ; -const renderEngine = () => ; -const renderDist = () => ; -const renderActionBar = () => ; -const renderTitle = (packageName, packageVersion, packageMeta) => { +const renderCopyCLI = (): JSX.Element => ; +const renderMaintainers = (): JSX.Element => ; +const renderContributors = (): JSX.Element => ; +const renderRepository = (): JSX.Element => ; +const renderAuthor = (): JSX.Element => ; +const renderEngine = (): JSX.Element => ; +const renderDist = (): JSX.Element => ; +const renderActionBar = (): JSX.Element => ; +const renderTitle = (packageName, packageVersion, packageMeta): JSX.Element => { const version = packageVersion ? packageVersion : packageMeta.latest.version; const isLatest = typeof packageVersion === 'undefined'; @@ -66,7 +66,7 @@ function renderSideBar(packageName, packageVersion, packageMeta): ReactElement { +const DetailSidebar = (): JSX.Element => { const { packageName, packageMeta, packageVersion } = React.useContext(DetailContext); return renderSideBar(packageName, packageVersion, packageMeta); diff --git a/src/components/Developers/Developers.tsx b/src/components/Developers/Developers.tsx index 9490139..2fd3e31 100644 --- a/src/components/Developers/Developers.tsx +++ b/src/components/Developers/Developers.tsx @@ -22,13 +22,13 @@ const Developers: FC = ({ type, visibleMax }) => { setVisibleDevs(visibleDevs + VISIBLE_MAX); }; - const renderDeveloperDetails = ({ name, avatar, email }, packageMeta) => { + const renderDeveloperDetails = ({ name, avatar, email }, packageMeta): JSX.Element => { const { name: packageName, version } = packageMeta.latest; return ; }; - const renderDevelopers = (developers, packageMeta) => { + const renderDevelopers = (developers, packageMeta): JSX.Element => { const listVisibleDevelopers = developers.slice(0, visibleDevs); return ( diff --git a/src/pages/Version/Version.tsx b/src/pages/Version/Version.tsx index f707b94..4857521 100644 --- a/src/pages/Version/Version.tsx +++ b/src/pages/Version/Version.tsx @@ -19,7 +19,7 @@ export function getRouterPackageName(params): string { return packageName; } -function fillTitle(text) { +function fillTitle(text): string { return `Verdaccio - ${text}`; } diff --git a/src/utils/package.ts b/src/utils/package.ts index 70365a7..ad5a10b 100644 --- a/src/utils/package.ts +++ b/src/utils/package.ts @@ -56,7 +56,7 @@ export function formatDateDistance(lastUpdate): string { return distanceInWordsToNow(new Date(lastUpdate)); } -export function buildScopePackage(scope: string, packageName: string) { +export function buildScopePackage(scope: string, packageName: string): string { return `@${scope}/${packageName}`; }