From e0e260556465da1589625e5d469160a1e41e5132 Mon Sep 17 00:00:00 2001 From: Jaco Date: Sun, 21 May 2023 09:04:36 +0300 Subject: [PATCH] Bump dev (w/ eslint config updates) (#9472) --- .eslintrc.cjs | 28 ------ .vscode/settings.json | 4 + eslint.config.js | 16 ++++ package.json | 3 +- .../apps-config/src/api/typesBundle.spec.ts | 2 + .../apps-config/src/endpoints/index.spec.ts | 4 +- packages/apps-config/src/endpoints/types.ts | 1 + packages/apps-config/src/settings/types.ts | 2 + packages/apps-electron/package.json | 2 +- .../renderer/remote-electron-store.spec.ts | 18 ++-- packages/apps-routing/src/types.ts | 1 + packages/apps/package.json | 2 +- packages/apps/webpack.base.cjs | 3 +- .../page-accounts/src/Accounts/index.spec.ts | 28 +++++- .../src/CreateAccount.slow.spec.tsx | 1 + packages/page-accounts/src/Vanity/index.tsx | 4 +- .../page-accounts/src/modals/Create.spec.tsx | 5 +- .../src/modals/ProxyOverview.tsx | 8 +- .../test/pageElements/AccountRow.tsx | 2 + .../page-accounts/test/pages/accountsPage.tsx | 2 + .../page-addresses/src/Contacts/index.spec.ts | 5 ++ .../test/pages/addressesPage.tsx | 2 + packages/page-assets/src/Balances/Account.tsx | 4 +- .../page-bounties/src/Bounties.slow.spec.tsx | 1 + packages/page-bounties/src/Bounties.spec.ts | 4 +- packages/page-bounties/test/hooks/defaults.ts | 2 + .../page-bounties/test/pages/bountiesPage.tsx | 2 + packages/page-contracts/src/types.ts | 1 + packages/page-referenda/src/util.spec.ts | 4 - packages/page-settings/src/I18n/index.tsx | 8 +- packages/page-treasury/src/Tips/Tips.tsx | 4 +- packages/react-api/src/light.spec.ts | 4 +- packages/react-api/src/types.ts | 1 + .../react-api/src/util/intervalObservable.ts | 1 + .../src/AccountSidebar/Sidebar.spec.tsx | 14 ++- packages/react-components/src/Button/types.ts | 1 + .../react-components/src/Modal/Modal.spec.tsx | 3 + .../react-components/src/Popup/Popup.spec.tsx | 2 + packages/react-components/src/index.ts | 2 + packages/react-components/src/types.ts | 1 + packages/react-components/src/util/types.ts | 1 + packages/react-hooks/src/types.ts | 4 + packages/react-hooks/src/useIsMountedRef.ts | 2 + packages/react-hooks/src/useOutsideClick.ts | 4 +- packages/react-hooks/src/usePassword.ts | 2 + packages/react-hooks/src/useSavedFlags.ts | 2 + packages/react-hooks/src/useTheme.ts | 1 + packages/react-hooks/src/useWeight.ts | 1 + packages/react-params/src/Named/Call.tsx | 2 +- packages/react-params/src/Param/File.tsx | 2 +- .../react-params/src/Param/VoteThreshold.tsx | 1 + .../react-params/src/Param/findComponent.ts | 2 + packages/react-params/src/types.ts | 1 + packages/react-params/src/valueToText.tsx | 4 +- packages/test-support/src/pages/Page.tsx | 2 + .../src/pagesElements/JudgementTag.ts | 2 + .../test-support/src/pagesElements/Row.ts | 2 + .../test-support/src/pagesElements/Sidebar.ts | 2 + .../test-support/src/pagesElements/Table.ts | 2 + packages/test-support/src/react/apiInTests.ts | 1 + .../test-support/src/utils/accountDefaults.ts | 30 +++---- .../src/utils/renderedScreenUtils.ts | 2 + scripts/i18nLint.cjs | 8 ++ scripts/i18nSort.cjs | 19 +++- scripts/imgConvert.mjs | 84 +++++++++-------- scripts/ipfsUpload.mjs | 8 +- scripts/robohash.cjs | 14 ++- tsconfig.eslint.json | 11 +++ tsconfig.json | 3 +- yarn.lock | 90 +++++++++---------- 70 files changed, 327 insertions(+), 184 deletions(-) delete mode 100644 .eslintrc.cjs create mode 100644 .vscode/settings.json create mode 100644 eslint.config.js diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 4957eecb4a..0000000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017-2023 @polkadot/apps authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -const base = require('@polkadot/dev/config/eslint.cjs'); - -// add override for any (a metric ton of them, initial conversion) -module.exports = { - ...base, - ignorePatterns: [ - ...base.ignorePatterns, - 'jest/**/*', - 'scripts/**/*', - '*.cjs' - ], - parserOptions: { - ...base.parserOptions, - project: [ - './tsconfig.eslint.json' - ] - }, - rules: { - ...base.rules, - // needs to be switched on at some point - '@typescript-eslint/no-explicit-any': 'off', - // this seems very broken atm, false positives - '@typescript-eslint/unbound-method': 'off' - } -}; diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..688d936a96 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "eslint.enable": true, + "eslint.experimental.useFlatConfig": true +} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000000..e5fe790fb8 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,16 @@ +// Copyright 2017-2023 @polkadot/dev authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import baseConfig from '@polkadot/dev/config/eslint'; + +export default [ + ...baseConfig, + { + rules: { + // add override for any (a metric ton of them, initial conversion) + '@typescript-eslint/no-explicit-any': 'off', + // we generally use this in isFunction, not via calling + '@typescript-eslint/unbound-method': 'off' + } + } +]; diff --git a/package.json b/package.json index 436ee07939..aa36b7c7c1 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "url": "https://github.com/polkadot-js/apps.git" }, "sideEffects": false, + "type": "module", "version": "0.130.2-15-x", "versions": { "git": "0.130.2-15-x", @@ -68,7 +69,7 @@ "devDependencies": { "@crustio/crust-pin": "^1.0.0", "@pinata/sdk": "^1.2.1", - "@polkadot/dev": "^0.74.1", + "@polkadot/dev": "^0.75.2", "@types/chart.js": "^2.9.37", "@types/file-saver": "^2.0.5", "@types/react-beautiful-dnd": "^13.1.4", diff --git a/packages/apps-config/src/api/typesBundle.spec.ts b/packages/apps-config/src/api/typesBundle.spec.ts index 4a7d0f1418..37b1a21feb 100644 --- a/packages/apps-config/src/api/typesBundle.spec.ts +++ b/packages/apps-config/src/api/typesBundle.spec.ts @@ -37,6 +37,7 @@ export const typesBundle = ${JSON.stringify(typesBundle, null, 2)} as unknown as describe('specs', (): void => { for (const [k, v] of specEntries) { + // eslint-disable-next-line jest/expect-expect it(`adds ${k}`, (): void => { const value = objectSpread<{ derives: unknown }>({}, v); @@ -49,6 +50,7 @@ export const typesBundle = ${JSON.stringify(typesBundle, null, 2)} as unknown as describe('chains', (): void => { for (const [k, v] of chainEntries) { + // eslint-disable-next-line jest/expect-expect it(`adds ${k}`, (): void => { const value = objectSpread<{ derives: unknown }>({}, v); diff --git a/packages/apps-config/src/endpoints/index.spec.ts b/packages/apps-config/src/endpoints/index.spec.ts index 27ef6c9fd2..11a7ebf45a 100644 --- a/packages/apps-config/src/endpoints/index.spec.ts +++ b/packages/apps-config/src/endpoints/index.spec.ts @@ -93,7 +93,7 @@ describe('urls are not duplicated', (): void => { }, {} as Record); for (const [url, paths] of Object.entries(map)) { - it(url, (): void => { + it(`${url}`, (): void => { assert(paths.length === 1, `${url} appears multiple times - ${paths.map((p) => `\n\t"${p}"`).join('')}`); }); } @@ -118,7 +118,7 @@ describe('endpopints naming', (): void => { }), {}); for (const [key, { name, provider }] of Object.entries(endpoints)) { - describe(key, (): void => { + describe(`${key}`, (): void => { it(`[${key}] has no emojis`, (): void => { assert(!emoji.test(name), `${name} should not contain any emojis`); assert(!emoji.test(provider), `${name}:: ${provider} should not contain any emojis`); diff --git a/packages/apps-config/src/endpoints/types.ts b/packages/apps-config/src/endpoints/types.ts index ae16bbf6fa..e1067f1606 100644 --- a/packages/apps-config/src/endpoints/types.ts +++ b/packages/apps-config/src/endpoints/types.ts @@ -1,6 +1,7 @@ // Copyright 2017-2023 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; import type { Option } from '../settings/types.js'; interface BaseOption { diff --git a/packages/apps-config/src/settings/types.ts b/packages/apps-config/src/settings/types.ts index 472c06041b..b608cfaf7b 100644 --- a/packages/apps-config/src/settings/types.ts +++ b/packages/apps-config/src/settings/types.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; + export interface Option { info?: string; isDisabled?: boolean; diff --git a/packages/apps-electron/package.json b/packages/apps-electron/package.json index 1f2559dc18..1978f63ce9 100644 --- a/packages/apps-electron/package.json +++ b/packages/apps-electron/package.json @@ -15,7 +15,7 @@ "sideEffects": false, "version": "0.130.2-15-x", "dependencies": { - "@polkadot/dev": "^0.74.1", + "@polkadot/dev": "^0.75.2", "@polkadot/react-components": "^0.130.2-15-x", "electron-log": "^5.0.0-beta.23", "electron-updater": "^5.3.0", diff --git a/packages/apps-electron/src/renderer/remote-electron-store.spec.ts b/packages/apps-electron/src/renderer/remote-electron-store.spec.ts index 11feb752d6..0237f423b6 100644 --- a/packages/apps-electron/src/renderer/remote-electron-store.spec.ts +++ b/packages/apps-electron/src/renderer/remote-electron-store.spec.ts @@ -39,8 +39,8 @@ describe('Remote Electron Store', () => { remoteStore.all(cb); await Promise.resolve(); - expect(cb).nthCalledWith(1, 1, 'a'); - expect(cb).nthCalledWith(2, 2, 'b'); + expect(cb).toHaveBeenNthCalledWith(1, 1, 'a'); + expect(cb).toHaveBeenNthCalledWith(2, 2, 'b'); }); }); @@ -52,8 +52,8 @@ describe('Remote Electron Store', () => { remoteStore.get('1', cb); await Promise.resolve(); - expect(accountStore.get).toBeCalledWith('1'); - expect(cb).toBeCalledWith('a'); + expect(accountStore.get).toHaveBeenCalledWith('1'); + expect(cb).toHaveBeenCalledWith('a'); }); it('calls callback with null if no accounts found', async () => { @@ -63,7 +63,7 @@ describe('Remote Electron Store', () => { remoteStore.get('1', cb); await Promise.resolve(); - expect(cb).toBeCalledWith(null); + expect(cb).toHaveBeenCalledWith(null); }); }); @@ -75,8 +75,8 @@ describe('Remote Electron Store', () => { remoteStore.remove('1', cb); await Promise.resolve(); - expect(accountStore.remove).toBeCalledWith('1'); - expect(cb).toBeCalledTimes(1); + expect(accountStore.remove).toHaveBeenCalledWith('1'); + expect(cb).toHaveBeenCalledTimes(1); }); }); @@ -88,8 +88,8 @@ describe('Remote Electron Store', () => { remoteStore.set('1', 'a' as unknown as KeyringJson, cb); await Promise.resolve(); - expect(accountStore.set).toBeCalledWith('1', 'a'); - expect(cb).toBeCalledTimes(1); + expect(accountStore.set).toHaveBeenCalledWith('1', 'a'); + expect(cb).toHaveBeenCalledTimes(1); }); }); }); diff --git a/packages/apps-routing/src/types.ts b/packages/apps-routing/src/types.ts index c2ba94cdbc..be7152a23a 100644 --- a/packages/apps-routing/src/types.ts +++ b/packages/apps-routing/src/types.ts @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { IconName } from '@fortawesome/fontawesome-svg-core'; +import type React from 'react'; import type { ApiPromise } from '@polkadot/api'; import type { AppProps, BareProps } from '@polkadot/react-components/types'; diff --git a/packages/apps/package.json b/packages/apps/package.json index a044f8ef58..a691003b4a 100644 --- a/packages/apps/package.json +++ b/packages/apps/package.json @@ -18,7 +18,7 @@ "dependencies": { "@polkadot/apps-config": "^0.130.2-15-x", "@polkadot/apps-routing": "^0.130.2-15-x", - "@polkadot/dev": "^0.74.1", + "@polkadot/dev": "^0.75.2", "@polkadot/react-api": "^0.130.2-15-x", "@polkadot/react-components": "^0.130.2-15-x", "@polkadot/react-hooks": "^0.130.2-15-x", diff --git a/packages/apps/webpack.base.cjs b/packages/apps/webpack.base.cjs index acd65d0818..71e5f364de 100644 --- a/packages/apps/webpack.base.cjs +++ b/packages/apps/webpack.base.cjs @@ -12,7 +12,6 @@ const webpack = require('webpack'); const findPackages = require('../../scripts/findPackages.cjs'); function createWebpack (context, mode = 'production') { - const pkgJson = require(path.join(context, 'package.json')); const alias = findPackages().reduce((alias, { dir, name }) => { alias[name] = path.resolve(context, `../${dir}/src`); @@ -38,7 +37,7 @@ function createWebpack (context, mode = 'production') { rules: [ { scheme: 'data', - type: 'asset/resource', + type: 'asset/resource' }, { include: /node_modules/, diff --git a/packages/page-accounts/src/Accounts/index.spec.ts b/packages/page-accounts/src/Accounts/index.spec.ts index 731a90160b..324f5270bc 100644 --- a/packages/page-accounts/src/Accounts/index.spec.ts +++ b/packages/page-accounts/src/Accounts/index.spec.ts @@ -25,6 +25,7 @@ import { BN } from '@polkadot/util'; import { AccountsPage } from '../../test/pages/accountsPage.js'; // FIXME isSplit Table +// eslint-disable-next-line jest/no-disabled-tests describe.skip('Accounts page', () => { let accountsPage: AccountsPage; @@ -46,6 +47,7 @@ describe.skip('Accounts page', () => { accountsPage.render([]); }); + // eslint-disable-next-line jest/expect-expect it('shows sort-by controls', async () => { await accountsPage.reverseSortingOrder(); }); @@ -62,6 +64,7 @@ describe.skip('Accounts page', () => { expect(accountRows).toHaveLength(0); }); + // eslint-disable-next-line jest/expect-expect it('the accounts table contains a message about no accounts available', async () => { const noAccountsMessage = 'You don\'t have any accounts. Some features are currently hidden and will only become available once you have accounts.'; const accountsTable = await accountsPage.getTable(); @@ -84,6 +87,7 @@ describe.skip('Accounts page', () => { expect(accountRows).toHaveLength(2); }); + // eslint-disable-next-line jest/expect-expect it('account rows display the total balance info', async () => { accountsPage.renderAccountsWithDefaultAddresses( anAccountWithBalance({ freeBalance: balance(500) }), @@ -96,6 +100,7 @@ describe.skip('Accounts page', () => { await rows[1].assertBalancesTotal(balance(350)); }); + // eslint-disable-next-line jest/expect-expect it('account rows display the details balance info', async () => { accountsPage.renderAccountsWithDefaultAddresses( anAccountWithBalance({ freeBalance: balance(500), lockedBalance: balance(30) }), @@ -113,6 +118,7 @@ describe.skip('Accounts page', () => { }); // FIXME multiple tables + // eslint-disable-next-line jest/no-disabled-tests it.skip('derived account displays parent account info', async () => { accountsPage.renderAccountsWithDefaultAddresses( anAccountWithMeta({ isInjected: true, name: 'ALICE', whenCreated: 200 }), @@ -126,6 +132,7 @@ describe.skip('Accounts page', () => { }); // FIXME broken after column rework + // eslint-disable-next-line jest/no-disabled-tests, jest/expect-expect it.skip('a separate column for parent account is not displayed', async () => { accountsPage.renderDefaultAccounts(1); const accountsTable = await accountsPage.getTable(); @@ -146,6 +153,7 @@ describe.skip('Accounts page', () => { await accountRows[0].assertShortAddress(aliceShortAddress); }); + // eslint-disable-next-line jest/expect-expect it('when account is not tagged, account row details displays none info', async () => { accountsPage.renderDefaultAccounts(1); const rows = await accountsPage.getAccountRows(); @@ -153,6 +161,7 @@ describe.skip('Accounts page', () => { await rows[0].assertTags('none'); }); + // eslint-disable-next-line jest/expect-expect it('when account is tagged, account row details displays tags', async () => { accountsPage.renderAccountsWithDefaultAddresses( anAccountWithInfo({ tags: ['my tag', 'Super Tag'] }) @@ -295,6 +304,7 @@ describe.skip('Accounts page', () => { }); // FIXME multiple tables now + // eslint-disable-next-line jest/no-disabled-tests describe.skip('when sorting is used', () => { let accountsTable: Table; @@ -320,26 +330,31 @@ describe.skip('Accounts page', () => { .toHaveTextContent('balances'); }); + // eslint-disable-next-line jest/expect-expect it('sorts by parent if asked', async () => { await accountsPage.sortBy('parent'); await accountsTable.assertRowsOrder([3, 1, 2]); }); + // eslint-disable-next-line jest/expect-expect it('sorts by name if asked', async () => { await accountsPage.sortBy('name'); await accountsTable.assertRowsOrder([3, 2, 1]); }); + // eslint-disable-next-line jest/expect-expect it('sorts by date if asked', async () => { await accountsPage.sortBy('date'); await accountsTable.assertRowsOrder([3, 1, 2]); }); + // eslint-disable-next-line jest/expect-expect it('sorts by balances if asked', async () => { await accountsPage.sortBy('balances'); await accountsTable.assertRowsOrder([1, 2, 3]); }); + // eslint-disable-next-line jest/expect-expect it('implements stable sort', async () => { await accountsPage.sortBy('name'); await accountsTable.assertRowsOrder([3, 2, 1]); @@ -347,6 +362,7 @@ describe.skip('Accounts page', () => { await accountsTable.assertRowsOrder([1, 2, 3]); }); + // eslint-disable-next-line jest/expect-expect it('respects reverse button', async () => { await accountsPage.sortBy('name'); await accountsTable.assertRowsOrder([3, 2, 1]); @@ -394,14 +410,17 @@ describe.skip('Accounts page', () => { await aliceRow.assertAccountName('ALICE'); }); + // eslint-disable-next-line jest/expect-expect it('the development badge is displayed', async () => { await aliceRow.assertBadge('wrench-badge'); }); + // eslint-disable-next-line jest/expect-expect it('the all networks badge is not displayed', () => { aliceRow.assertNoBadge('exclamation-triangle-badge'); }); + // eslint-disable-next-line jest/expect-expect it('the regular badge is not displayed', () => { aliceRow.assertNoBadge('transparent-badge'); }); @@ -415,14 +434,17 @@ describe.skip('Accounts page', () => { await bobRow.assertAccountName('BOB'); }); + // eslint-disable-next-line jest/expect-expect it('the development badge is not displayed', () => { bobRow.assertNoBadge('wrench-badge'); }); + // eslint-disable-next-line jest/expect-expect it('the all networks badge is displayed', async () => { await bobRow.assertBadge('exclamation-triangle-badge'); }); + // eslint-disable-next-line jest/expect-expect it('the regular badge is not displayed', () => { bobRow.assertNoBadge('transparent-badge'); }); @@ -437,14 +459,17 @@ describe.skip('Accounts page', () => { accountRows = await accountsPage.getAccountRows(); }); + // eslint-disable-next-line jest/expect-expect it('the development badge is not displayed', () => { accountRows[0].assertNoBadge('wrench-badge'); }); + // eslint-disable-next-line jest/expect-expect it('the all networks badge is not displayed', () => { accountRows[0].assertNoBadge('exclamation-triangle-badge'); }); + // eslint-disable-next-line jest/expect-expect it('the regular badge is displayed', async () => { await accountRows[0].assertBadge('badge'); }); @@ -458,6 +483,7 @@ describe.skip('Accounts page', () => { accountRows = await accountsPage.getAccountRows(); }); + // eslint-disable-next-line jest/expect-expect it('development', async () => { await accountRows[0].assertBadge('wrench-badge'); const badgePopup = getPopupById(/wrench-badge-hover.*/); @@ -510,7 +536,7 @@ describe.skip('Accounts page', () => { const badgePopup = accountsPage.getById(popupId); if (!badgePopup) { - fail('badge popup should be found'); + throw new Error('badge popup should be found'); } return badgePopup; diff --git a/packages/page-accounts/src/CreateAccount.slow.spec.tsx b/packages/page-accounts/src/CreateAccount.slow.spec.tsx index 2c83a3e7fd..8e8e8ccc20 100644 --- a/packages/page-accounts/src/CreateAccount.slow.spec.tsx +++ b/packages/page-accounts/src/CreateAccount.slow.spec.tsx @@ -46,6 +46,7 @@ const renderAccounts = () => { ); }; +// eslint-disable-next-line jest/no-disabled-tests describe.skip('--SLOW--: Account Create', () => { it('created account is added to list', async () => { const { findByTestId, findByText, queryByText } = renderAccounts(); diff --git a/packages/page-accounts/src/Vanity/index.tsx b/packages/page-accounts/src/Vanity/index.tsx index de9265b7c1..b4ba0df39e 100644 --- a/packages/page-accounts/src/Vanity/index.tsx +++ b/packages/page-accounts/src/Vanity/index.tsx @@ -24,7 +24,7 @@ interface Props { onStatusChange: (status: ActionStatus) => void; } -interface Match { +interface MatchState { isMatchValid: boolean; match: string; } @@ -59,7 +59,7 @@ function VanityApp ({ className = '', onStatusChange }: Props): React.ReactEleme matches: [], startAt: 0 }); - const [{ isMatchValid, match }, setMatch] = useState({ isMatchValid: true, match: DEFAULT_MATCH }); + const [{ isMatchValid, match }, setMatch] = useState({ isMatchValid: true, match: DEFAULT_MATCH }); const [type, setType] = useState('ed25519'); const [withCase, setWithCase] = useState(true); diff --git a/packages/page-accounts/src/modals/Create.spec.tsx b/packages/page-accounts/src/modals/Create.spec.tsx index 26ecffa9bb..5ffe4dd2a0 100644 --- a/packages/page-accounts/src/modals/Create.spec.tsx +++ b/packages/page-accounts/src/modals/Create.spec.tsx @@ -33,6 +33,7 @@ describe('Create an account modal', () => { accountsPage = new AccountsPage(); }); + // eslint-disable-next-line jest/expect-expect it('creates an account', async () => { await accountsPage.enterCreateAccountModal(); @@ -52,6 +53,7 @@ describe('Create an account modal', () => { expectCreateAnAccountCall(); }); + // eslint-disable-next-line jest/expect-expect it('navigates through the modal flow with enter key', async () => { await accountsPage.enterCreateAccountModal(); @@ -72,6 +74,7 @@ describe('Create an account modal', () => { expectCreateAnAccountCall(); }); + // eslint-disable-next-line jest/expect-expect it('gives an error message when entering invalid derivation path', async () => { await accountsPage.enterCreateAccountModal(); @@ -105,7 +108,7 @@ function pressEnterKey () { } function expectCreateAnAccountCall () { - expect(spy).toBeCalledWith( + expect(spy).toHaveBeenCalledWith( expect.anything(), newAccountPassword, expect.objectContaining({ diff --git a/packages/page-accounts/src/modals/ProxyOverview.tsx b/packages/page-accounts/src/modals/ProxyOverview.tsx index 5bd50fb40c..7c18053028 100644 --- a/packages/page-accounts/src/modals/ProxyOverview.tsx +++ b/packages/page-accounts/src/modals/ProxyOverview.tsx @@ -16,7 +16,7 @@ import { BN_ZERO } from '@polkadot/util'; import { useTranslation } from '../translate.js'; -type PrevProxy = [AccountId | null, KitchensinkRuntimeProxyType]; +type PrevProxyProp = [AccountId | null, KitchensinkRuntimeProxyType]; interface Props { className?: string; @@ -28,7 +28,7 @@ interface Props { interface ValueProps { index: number; typeOpts: { text: string; value: number }[]; - value: PrevProxy; + value: PrevProxyProp; } interface NewProxyProps extends ValueProps { @@ -168,8 +168,8 @@ function ProxyOverview ({ className, onClose, previousProxy: [existing] = EMPTY_ const [batchPrevious, setBatchPrevious] = useState[]>([]); const [batchAdded, setBatchAdded] = useState[]>([]); const [txs, setTxs] = useState[] | null>(null); - const [previous, setPrevious] = useState(() => existing.map(({ delegate, proxyType }) => [delegate, proxyType])); - const [added, setAdded] = useState([]); + const [previous, setPrevious] = useState(() => existing.map(({ delegate, proxyType }) => [delegate, proxyType])); + const [added, setAdded] = useState([]); const extrinsics = useTxBatch(txs, BATCH_OPTS); const reservedAmount = useMemo( diff --git a/packages/page-accounts/test/pageElements/AccountRow.tsx b/packages/page-accounts/test/pageElements/AccountRow.tsx index fba4487ab7..55cf0cedc1 100644 --- a/packages/page-accounts/test/pageElements/AccountRow.tsx +++ b/packages/page-accounts/test/pageElements/AccountRow.tsx @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/page-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global expect */ + import { within } from '@testing-library/react'; import { Row } from '@polkadot/test-support/pagesElements'; diff --git a/packages/page-accounts/test/pages/accountsPage.tsx b/packages/page-accounts/test/pages/accountsPage.tsx index 1b8227dcc4..23c14132ec 100644 --- a/packages/page-accounts/test/pages/accountsPage.tsx +++ b/packages/page-accounts/test/pages/accountsPage.tsx @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/page-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global expect */ + import type { Sidebar } from '@polkadot/test-support/pagesElements'; import type { AccountOverrides } from '@polkadot/test-support/types'; diff --git a/packages/page-addresses/src/Contacts/index.spec.ts b/packages/page-addresses/src/Contacts/index.spec.ts index 7eb599dba1..df338a607b 100644 --- a/packages/page-addresses/src/Contacts/index.spec.ts +++ b/packages/page-addresses/src/Contacts/index.spec.ts @@ -16,6 +16,7 @@ import { keyring } from '@polkadot/ui-keyring'; import { AddressesPage } from '../../test/pages/addressesPage.js'; // FIXME isSplit Table +// eslint-disable-next-line jest/no-disabled-tests describe.skip('Addresses page', () => { let addressesPage: AddressesPage; @@ -48,6 +49,7 @@ describe.skip('Addresses page', () => { expect(await addressesTable.getRows()).toHaveLength(0); }); + // eslint-disable-next-line jest/expect-expect it('the contacts table contains a message about no contacts available', async () => { const noContactsMessage = 'no addresses saved yet, add any existing address'; @@ -70,6 +72,7 @@ describe.skip('Addresses page', () => { expect(rows).toHaveLength(2); }); + // eslint-disable-next-line jest/expect-expect it('contact rows display the total balance info', async () => { addressesPage.renderContactsWithDefaultAddresses( aContactWithBalance({ freeBalance: balance(500) }), @@ -82,6 +85,7 @@ describe.skip('Addresses page', () => { await rows[1].assertBalancesTotal(balance(350)); }); + // eslint-disable-next-line jest/expect-expect it('contact rows display the details balance info', async () => { addressesPage.renderContactsWithDefaultAddresses( aContactWithBalance({ freeBalance: balance(500), lockedBalance: balance(30) }), @@ -98,6 +102,7 @@ describe.skip('Addresses page', () => { { amount: balance(150), name: 'reserved' }]); }); + // eslint-disable-next-line jest/expect-expect it('when a contact is not tagged, details row displays no tags info', async () => { addressesPage.renderDefaultContacts(1); const rows = await addressesPage.getAddressesRows(); diff --git a/packages/page-addresses/test/pages/addressesPage.tsx b/packages/page-addresses/test/pages/addressesPage.tsx index e6a24f8277..27df23d3fe 100644 --- a/packages/page-addresses/test/pages/addressesPage.tsx +++ b/packages/page-addresses/test/pages/addressesPage.tsx @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/page-addresses authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global jest */ + import type { Row } from '@polkadot/test-support/pagesElements'; import type { AccountOverrides as ContactOverrides } from '@polkadot/test-support/types'; diff --git a/packages/page-assets/src/Balances/Account.tsx b/packages/page-assets/src/Balances/Account.tsx index 0111303c00..394d500a0a 100644 --- a/packages/page-assets/src/Balances/Account.tsx +++ b/packages/page-assets/src/Balances/Account.tsx @@ -18,13 +18,13 @@ import Transfer from './Transfer.js'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore This looks correct in the editor, but incorrect in composite mode -interface Account extends PalletAssetsAssetAccount { +interface AccountExt extends PalletAssetsAssetAccount { isFrozen?: bool; sufficient?: bool } interface Props { - account: Account; + account: AccountExt; accountId: string; assetId: BN; className?: string; diff --git a/packages/page-bounties/src/Bounties.slow.spec.tsx b/packages/page-bounties/src/Bounties.slow.spec.tsx index fbfc64a60c..edb615e062 100644 --- a/packages/page-bounties/src/Bounties.slow.spec.tsx +++ b/packages/page-bounties/src/Bounties.slow.spec.tsx @@ -46,6 +46,7 @@ const renderBounties = () => { ); }; +// eslint-disable-next-line jest/no-disabled-tests describe.skip('--SLOW--: Bounties', () => { it('list shows an existing bounty', async () => { const api = await createApi(); diff --git a/packages/page-bounties/src/Bounties.spec.ts b/packages/page-bounties/src/Bounties.spec.ts index 7aed01f943..df86ee2518 100644 --- a/packages/page-bounties/src/Bounties.spec.ts +++ b/packages/page-bounties/src/Bounties.spec.ts @@ -3,6 +3,8 @@ /// +/* eslint-disable jest/expect-expect */ + import type { ApiPromise } from '@polkadot/api'; import type { SubmittableExtrinsic } from '@polkadot/api/types'; import type { DeriveCollectiveProposal } from '@polkadot/api-derive/types'; @@ -431,7 +433,7 @@ describe('Bounties', () => { }); describe('award beneficiary action modal', () => { - it('awards the beneficiary ', async () => { + it('awards the beneficiary', async () => { const bounty = aBounty({ status: bountyStatusWith({ curator: alice }) }); bountiesPage.renderOne(bounty); diff --git a/packages/page-bounties/test/hooks/defaults.ts b/packages/page-bounties/test/hooks/defaults.ts index 5891970648..44e2e87cf4 100644 --- a/packages/page-bounties/test/hooks/defaults.ts +++ b/packages/page-bounties/test/hooks/defaults.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global jest */ + import type { SubmittableExtrinsicFunction } from '@polkadot/api/types'; import type { DeriveBounties } from '@polkadot/api-derive/types'; import type { BountyApi } from '../../src/hooks/index.js'; diff --git a/packages/page-bounties/test/pages/bountiesPage.tsx b/packages/page-bounties/test/pages/bountiesPage.tsx index bb69f31fc2..c358b8a6aa 100644 --- a/packages/page-bounties/test/pages/bountiesPage.tsx +++ b/packages/page-bounties/test/pages/bountiesPage.tsx @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global jest, expect */ + import type { RenderResult } from '@testing-library/react'; import type { ApiPromise } from '@polkadot/api'; import type { DeriveCollectiveProposal } from '@polkadot/api-derive/types'; diff --git a/packages/page-contracts/src/types.ts b/packages/page-contracts/src/types.ts index 5f0f72a4d8..ed49a644ce 100644 --- a/packages/page-contracts/src/types.ts +++ b/packages/page-contracts/src/types.ts @@ -1,6 +1,7 @@ // Copyright 2017-2023 @polkadot/app-contracts authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; import type { Abi } from '@polkadot/api-contract'; import type { WeightV2 } from '@polkadot/types/interfaces'; import type { BN } from '@polkadot/util'; diff --git a/packages/page-referenda/src/util.spec.ts b/packages/page-referenda/src/util.spec.ts index 7a17d6c4b2..960097e9c2 100644 --- a/packages/page-referenda/src/util.spec.ts +++ b/packages/page-referenda/src/util.spec.ts @@ -104,10 +104,6 @@ describe('curveThreshold', (): void => { ).toEqual('499999999'); }); }); - - // describe('Stepped', (): void => { - - // }); }); describe('curveDelay', (): void => { diff --git a/packages/page-settings/src/I18n/index.tsx b/packages/page-settings/src/I18n/index.tsx index 60da13faa4..bb09b7467f 100644 --- a/packages/page-settings/src/I18n/index.tsx +++ b/packages/page-settings/src/I18n/index.tsx @@ -13,7 +13,7 @@ import { settings } from '@polkadot/ui-settings'; import { useTranslation } from '../translate.js'; import StringInput from './StringInput.js'; -type Progress = [[number, number, number], Record]; +type ProgressType = [[number, number, number], Record]; type Strings = Record; type StringsMod = Record; @@ -94,7 +94,7 @@ async function retrieveAll (): Promise { }; } -function calcProgress (english: StringsMod, language: Strings): Progress { +function calcProgress (english: StringsMod, language: Strings): ProgressType { const breakdown: Record = {}; let done = 0; let total = 0; @@ -150,7 +150,7 @@ function Translate ({ className }: Props): React.ReactElement { const [withEmpty, toggleWithEmpty] = useToggle(); const [{ english, keys, modules }, setDefaults] = useState({ english: {}, keys: [], modules: [] }); const [lng, setLng] = useState('zh'); - const [[modProgress, allProgress], setProgress] = useState([[0, 0, 0], {}]); + const [[modProgress, allProgress], setProgress] = useState([[0, 0, 0], {}]); const [record, setRecord] = useState('app-accounts.json'); const [strings, setStrings] = useState(null); @@ -187,7 +187,7 @@ function Translate ({ className }: Props): React.ReactElement { if (hasPrevVal !== !!sanitized) { const [progress, breakdown] = calcProgress(english, languageCache[lng]); - setProgress(([counters]): Progress => { + setProgress(([counters]): ProgressType => { progress[2] = Math.max(0, progress[0] - counters[0]); return [progress, breakdown]; diff --git a/packages/page-treasury/src/Tips/Tips.tsx b/packages/page-treasury/src/Tips/Tips.tsx index 3741d2f7db..51a21eab33 100644 --- a/packages/page-treasury/src/Tips/Tips.tsx +++ b/packages/page-treasury/src/Tips/Tips.tsx @@ -23,11 +23,11 @@ interface Props { onSelectTip: (hash: string, isSelected: boolean, value: BN) => void, } -type Tip = [string, PalletTipsOpenTip | OpenTipTo225]; +type TipType = [string, PalletTipsOpenTip | OpenTipTo225]; const TIP_OPTS = { withParams: true }; -function extractTips (tipsWithHashes?: [[string[]], Option[]], inHashes?: string[] | null): Tip[] | undefined { +function extractTips (tipsWithHashes?: [[string[]], Option[]], inHashes?: string[] | null): TipType[] | undefined { if (!tipsWithHashes || !inHashes) { return undefined; } diff --git a/packages/react-api/src/light.spec.ts b/packages/react-api/src/light.spec.ts index bfda2cecc8..6740f9fb11 100644 --- a/packages/react-api/src/light.spec.ts +++ b/packages/react-api/src/light.spec.ts @@ -16,9 +16,9 @@ const specDir = path.join(process.cwd(), srcRel); describe('lightSpecs', (): void => { for (const [k, specs] of Object.entries(lightSpecs)) { - describe(k, (): void => { + describe(`${k}`, (): void => { for (const [k, info] of Object.entries(specs)) { - it(k, (): void => { + it(`${k}`, (): void => { assert( fs.existsSync(path.join(specDir, info)), `${srcRel}/${info.slice(2)} does not exist` diff --git a/packages/react-api/src/types.ts b/packages/react-api/src/types.ts index 397d95cd33..aa60f74876 100644 --- a/packages/react-api/src/types.ts +++ b/packages/react-api/src/types.ts @@ -1,6 +1,7 @@ // Copyright 2017-2023 @polkadot/react-api authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; import type { ApiPromise } from '@polkadot/api'; import type { SubmittableExtrinsicFunction } from '@polkadot/api/promise/types'; import type { LinkOption } from '@polkadot/apps-config/endpoints/types'; diff --git a/packages/react-api/src/util/intervalObservable.ts b/packages/react-api/src/util/intervalObservable.ts index 98c83e8778..174b79041f 100644 --- a/packages/react-api/src/util/intervalObservable.ts +++ b/packages/react-api/src/util/intervalObservable.ts @@ -1,6 +1,7 @@ // Copyright 2017-2023 @polkadot/react-api authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; import type { Subscription } from 'rxjs'; import type { CallState } from '../types.js'; diff --git a/packages/react-components/src/AccountSidebar/Sidebar.spec.tsx b/packages/react-components/src/AccountSidebar/Sidebar.spec.tsx index 5bfe2686df..e892c2483d 100644 --- a/packages/react-components/src/AccountSidebar/Sidebar.spec.tsx +++ b/packages/react-components/src/AccountSidebar/Sidebar.spec.tsx @@ -19,6 +19,7 @@ import { keyring } from '@polkadot/ui-keyring'; import { AccountsPage } from '../../../page-accounts/test/pages/accountsPage.js'; // FIXME: these all need to be wrapped in waitFor .... +// eslint-disable-next-line jest/no-disabled-tests describe.skip('Sidebar', () => { let accountsPage: AccountsPage; let sideBar: Sidebar; @@ -61,10 +62,12 @@ describe.skip('Sidebar', () => { expect(changedAccount?.meta?.name).toEqual(newName); }); + // eslint-disable-next-line jest/expect-expect it('within sidebar', async () => { await sideBar.assertAccountName(newName); }); + // eslint-disable-next-line jest/expect-expect it('within account row', async () => { const accountRows = await accountsPage.getAccountRows(); @@ -78,7 +81,7 @@ describe.skip('Sidebar', () => { await sideBar.clickByText('none'); expect(sideBar.queryByRole('combobox')).toBeFalsy(); - await expect(sideBar.typeAccountName(newName)).rejects.toThrowError(nameInputNotFoundError); + await expect(sideBar.typeAccountName(newName)).rejects.toThrow(nameInputNotFoundError); }); it('when isEditable is false account name is not editable', async () => { @@ -88,7 +91,7 @@ describe.skip('Sidebar', () => { sideBar = await accountsPage.openSidebarForRow(0); sideBar.edit(); - await expect(sideBar.typeAccountName(newName)).rejects.toThrowError(nameInputNotFoundError); + await expect(sideBar.typeAccountName(newName)).rejects.toThrow(nameInputNotFoundError); }); describe('on edit cancel', () => { @@ -102,6 +105,7 @@ describe.skip('Sidebar', () => { sideBar.edit(); }); + // eslint-disable-next-line jest/expect-expect it('restores tags and name to state from keyring', async () => { await sideBar.typeAccountName(newName); await sideBar.selectTag(defaultTag); @@ -145,6 +149,7 @@ describe.skip('Sidebar', () => { expect(sideBar.queryByRole('button', { name: 'Cancel' })).toBeTruthy(); }); + // eslint-disable-next-line jest/expect-expect it('cancels editing and changes name when opening sidebar for another account', async () => { await waitFor(() => sideBar.assertAccountInput('alice')); @@ -188,6 +193,7 @@ describe.skip('Sidebar', () => { expect(subAccount).toHaveTextContent('BOB'); }); + // eslint-disable-next-line jest/expect-expect it('displays picked sub in sidebar', async () => { const subAccount = subs[0].childNodes[1]; @@ -199,6 +205,7 @@ describe.skip('Sidebar', () => { }); describe('judgements', () => { + // eslint-disable-next-line jest/expect-expect it('displays several judgements', async () => { mockApiHooks.setJudgements(mockRegistration.judgements as RegistrationJudgement[]); accountsPage.renderDefaultAccounts(1); @@ -209,6 +216,7 @@ describe.skip('Sidebar', () => { await sideBar.assertJudgement('1 Erroneous'); }); + // eslint-disable-next-line jest/expect-expect it('displays no judgements', async () => { accountsPage.renderDefaultAccounts(1); sideBar = await accountsPage.openSidebarForRow(0); @@ -227,12 +235,14 @@ describe.skip('Sidebar', () => { sideBar = await accountsPage.openSidebarForRow(0); }); + // eslint-disable-next-line jest/expect-expect it('singular registrar', async () => { const judgementTag = await sideBar.getJudgement('1 Known good'); await judgementTag.assertRegistrars([charlieShortAddress]); }); + // eslint-disable-next-line jest/expect-expect it('multiple registrars', async () => { const judgementTag = await sideBar.getJudgement('2 Reasonable'); diff --git a/packages/react-components/src/Button/types.ts b/packages/react-components/src/Button/types.ts index a02f075a15..277999b37c 100644 --- a/packages/react-components/src/Button/types.ts +++ b/packages/react-components/src/Button/types.ts @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { IconName } from '@fortawesome/fontawesome-svg-core'; +import type React from 'react'; export type Button$Callback = () => void | Promise; diff --git a/packages/react-components/src/Modal/Modal.spec.tsx b/packages/react-components/src/Modal/Modal.spec.tsx index 6beb3378a8..08cd5abe5e 100644 --- a/packages/react-components/src/Modal/Modal.spec.tsx +++ b/packages/react-components/src/Modal/Modal.spec.tsx @@ -61,6 +61,7 @@ describe('Modal Component', () => { await i18next.changeLanguage('en'); }); + // eslint-disable-next-line jest/expect-expect it('opens and closes modal', async () => { renderModal(); @@ -73,6 +74,7 @@ describe('Modal Component', () => { }); }); + // eslint-disable-next-line jest/expect-expect it('renders all modal sections', async () => { renderModal(); @@ -87,6 +89,7 @@ describe('Modal Component', () => { }); }); + // eslint-disable-next-line jest/expect-expect it('closes modal with ESC button', async () => { renderModal(); diff --git a/packages/react-components/src/Popup/Popup.spec.tsx b/packages/react-components/src/Popup/Popup.spec.tsx index 4ebf7f3d67..66355fff59 100644 --- a/packages/react-components/src/Popup/Popup.spec.tsx +++ b/packages/react-components/src/Popup/Popup.spec.tsx @@ -42,6 +42,7 @@ describe('Popup Component', () => { await i18next.changeLanguage('en'); }); + // eslint-disable-next-line jest/expect-expect it('opens and closes', async () => { renderPopup(); @@ -54,6 +55,7 @@ describe('Popup Component', () => { }); }); + // eslint-disable-next-line jest/expect-expect it('closes popup with outside click', async () => { renderPopup(); diff --git a/packages/react-components/src/index.ts b/packages/react-components/src/index.ts index 0d172e4a0d..4578a48093 100644 --- a/packages/react-components/src/index.ts +++ b/packages/react-components/src/index.ts @@ -104,4 +104,6 @@ export * from './modals/index.js'; export * from './themes.js'; // external exports +// See https://github.com/import-js/eslint-plugin-import/issues/2556 +// eslint-disable-next-line import/export export * from '@polkadot/react-qr'; diff --git a/packages/react-components/src/types.ts b/packages/react-components/src/types.ts index d528ac09da..854c2a978a 100644 --- a/packages/react-components/src/types.ts +++ b/packages/react-components/src/types.ts @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { IconName } from '@fortawesome/fontawesome-svg-core'; +import type React from 'react'; import type { WithTranslation } from 'react-i18next'; import type { SubmittableExtrinsic } from '@polkadot/api/types'; import type { Abi } from '@polkadot/api-contract'; diff --git a/packages/react-components/src/util/types.ts b/packages/react-components/src/util/types.ts index a976234511..44d4bd7932 100644 --- a/packages/react-components/src/util/types.ts +++ b/packages/react-components/src/util/types.ts @@ -1,6 +1,7 @@ // Copyright 2017-2023 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; import type { RegistrarIndex } from '@polkadot/types/interfaces/identity/types'; import type { DisplayedJudgement } from '../types.js'; diff --git a/packages/react-hooks/src/types.ts b/packages/react-hooks/src/types.ts index 890f6470b9..99401d73ca 100644 --- a/packages/react-hooks/src/types.ts +++ b/packages/react-hooks/src/types.ts @@ -1,6 +1,7 @@ // Copyright 2017-2023 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; import type { ApiPromise } from '@polkadot/api'; import type { SubmittableExtrinsic } from '@polkadot/api/types'; import type { DeriveAccountFlags, DeriveAccountRegistration } from '@polkadot/api-derive/types'; @@ -12,13 +13,16 @@ import type { KeyringJson$Meta } from '@polkadot/ui-keyring/types'; import type { BN } from '@polkadot/util'; import type { HexString } from '@polkadot/util/types'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any export type CallParam = any; export type CallParams = [] | CallParam[]; export interface CallOptions { defaultValue?: T; + // eslint-disable-next-line @typescript-eslint/no-explicit-any paramMap?: (params: any) => CallParams; + // eslint-disable-next-line @typescript-eslint/no-explicit-any transform?: (value: any, api: ApiPromise) => T; withParams?: boolean; withParamsTransform?: boolean; diff --git a/packages/react-hooks/src/useIsMountedRef.ts b/packages/react-hooks/src/useIsMountedRef.ts index 74e3179514..beeb482755 100644 --- a/packages/react-hooks/src/useIsMountedRef.ts +++ b/packages/react-hooks/src/useIsMountedRef.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; + import { useEffect, useRef } from 'react'; import { createNamedHook } from './createNamedHook.js'; diff --git a/packages/react-hooks/src/useOutsideClick.ts b/packages/react-hooks/src/useOutsideClick.ts index 1e000176f3..dbc26130e8 100644 --- a/packages/react-hooks/src/useOutsideClick.ts +++ b/packages/react-hooks/src/useOutsideClick.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { RefObject } from 'react'; +import type React from 'react'; import { useCallback, useEffect } from 'react'; @@ -14,7 +14,7 @@ function isRefClicked (refs: React.RefObject[], e: MouseEvent): ); } -function useOutsideClickImpl (refs: RefObject[], callback: () => void): void { +function useOutsideClickImpl (refs: React.RefObject[], callback: () => void): void { const handleClick = useCallback( (e: MouseEvent): void => { if (refs.length && !isRefClicked(refs, e)) { diff --git a/packages/react-hooks/src/usePassword.ts b/packages/react-hooks/src/usePassword.ts index ecfb79b1bf..27de30446c 100644 --- a/packages/react-hooks/src/usePassword.ts +++ b/packages/react-hooks/src/usePassword.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; + import { useEffect, useState } from 'react'; import { keyring } from '@polkadot/ui-keyring'; diff --git a/packages/react-hooks/src/useSavedFlags.ts b/packages/react-hooks/src/useSavedFlags.ts index fa57e7a87b..abd0c1468a 100644 --- a/packages/react-hooks/src/useSavedFlags.ts +++ b/packages/react-hooks/src/useSavedFlags.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; + import { useEffect, useState } from 'react'; import store from 'store'; diff --git a/packages/react-hooks/src/useTheme.ts b/packages/react-hooks/src/useTheme.ts index 08c7be6f21..5b959bf1db 100644 --- a/packages/react-hooks/src/useTheme.ts +++ b/packages/react-hooks/src/useTheme.ts @@ -1,6 +1,7 @@ // Copyright 2017-2023 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; import type { ThemeDef } from '@polkadot/react-components/types'; import { useContext, useMemo } from 'react'; diff --git a/packages/react-hooks/src/useWeight.ts b/packages/react-hooks/src/useWeight.ts index 8fa6079cc5..f7a7a1c488 100644 --- a/packages/react-hooks/src/useWeight.ts +++ b/packages/react-hooks/src/useWeight.ts @@ -62,6 +62,7 @@ function useWeightImpl (call?: Call | null): Result { const { api } = useApi(); const mountedRef = useIsMountedRef(); const [state, setState] = useState(() => objectSpread({ + // eslint-disable-next-line @typescript-eslint/unbound-method isWeightV2: !isFunction(api.registry.createType('Weight').toBn) }, EMPTY_STATE)); diff --git a/packages/react-params/src/Named/Call.tsx b/packages/react-params/src/Named/Call.tsx index 021411fb98..b6e32a0079 100644 --- a/packages/react-params/src/Named/Call.tsx +++ b/packages/react-params/src/Named/Call.tsx @@ -57,7 +57,7 @@ function isExtrinsic (value: unknown): value is IExtrinsic { // This is no doubt NOT the way to do things - however there is no other option function getRawSignature (value: IExtrinsic): ExtrinsicSignature | undefined { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any return (value as any)._raw?.signature?.multiSignature as ExtrinsicSignature; } diff --git a/packages/react-params/src/Param/File.tsx b/packages/react-params/src/Param/File.tsx index 51031a9964..e4036cd1e3 100644 --- a/packages/react-params/src/Param/File.tsx +++ b/packages/react-params/src/Param/File.tsx @@ -9,7 +9,7 @@ import Bare from './Bare.js'; interface Props { className?: string; - defaultValue?: any; + defaultValue?: unknown; isDisabled?: boolean; isError?: boolean; label?: React.ReactNode; diff --git a/packages/react-params/src/Param/VoteThreshold.tsx b/packages/react-params/src/Param/VoteThreshold.tsx index bffa766f0f..d62e1228e1 100644 --- a/packages/react-params/src/Param/VoteThreshold.tsx +++ b/packages/react-params/src/Param/VoteThreshold.tsx @@ -36,6 +36,7 @@ function VoteThresholdParam ({ className = '', defaultValue: { value }, isDisabl ); const defaultValue = useMemo( + // eslint-disable-next-line @typescript-eslint/unbound-method () => isFunction((value as BN).toNumber) ? (value as BN).toNumber() : bnToBn(value as number).toNumber(), diff --git a/packages/react-params/src/Param/findComponent.ts b/packages/react-params/src/Param/findComponent.ts index dedd8c929b..859ee8a61a 100644 --- a/packages/react-params/src/Param/findComponent.ts +++ b/packages/react-params/src/Param/findComponent.ts @@ -1,6 +1,7 @@ // Copyright 2017-2023 @polkadot/react-params authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; import type { Registry, TypeDef } from '@polkadot/types/types'; import type { ComponentMap, Props } from '../types.js'; @@ -41,6 +42,7 @@ import Vote from './Vote.js'; import VoteThreshold from './VoteThreshold.js'; interface TypeToComponent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any c: React.ComponentType; t: string[]; } diff --git a/packages/react-params/src/types.ts b/packages/react-params/src/types.ts index fbb6fa0a1e..8f360fde5c 100644 --- a/packages/react-params/src/types.ts +++ b/packages/react-params/src/types.ts @@ -1,6 +1,7 @@ // Copyright 2017-2023 @polkadot/react-params authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type React from 'react'; import type { Registry, TypeDef } from '@polkadot/types/types'; import type { HexString } from '@polkadot/util/types'; diff --git a/packages/react-params/src/valueToText.tsx b/packages/react-params/src/valueToText.tsx index 12ed48db1c..09b277ef1d 100644 --- a/packages/react-params/src/valueToText.tsx +++ b/packages/react-params/src/valueToText.tsx @@ -34,6 +34,7 @@ function formatKeys (keys: [ValidatorId, Keys][]): string { } function toHuman (value: Codec | Codec[]): unknown { + // eslint-disable-next-line @typescript-eslint/unbound-method return isFunction((value as Codec).toHuman) ? (value as Codec).toHuman() : Array.isArray(value) @@ -41,7 +42,7 @@ function toHuman (value: Codec | Codec[]): unknown { : value.toString(); } -export function toHumanJson (value: any): string { +export function toHumanJson (value: unknown): string { return stringify(value, 2) .replace(/,\n/g, '\n') .replace(/"/g, '') @@ -56,6 +57,7 @@ export default function valueToText (type: string, value: Codec | undefined | nu return div( {}, + // eslint-disable-next-line @typescript-eslint/unbound-method ['Bytes', 'Raw', 'Option', 'Keys'].includes(type) && isFunction(value.toU8a) ? u8aToHex(value.toU8a(true)) // HACK Handle Keys as hex-only (this should go away once the node value is diff --git a/packages/test-support/src/pages/Page.tsx b/packages/test-support/src/pages/Page.tsx index 9fea6d55a0..d74bcdfa4f 100644 --- a/packages/test-support/src/pages/Page.tsx +++ b/packages/test-support/src/pages/Page.tsx @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/page-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global jest, fail */ + import type { RenderResult } from '@testing-library/react'; import type { ApiProps } from '@polkadot/react-api/types'; import type { PartialQueueTxExtrinsic, QueueProps, QueueTxExtrinsicAdd } from '@polkadot/react-components/Status/types'; diff --git a/packages/test-support/src/pagesElements/JudgementTag.ts b/packages/test-support/src/pagesElements/JudgementTag.ts index 0ce3c05f0a..4fe893ccbb 100644 --- a/packages/test-support/src/pagesElements/JudgementTag.ts +++ b/packages/test-support/src/pagesElements/JudgementTag.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/test-supports authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global fail */ + import { fireEvent, screen, within } from '@testing-library/react'; export class JudgementTag { diff --git a/packages/test-support/src/pagesElements/Row.ts b/packages/test-support/src/pagesElements/Row.ts index eef84e3bdc..d0999ea546 100644 --- a/packages/test-support/src/pagesElements/Row.ts +++ b/packages/test-support/src/pagesElements/Row.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/test-supports authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global expect */ + import type { Balance } from '@polkadot/types/interfaces'; import { fireEvent, screen, within } from '@testing-library/react'; diff --git a/packages/test-support/src/pagesElements/Sidebar.ts b/packages/test-support/src/pagesElements/Sidebar.ts index f14b0de974..0206f145d5 100644 --- a/packages/test-support/src/pagesElements/Sidebar.ts +++ b/packages/test-support/src/pagesElements/Sidebar.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/test-supports authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global expect */ + import { fireEvent, screen, within } from '@testing-library/react'; import { JudgementTag } from './JudgementTag.js'; diff --git a/packages/test-support/src/pagesElements/Table.ts b/packages/test-support/src/pagesElements/Table.ts index 103c451fa6..288ab7b3d5 100644 --- a/packages/test-support/src/pagesElements/Table.ts +++ b/packages/test-support/src/pagesElements/Table.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/test-supports authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global expect */ + import { within } from '@testing-library/react'; import { showBalance } from '../utils/balance.js'; diff --git a/packages/test-support/src/react/apiInTests.ts b/packages/test-support/src/react/apiInTests.ts index 90efba94a7..32d0b31ac9 100644 --- a/packages/test-support/src/react/apiInTests.ts +++ b/packages/test-support/src/react/apiInTests.ts @@ -6,6 +6,7 @@ import type React from 'react'; import { useApi } from '@polkadot/react-hooks'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any export const WaitForApi = ({ children }: { children: React.ReactNode }): PropsWithChildren | null => { const api = useApi(); diff --git a/packages/test-support/src/utils/accountDefaults.ts b/packages/test-support/src/utils/accountDefaults.ts index 8f44a849f9..2c577db9c6 100644 --- a/packages/test-support/src/utils/accountDefaults.ts +++ b/packages/test-support/src/utils/accountDefaults.ts @@ -43,8 +43,7 @@ export const emptyAccounts: Accounts = { // here it's extremely hard to reconstruct the entire DeriveBalancesAll upfront, so we incrementally add properties // instead along the way; thus the need to tell the tsc we know what we are doing here -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -export const defaultBalanceAccount: DeriveBalancesAll = { +export const defaultBalanceAccount = { accountNonce: new BN(1), additional: [], availableBalance: balanceOf(0), @@ -53,12 +52,11 @@ export const defaultBalanceAccount: DeriveBalancesAll = { lockedBreakdown: [], namedReserves: [], reservedBalance: balanceOf(0) -} as any; +} as unknown as DeriveBalancesAll; // here it's extremely hard to reconstruct the entire DeriveStakingAccount upfront, // so we set just the properties that we use in page-accounts -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -export const defaultStakingAccount: DeriveStakingAccount = { +export const defaultStakingAccount = { nextSessionIds: [], nominators: [], redeemable: balanceOf(0), @@ -78,15 +76,14 @@ export const defaultStakingAccount: DeriveStakingAccount = { value: balanceOf(0) } ] -} as any; +} as unknown as DeriveStakingAccount; export const defaultMeta: KeyringJson$Meta = {}; -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -export const defaultAccountInfo: UseAccountInfo = { +export const defaultAccountInfo = { flags: {}, identity: { email: 'user@email.com', isExistent: true, judgements: [] }, tags: [] -} as any; +} as unknown as UseAccountInfo; class MockAccountHooks { public useAccounts: Accounts = emptyAccounts; @@ -109,32 +106,25 @@ class MockAccountHooks { const balance = { ...defaultBalanceAccount }; const info = { ...defaultAccountInfo }; - // Typescript does not recognize that keys and values from Object.entries are safe, - // so we have to use "any" here. - Object .entries(props.meta || meta) .forEach(([key, value]) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - (meta as any)[key] = value; + (meta as Record)[key] = value; }); Object .entries(props.balance || balance) .forEach(([key, value]) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - (balance as any)[key] = value; + (balance as Record)[key] = value; }); Object .entries(props.staking || staking) .forEach(([key, value]) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - (staking as any)[key] = value; + (staking as Record)[key] = value; }); Object .entries(props.info || info) .forEach(([key, value]) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - (info as any)[key] = value; + (info as Record)[key] = value; }); this.accountsMap[address] = { diff --git a/packages/test-support/src/utils/renderedScreenUtils.ts b/packages/test-support/src/utils/renderedScreenUtils.ts index c001c16f93..973efd3777 100644 --- a/packages/test-support/src/utils/renderedScreenUtils.ts +++ b/packages/test-support/src/utils/renderedScreenUtils.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/test-supports authors & contributors // SPDX-License-Identifier: Apache-2.0 +/* global expect */ + import { fireEvent, screen } from '@testing-library/react'; export const clickButton = async (buttonName: string): Promise => { diff --git a/scripts/i18nLint.cjs b/scripts/i18nLint.cjs index ad05c4b824..e8075f530b 100644 --- a/scripts/i18nLint.cjs +++ b/scripts/i18nLint.cjs @@ -4,9 +4,14 @@ const fs = require('node:fs'); const path = require('node:path'); +/** @type {Record} */ const defaults = {}; const i18nRoot = path.join(__dirname, '../packages/apps/public/locales'); +/** + * @param {string} langRoot + * @returns {string[]} + */ function getEntries (langRoot) { return fs .readdirSync(langRoot) @@ -19,6 +24,9 @@ function getEntries (langRoot) { .sort(); } +/** + * @param {string} lang + */ function checkLanguage (lang) { console.log(`*** Checking ${lang}`); diff --git a/scripts/i18nSort.cjs b/scripts/i18nSort.cjs index 30a87fafdb..1e60e5d121 100644 --- a/scripts/i18nSort.cjs +++ b/scripts/i18nSort.cjs @@ -8,6 +8,10 @@ const i18nRoot = path.join(__dirname, '../packages/apps/public/locales'); const SKIP_NS = ['translation'].map((f) => `${f}.json`); +/** + * @param {string} langRoot + * @returns {string[]} + */ function getEntries (langRoot) { return fs .readdirSync(langRoot) @@ -20,19 +24,26 @@ function getEntries (langRoot) { .sort(); } +/** + * @param {string} lang + */ function sortLanguage (lang) { const langRoot = path.join(i18nRoot, lang); const entries = getEntries(langRoot); + /** @type {Record} */ const hasKeys = {}; entries.forEach((entry) => { const filename = path.join(langRoot, entry); const json = require(filename); - const sorted = Object.keys(json).sort().reduce((result, key) => { - result[key] = json[key]; + const sorted = Object + .keys(json) + .sort() + .reduce((/** @type {Record} */ result, key) => { + result[key] = json[key]; - return result; - }, {}); + return result; + }, {}); hasKeys[entry] = Object.keys(sorted).length !== 0; diff --git a/scripts/imgConvert.mjs b/scripts/imgConvert.mjs index 0ce86eb143..fe12de64d2 100644 --- a/scripts/imgConvert.mjs +++ b/scripts/imgConvert.mjs @@ -11,27 +11,36 @@ const MAX_SIZE = 48 * 1024; // FIXME The sorting here and the sorting from linting seems like a mismatch... const HEADER = '// Copyright 2017-2023 @polkadot/apps authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n// Do not edit. Auto-generated via node scripts/imgConvert.mjs\n\n'; +/** @type {Record} */ const MIME = { gif: 'image/gif', jpeg: 'image/jpeg', png: 'image/png', svg: 'image/svg+xml' -} +}; +/** + * @param {string} k + * @param {string} contents + * @returns {string} + */ function makeContents (k, contents) { return `${HEADER}export const ${k} = '${contents}';\n`; } +/** @type {Record} */ const all = {}; +/** @type {Record} */ const oversized = {}; -for (let dir of ['extensions', 'external', 'chains', 'nodes']) { +for (const dir of ['extensions', 'external', 'chains', 'nodes']) { const sub = path.join('packages/apps-config/src/ui/logos', dir); const generated = path.join(sub, 'generated'); + /** @type {Record} */ const result = {}; if (fs.existsSync(generated)) { - fs.rmSync(generated, { recursive: true, force: true }); + fs.rmSync(generated, { force: true, recursive: true }); } fs.mkdirSync(generated); @@ -67,45 +76,46 @@ for (let dir of ['extensions', 'external', 'chains', 'nodes']) { } }); - if (Object.keys(result).length) { - let srcs = ''; + if (Object.keys(result).length) { + let srcs = ''; - for (let dir of ['endpoints', 'extensions', 'links']) { - const srcroot = path.join('packages/apps-config/src', dir); + for (const dir of ['endpoints', 'extensions', 'links']) { + const srcroot = path.join('packages/apps-config/src', dir); - fs - .readdirSync(srcroot) - .forEach((file) => { - const full = path.join(srcroot, file); + fs + .readdirSync(srcroot) + .forEach((file) => { + const full = path.join(srcroot, file); - if (fs.lstatSync(full).isFile() && file.endsWith('.ts')) { - srcs += fs.readFileSync(full).toString(); - } - }); - } - - const notfound = Object - .keys(result) - .filter((k) => !srcs.includes(k)); - - if (notfound.length) { - console.log('\n', notfound.length.toString().padStart(3), 'not referenced in', dir, '::\n\n\t', notfound.join(', '), '\n'); - } - - fs.writeFileSync(path.join(sub, 'index.ts'), `${HEADER}${ - Object - .keys(result) - .sort((a, b) => result[a].localeCompare(result[b])) - .map((k) => `export { ${k} } from './${result[k]}.js';`) - .join('\n') - }\n`); + if (fs.lstatSync(full).isFile() && file.endsWith('.ts')) { + srcs += fs.readFileSync(full).toString(); + } + }); } + + const notfound = Object + .keys(result) + .filter((k) => !srcs.includes(k)); + + if (notfound.length) { + console.log('\n', notfound.length.toString().padStart(3), 'not referenced in', dir, '::\n\n\t', notfound.join(', '), '\n'); + } + + fs.writeFileSync(path.join(sub, 'index.ts'), `${HEADER}${ + Object + .keys(result) + .sort((a, b) => result[a].localeCompare(result[b])) + .map((k) => `export { ${k} } from './${result[k]}.js';`) + .join('\n') + }\n`); + } } const allKeys = Object.keys(all); +/** @type {Record} */ const dupes = {}; - allKeys.forEach((a) => { +allKeys.forEach((a) => { const d = allKeys.filter((b) => a !== b && all[a] === all[b] @@ -114,14 +124,14 @@ const dupes = {}; if (d.length) { dupes[a] = d; } - }); +}); if (Object.keys(dupes).length) { const errMsg = `${Object.keys(dupes).length.toString().padStart(3)} dupes found`; console.log('\n', errMsg, '::\n'); - for (let [k, d] of Object.entries(dupes)) { + for (const [k, d] of Object.entries(dupes)) { console.log('\t', k.padStart(30), ' >> ', d.join(', ')); } @@ -137,8 +147,8 @@ if (numOversized) { console.log('\n', errMsg, '::\n'); - for (let [k, v] of Object.entries(oversized)) { - console.log('\t', k.padStart(30), formatNumber(v).padStart(15), `(+${formatNumber(v - MAX_SIZE)} bytes)`) + for (const [k, v] of Object.entries(oversized)) { + console.log('\t', k.padStart(30), formatNumber(v).padStart(15), `(+${formatNumber(v - MAX_SIZE)} bytes)`); } console.log(); diff --git a/scripts/ipfsUpload.mjs b/scripts/ipfsUpload.mjs index 61c36cc64a..da59b19b6b 100644 --- a/scripts/ipfsUpload.mjs +++ b/scripts/ipfsUpload.mjs @@ -1,14 +1,20 @@ // Copyright 2017-2023 @polkadot/apps authors & contributors // SPDX-License-Identifier: Apache-2.0 +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-nocheck Currently we have a bit too many of these + import CrustPinner from '@crustio/crust-pin'; import PinataSDK from '@pinata/sdk'; +// @ts-expect-error No definition file import cloudflare from 'dnslink-cloudflare'; import fs from 'node:fs'; +// @ts-expect-error No definition file import { execSync } from '@polkadot/dev/scripts/util.mjs'; -// @ts-ignore +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Using ignore since the file won't be there in dev import { createWsEndpoints } from '../packages/apps-config/build/endpoints/index.js'; console.log('$ scripts/ipfsUpload.mjs', process.argv.slice(2).join(' ')); diff --git a/scripts/robohash.cjs b/scripts/robohash.cjs index 425c4573fd..5883f1e1b5 100755 --- a/scripts/robohash.cjs +++ b/scripts/robohash.cjs @@ -12,15 +12,23 @@ const HEADER = `// Copyright 2017-2023 @polkadot/react-components authors & cont /* eslint-disable simple-import-sort/imports */`; const PATH = 'packages/react-components/src/IdentityIcon/RoboHash'; +/** + * @param {number} index + * @returns {string} + */ function getCounter (index) { return `000${index}`.slice(-3); } +/** + * @param {string} dir + * @returns {string[]} + */ function getFiles (dir) { const genpath = path.join(dir, 'generated'); if (!fs.existsSync(genpath)) { - fs.mkdirSync(genpath, { force: true }); + fs.mkdirSync(genpath, { recursive: true }); } const all = fs @@ -51,7 +59,7 @@ function getFiles (dir) { : 0 ); - for (let f of all) { + for (const f of all) { if (f.endsWith('.png')) { fs.writeFileSync(path.join(dir, `generated/${f}`).replace('.png', '.ts'), `${HEADER}\n\nexport default 'data:image/png;base64,${fs.readFileSync(path.join(dir, f)).toString('base64')}';\n`); } @@ -62,6 +70,7 @@ function getFiles (dir) { function extractBg () { const root = path.join(__dirname, '..', PATH, 'backgrounds'); + /** @type {string[]} */ const files = []; getFiles(root).forEach((sub) => { @@ -79,6 +88,7 @@ function extractSets () { ) ); + /** @type {string[]} */ const imports = []; let list = '['; diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 603d07ea6f..61c8b906a6 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -4,6 +4,17 @@ "baseUrl": "./packages", "composite": false }, + "include": [ + "packages/**/public/env-config.js", + "packages/**/src/**/*", + "packages/**/scripts/**/*", + "packages/**/test/**/*", + "packages/**/webpack.*.cjs", + "scripts/*", + ".prettierrc.cjs", + "eslint.config.js", + "i18next-scanner.config.cjs" + ], "exclude": [ "build/**/*", "**/build/**/*", diff --git a/tsconfig.json b/tsconfig.json index e163655f26..c0bea037b1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,8 @@ "verbatimModuleSyntax": false }, "include": [ - "packages/**/src/**/*" + "packages/**/src/**/*", + "scripts/*" ], "exclude": [ "**/node_modules/**/*" diff --git a/yarn.lock b/yarn.lock index b66eebab2c..02efe337fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -390,10 +390,10 @@ __metadata: languageName: node linkType: hard -"@eslint/js@npm:8.40.0, @eslint/js@npm:^8.40.0": - version: 8.40.0 - resolution: "@eslint/js@npm:8.40.0" - checksum: e84936b8ebd1c8fd90e860182e95d1404006da4cbca722b14950b298aeeca102b080aa9b62c8e69f90824ec54e19f1ba79b239046223624d1414ee82e8e628ac +"@eslint/js@npm:8.41.0, @eslint/js@npm:^8.41.0": + version: 8.41.0 + resolution: "@eslint/js@npm:8.41.0" + checksum: af013d70fe8d0429cdf5cd8b5dcc6fc384ed026c1eccb0cfe30f5849b968ab91645111373fd1b83282b38955b1bdfbe667c1a7dbda3b06cae753521223cad775 languageName: node linkType: hard @@ -1865,7 +1865,7 @@ __metadata: version: 0.0.0-use.local resolution: "@polkadot/apps-electron@workspace:packages/apps-electron" dependencies: - "@polkadot/dev": ^0.74.1 + "@polkadot/dev": ^0.75.2 "@polkadot/react-components": ^0.130.2-15-x "@types/tmp": ^0.2.3 copy-webpack-plugin: ^11.0.0 @@ -1897,7 +1897,7 @@ __metadata: dependencies: "@polkadot/apps-config": ^0.130.2-15-x "@polkadot/apps-routing": ^0.130.2-15-x - "@polkadot/dev": ^0.74.1 + "@polkadot/dev": ^0.75.2 "@polkadot/react-api": ^0.130.2-15-x "@polkadot/react-components": ^0.130.2-15-x "@polkadot/react-hooks": ^0.130.2-15-x @@ -1931,34 +1931,34 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/dev-test@npm:^0.74.1": - version: 0.74.1 - resolution: "@polkadot/dev-test@npm:0.74.1" +"@polkadot/dev-test@npm:^0.75.2": + version: 0.75.2 + resolution: "@polkadot/dev-test@npm:0.75.2" dependencies: jsdom: ^22.0.0 - tslib: ^2.5.1 - checksum: b7b532bb068ae4616ac1359c5ba63c3d9ff28936d23281eb9d316ca9efa81e4b10672336b66ad2314de2dccea04877632aa56f6e725d8c8e41522f0eb09dcd40 + tslib: ^2.5.2 + checksum: e20e2488f138c9691daf3e8f6787c922e94374a3242a854ce48fe29b49c6b4bd7fbc1b244f205060652927670caf2577fad56883bb6dbbc143e1499bfddd2641 languageName: node linkType: hard -"@polkadot/dev-ts@npm:^0.74.1": - version: 0.74.1 - resolution: "@polkadot/dev-ts@npm:0.74.1" +"@polkadot/dev-ts@npm:^0.75.2": + version: 0.75.2 + resolution: "@polkadot/dev-ts@npm:0.75.2" dependencies: json5: ^2.2.3 - tslib: ^2.5.1 + tslib: ^2.5.2 typescript: ^5.0.4 - checksum: 6e1c21dc15cf958033ce59c577474c24f0bad61210cd9fa0eed821ba222e736a4c7688e367b9cba1f42c848884182682732fbc333330cbd6a2b5bc5acf09e915 + checksum: cd01aaca014ccb0ea064511ae52c7dd6ebd7115e64cb9f15bebfc8d6295cf9fd5ffdb2fc78e7cb5e46a346e6a2f513c6fec4cf5dc9a9626577547ef68f33cac7 languageName: node linkType: hard -"@polkadot/dev@npm:^0.74.1": - version: 0.74.1 - resolution: "@polkadot/dev@npm:0.74.1" +"@polkadot/dev@npm:^0.75.2": + version: 0.75.2 + resolution: "@polkadot/dev@npm:0.75.2" dependencies: - "@eslint/js": ^8.40.0 - "@polkadot/dev-test": ^0.74.1 - "@polkadot/dev-ts": ^0.74.1 + "@eslint/js": ^8.41.0 + "@polkadot/dev-test": ^0.75.2 + "@polkadot/dev-ts": ^0.75.2 "@rollup/plugin-alias": ^5.0.0 "@rollup/plugin-commonjs": ^25.0.0 "@rollup/plugin-dynamic-import-vars": ^2.0.3 @@ -1969,7 +1969,7 @@ __metadata: "@tsconfig/strictest": ^2.0.1 "@typescript-eslint/eslint-plugin": ^5.59.6 "@typescript-eslint/parser": ^5.59.6 - eslint: ^8.40.0 + eslint: ^8.41.0 eslint-config-standard: ^17.0.0 eslint-import-resolver-node: ^0.3.7 eslint-plugin-deprecation: ^1.4.1 @@ -1985,6 +1985,7 @@ __metadata: eslint-plugin-sort-destructure-keys: ^1.5.0 gh-pages: ^5.0.0 gh-release: ^7.0.2 + globals: ^13.20.0 json5: ^2.2.3 madge: ^6.0.0 react: ^18.2.0 @@ -1993,7 +1994,7 @@ __metadata: rollup: ^3.22.0 rollup-plugin-cleanup: ^3.2.1 styled-components: ^5.3.10 - tslib: ^2.5.1 + tslib: ^2.5.2 typescript: ^5.0.4 webpack: ^5.83.1 webpack-cli: ^5.1.1 @@ -2025,7 +2026,7 @@ __metadata: polkadot-exec-rollup: scripts/polkadot-exec-rollup.mjs polkadot-exec-tsc: scripts/polkadot-exec-tsc.mjs polkadot-exec-webpack: scripts/polkadot-exec-webpack.mjs - checksum: 89c8cd6ae49c509a24b4daf280f03da555d06c21758d40dcaac22fe95bdf221fd12370e7bd60c7872659e01ec549e0c017902362a1813bf116821e1abf155f6f + checksum: 389694c7080aae84f36362991c77059422f80ab647dec11ce28a3bb7cc2d9809c789336780a63b28296795359585d36c1172ed6f37fbe294f7bd973ba755557c languageName: node linkType: hard @@ -8172,14 +8173,14 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.40.0": - version: 8.40.0 - resolution: "eslint@npm:8.40.0" +"eslint@npm:^8.41.0": + version: 8.41.0 + resolution: "eslint@npm:8.41.0" dependencies: "@eslint-community/eslint-utils": ^4.2.0 "@eslint-community/regexpp": ^4.4.0 "@eslint/eslintrc": ^2.0.3 - "@eslint/js": 8.40.0 + "@eslint/js": 8.41.0 "@humanwhocodes/config-array": ^0.11.8 "@humanwhocodes/module-importer": ^1.0.1 "@nodelib/fs.walk": ^1.2.8 @@ -8199,13 +8200,12 @@ __metadata: find-up: ^5.0.0 glob-parent: ^6.0.2 globals: ^13.19.0 - grapheme-splitter: ^1.0.4 + graphemer: ^1.4.0 ignore: ^5.2.0 import-fresh: ^3.0.0 imurmurhash: ^0.1.4 is-glob: ^4.0.0 is-path-inside: ^3.0.3 - js-sdsl: ^4.1.4 js-yaml: ^4.1.0 json-stable-stringify-without-jsonify: ^1.0.1 levn: ^0.4.1 @@ -8218,7 +8218,7 @@ __metadata: text-table: ^0.2.0 bin: eslint: bin/eslint.js - checksum: b79eba37f52f517a420eec99a80ae9f284d2cbe73afc0d4d3d4d5ed1cce0b06f21badc0374bfb7ac239efd2d49a1fd7c6111d6c3d52888521f377ba33de77e61 + checksum: 09979a6f8451dcc508a7005b6670845c8a518376280b3fd96657a406b8b6ef29d0e480d1ba11b4eb48da93d607e0c55c9b877676fe089d09973ec152354e23b2 languageName: node linkType: hard @@ -9479,12 +9479,12 @@ fsevents@~2.3.2: languageName: node linkType: hard -"globals@npm:^13.19.0": - version: 13.19.0 - resolution: "globals@npm:13.19.0" +"globals@npm:^13.19.0, globals@npm:^13.20.0": + version: 13.20.0 + resolution: "globals@npm:13.20.0" dependencies: type-fest: ^0.20.2 - checksum: a000dbd00bcf28f0941d8a29c3522b1c3b8e4bfe4e60e262c477a550c3cbbe8dbe2925a6905f037acd40f9a93c039242e1f7079c76b0fd184bc41dcc3b5c8e2e + checksum: ad1ecf914bd051325faad281d02ea2c0b1df5d01bd94d368dcc5513340eac41d14b3c61af325768e3c7f8d44576e72780ec0b6f2d366121f8eec6e03c3a3b97a languageName: node linkType: hard @@ -9659,6 +9659,13 @@ fsevents@~2.3.2: languageName: node linkType: hard +"graphemer@npm:^1.4.0": + version: 1.4.0 + resolution: "graphemer@npm:1.4.0" + checksum: bab8f0be9b568857c7bec9fda95a89f87b783546d02951c40c33f84d05bb7da3fd10f863a9beb901463669b6583173a8c8cc6d6b306ea2b9b9d5d3d943c3a673 + languageName: node + linkType: hard + "gud@npm:^1.0.0": version: 1.0.0 resolution: "gud@npm:1.0.0" @@ -11225,13 +11232,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"js-sdsl@npm:^4.1.4": - version: 4.1.4 - resolution: "js-sdsl@npm:4.1.4" - checksum: 1977cea4ab18e0e03e28bdf0371d8b443fad65ca0988e0faa216406faf6bb943714fe8f7cc7a5bfe5f35ba3d94ddae399f4d10200f547f2c3320688b0670d726 - languageName: node - linkType: hard - "js-sha3@npm:0.8.0, js-sha3@npm:^0.8.0": version: 0.8.0 resolution: "js-sha3@npm:0.8.0" @@ -13731,7 +13731,7 @@ fsevents@~2.3.2: dependencies: "@crustio/crust-pin": ^1.0.0 "@pinata/sdk": ^1.2.1 - "@polkadot/dev": ^0.74.1 + "@polkadot/dev": ^0.75.2 "@types/chart.js": ^2.9.37 "@types/file-saver": ^2.0.5 "@types/react-beautiful-dnd": ^13.1.4 @@ -16875,7 +16875,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.3.1, tslib@npm:^2.4.0, tslib@npm:^2.5.0, tslib@npm:^2.5.1": +"tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.3.1, tslib@npm:^2.4.0, tslib@npm:^2.5.0, tslib@npm:^2.5.2": version: 2.5.2 resolution: "tslib@npm:2.5.2" checksum: 4d3c1e238b94127ed0e88aa0380db3c2ddae581dc0f4bae5a982345e9f50ee5eda90835b8bfba99b02df10a5734470be197158c36f9129ac49fdc14a6a9da222