diff --git a/src/App/App.tsx b/src/App/App.tsx index f9cca35..65ac3e0 100644 --- a/src/App/App.tsx +++ b/src/App/App.tsx @@ -29,16 +29,14 @@ export interface AppStateInterface { scope: string; showLoginModal: boolean; isUserLoggedIn: boolean; - packages: []; + packages: any[]; isLoading: boolean; } export default class App extends Component<{}, AppStateInterface> { public state: AppStateInterface = { - // @ts-ignore logoUrl: window.VERDACCIO_LOGO, user: {}, - // @ts-ignore - scope: window.VERDACCIO_SCOPE ? `${window.VERDACCIO_SCOPE}:` : '', + scope: window.VERDACCIO_SCOPE || '', showLoginModal: false, isUserLoggedIn: false, packages: [], @@ -64,7 +62,6 @@ export default class App extends Component<{}, AppStateInterface> { const context = { isUserLoggedIn, packages, logoUrl, user, scope }; return ( - // @ts-ignore {isLoading ? : {this.renderContent()}} {this.renderLoginModal()} @@ -88,11 +85,9 @@ export default class App extends Component<{}, AppStateInterface> { public loadOnHandler = async () => { try { - // @ts-ignore - this.req = await API.request('packages', 'GET'); + const packages = await API.request('packages', 'GET'); this.setState({ - // @ts-ignore - packages: this.req, + packages, isLoading: false, }); } catch (error) { @@ -116,7 +111,6 @@ export default class App extends Component<{}, AppStateInterface> { */ public handleToggleLoginModal = () => { this.setState(prevState => ({ - // @ts-ignore showLoginModal: !prevState.showLoginModal, })); }; @@ -126,7 +120,6 @@ export default class App extends Component<{}, AppStateInterface> { * Required by:
*/ public handleDoLogin = async (usernameValue, passwordValue) => { - // @ts-ignore const { username, token, error } = await makeLogin(usernameValue, passwordValue); if (username && token) { @@ -187,7 +180,6 @@ export default class App extends Component<{}, AppStateInterface> { public renderHeader = (): ReactElement => { const { logoUrl, - // @ts-ignore user: { username }, scope, } = this.state; diff --git a/src/components/ActionBar/ActionBar.test.tsx b/src/components/ActionBar/ActionBar.test.tsx index fac80e0..b77c026 100644 --- a/src/components/ActionBar/ActionBar.test.tsx +++ b/src/components/ActionBar/ActionBar.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { mount } from 'enzyme'; import { ActionBar } from './ActionBar'; -const mockPackageMeta = jest.fn(() => ({ +const mockPackageMeta: jest.Mock = jest.fn(() => ({ latest: { homepage: 'https://verdaccio.tld', bugs: { @@ -32,7 +32,6 @@ describe(' component', () => { }); test('when there is no action bar data', () => { - // @ts-ignore mockPackageMeta.mockImplementation(() => ({ latest: {}, })); @@ -44,7 +43,6 @@ describe(' component', () => { }); test('when there is a button to download a tarball', () => { - // @ts-ignore mockPackageMeta.mockImplementation(() => ({ latest: { dist: { diff --git a/src/components/ActionBar/ActionBar.tsx b/src/components/ActionBar/ActionBar.tsx index bee45ec..79db693 100644 --- a/src/components/ActionBar/ActionBar.tsx +++ b/src/components/ActionBar/ActionBar.tsx @@ -70,7 +70,6 @@ class ActionBar extends Component { } private renderActionBar = ({ packageMeta }) => { - // @ts-ignore const { latest } = packageMeta; if (!latest) { @@ -107,7 +106,6 @@ class ActionBar extends Component { } else { const fab = {actionItem['icon']}; component.push( - // @ts-ignore <>{this.renderIconsWithLink(link, fab)} diff --git a/src/components/Dependencies/Dependencies.tsx b/src/components/Dependencies/Dependencies.tsx index 4f78649..ca3ad84 100644 --- a/src/components/Dependencies/Dependencies.tsx +++ b/src/components/Dependencies/Dependencies.tsx @@ -96,14 +96,16 @@ class Dependencies extends Component { const dependencyMap = { dependencies, devDependencies, peerDependencies }; - const dependencyList = Object.keys(dependencyMap).reduce((result, value, key) => { - const selectedDepndency = dependencyMap[value]; - if (selectedDepndency && this.checkDependencyLength(selectedDepndency)) { - // @ts-ignore - result.push(); - } - return result; - }, []); + const dependencyList = Object.keys(dependencyMap).reduce( + (result, value, key) => { + const selectedDepndency = dependencyMap[value]; + if (selectedDepndency && this.checkDependencyLength(selectedDepndency)) { + result.push(); + } + return result; + }, + [] as JSX.Element[] + ); if (dependencyList.length) { return {dependencyList}; diff --git a/src/components/Developers/Developers.tsx b/src/components/Developers/Developers.tsx index 2fd3e31..69a1ea6 100644 --- a/src/components/Developers/Developers.tsx +++ b/src/components/Developers/Developers.tsx @@ -18,7 +18,7 @@ const Developers: FC = ({ type, visibleMax }) => { const [visibleDevs, setVisibleDevs] = React.useState(visibleMax || VISIBLE_MAX); const { packageMeta } = React.useContext(DetailContext); - const handleLoadMore = () => { + const handleLoadMore = (): void => { setVisibleDevs(visibleDevs + VISIBLE_MAX); }; diff --git a/src/components/Engines/Engines.test.tsx b/src/components/Engines/Engines.test.tsx index 4756588..c59bb8b 100644 --- a/src/components/Engines/Engines.test.tsx +++ b/src/components/Engines/Engines.test.tsx @@ -5,7 +5,7 @@ import Engine from './Engines'; jest.mock('./img/node.png', () => ''); jest.mock('../Install/img/npm.svg', () => ''); -const mockPackageMeta = jest.fn(() => ({ +const mockPackageMeta: jest.Mock = jest.fn(() => ({ latest: { homepage: 'https://verdaccio.tld', bugs: { @@ -38,7 +38,6 @@ describe(' component', () => { }, }; - // @ts-ignore mockPackageMeta.mockImplementation(() => packageMeta); const wrapper = mount(); @@ -50,7 +49,6 @@ describe(' component', () => { latest: {}, }; - // @ts-ignore mockPackageMeta.mockImplementation(() => packageMeta); const wrapper = mount(); @@ -64,7 +62,6 @@ describe(' component', () => { }, }; - // @ts-ignore mockPackageMeta.mockImplementation(() => packageMeta); const wrapper = mount(); diff --git a/src/components/Footer/Footer.test.tsx b/src/components/Footer/Footer.test.tsx index b91efcc..d8f9240 100644 --- a/src/components/Footer/Footer.test.tsx +++ b/src/components/Footer/Footer.test.tsx @@ -10,10 +10,8 @@ jest.mock('../../../package.json', () => ({ describe('