Bump dev (w/ eslint config updates) (#9472)

This commit is contained in:
Jaco 2023-05-21 09:04:36 +03:00 committed by GitHub
parent a93388466b
commit e0e2605564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 327 additions and 184 deletions

View File

@ -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'
}
};

4
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"eslint.enable": true,
"eslint.experimental.useFlatConfig": true
}

16
eslint.config.js Normal file
View File

@ -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'
}
}
];

View File

@ -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",

View File

@ -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);

View File

@ -93,7 +93,7 @@ describe('urls are not duplicated', (): void => {
}, {} as Record<string, string[]>);
for (const [url, paths] of Object.entries<string[]>(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<Endpoint>(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`);

View File

@ -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 {

View File

@ -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;

View File

@ -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",

View File

@ -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);
});
});
});

View File

@ -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';

View File

@ -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",

View File

@ -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/,

View File

@ -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;

View File

@ -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();

View File

@ -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<Match>({ isMatchValid: true, match: DEFAULT_MATCH });
const [{ isMatchValid, match }, setMatch] = useState<MatchState>({ isMatchValid: true, match: DEFAULT_MATCH });
const [type, setType] = useState<KeypairType>('ed25519');
const [withCase, setWithCase] = useState(true);

View File

@ -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({

View File

@ -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<SubmittableExtrinsic<'promise'>[]>([]);
const [batchAdded, setBatchAdded] = useState<SubmittableExtrinsic<'promise'>[]>([]);
const [txs, setTxs] = useState<SubmittableExtrinsic<'promise'>[] | null>(null);
const [previous, setPrevious] = useState<PrevProxy[]>(() => existing.map(({ delegate, proxyType }) => [delegate, proxyType]));
const [added, setAdded] = useState<PrevProxy[]>([]);
const [previous, setPrevious] = useState<PrevProxyProp[]>(() => existing.map(({ delegate, proxyType }) => [delegate, proxyType]));
const [added, setAdded] = useState<PrevProxyProp[]>([]);
const extrinsics = useTxBatch(txs, BATCH_OPTS);
const reservedAmount = useMemo(

View File

@ -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';

View File

@ -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';

View File

@ -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();

View File

@ -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';

View File

@ -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;

View File

@ -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();

View File

@ -3,6 +3,8 @@
/// <reference types="@polkadot/dev-test/globals.d.ts" />
/* 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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -104,10 +104,6 @@ describe('curveThreshold', (): void => {
).toEqual('499999999');
});
});
// describe('Stepped', (): void => {
// });
});
describe('curveDelay', (): void => {

View File

@ -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<string, [number, number, number]>];
type ProgressType = [[number, number, number], Record<string, [number, number, number]>];
type Strings = Record<string, string>;
type StringsMod = Record<string, Strings>;
@ -94,7 +94,7 @@ async function retrieveAll (): Promise<Defaults> {
};
}
function calcProgress (english: StringsMod, language: Strings): Progress {
function calcProgress (english: StringsMod, language: Strings): ProgressType {
const breakdown: Record<string, [number, number, number]> = {};
let done = 0;
let total = 0;
@ -150,7 +150,7 @@ function Translate ({ className }: Props): React.ReactElement<Props> {
const [withEmpty, toggleWithEmpty] = useToggle();
const [{ english, keys, modules }, setDefaults] = useState<Defaults>({ english: {}, keys: [], modules: [] });
const [lng, setLng] = useState<string>('zh');
const [[modProgress, allProgress], setProgress] = useState<Progress>([[0, 0, 0], {}]);
const [[modProgress, allProgress], setProgress] = useState<ProgressType>([[0, 0, 0], {}]);
const [record, setRecord] = useState<string>('app-accounts.json');
const [strings, setStrings] = useState<Strings | null>(null);
@ -187,7 +187,7 @@ function Translate ({ className }: Props): React.ReactElement<Props> {
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];

View File

@ -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<PalletTipsOpenTip>[]], inHashes?: string[] | null): Tip[] | undefined {
function extractTips (tipsWithHashes?: [[string[]], Option<PalletTipsOpenTip>[]], inHashes?: string[] | null): TipType[] | undefined {
if (!tipsWithHashes || !inHashes) {
return undefined;
}

View File

@ -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`

View File

@ -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';

View File

@ -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';

View File

@ -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');

View File

@ -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<void>;

View File

@ -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();

View File

@ -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();

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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 <T> {
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;

View File

@ -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';

View File

@ -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<HTMLDivElement>[], e: MouseEvent):
);
}
function useOutsideClickImpl (refs: RefObject<HTMLDivElement>[], callback: () => void): void {
function useOutsideClickImpl (refs: React.RefObject<HTMLDivElement>[], callback: () => void): void {
const handleClick = useCallback(
(e: MouseEvent): void => {
if (refs.length && !isRefClicked(refs, e)) {

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -62,6 +62,7 @@ function useWeightImpl (call?: Call | null): Result {
const { api } = useApi();
const mountedRef = useIsMountedRef();
const [state, setState] = useState<Result>(() => objectSpread({
// eslint-disable-next-line @typescript-eslint/unbound-method
isWeightV2: !isFunction(api.registry.createType<V1Weight>('Weight').toBn)
}, EMPTY_STATE));

View File

@ -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;
}

View File

@ -9,7 +9,7 @@ import Bare from './Bare.js';
interface Props {
className?: string;
defaultValue?: any;
defaultValue?: unknown;
isDisabled?: boolean;
isError?: boolean;
label?: React.ReactNode;

View File

@ -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(),

View File

@ -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<any>;
t: string[];
}

View File

@ -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';

View File

@ -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>', '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

View File

@ -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';

View File

@ -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 {

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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<any> | null => {
const api = useApi();

View File

@ -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<string, unknown>)[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<string, unknown>)[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<string, unknown>)[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<string, unknown>)[key] = value;
});
this.accountsMap[address] = {

View File

@ -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<void> => {

View File

@ -4,9 +4,14 @@
const fs = require('node:fs');
const path = require('node:path');
/** @type {Record<string, string[]>} */
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}`);

View File

@ -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,15 +24,22 @@ function getEntries (langRoot) {
.sort();
}
/**
* @param {string} lang
*/
function sortLanguage (lang) {
const langRoot = path.join(i18nRoot, lang);
const entries = getEntries(langRoot);
/** @type {Record<String, boolean>} */
const hasKeys = {};
entries.forEach((entry) => {
const filename = path.join(langRoot, entry);
const json = require(filename);
const sorted = Object.keys(json).sort().reduce((result, key) => {
const sorted = Object
.keys(json)
.sort()
.reduce((/** @type {Record<String, string>} */ result, key) => {
result[key] = json[key];
return result;

View File

@ -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<string, string>} */
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<string, string>} */
const all = {};
/** @type {Record<string, number>} */
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<string, string>} */
const result = {};
if (fs.existsSync(generated)) {
fs.rmSync(generated, { recursive: true, force: true });
fs.rmSync(generated, { force: true, recursive: true });
}
fs.mkdirSync(generated);
@ -70,7 +79,7 @@ for (let dir of ['extensions', 'external', 'chains', 'nodes']) {
if (Object.keys(result).length) {
let srcs = '';
for (let dir of ['endpoints', 'extensions', 'links']) {
for (const dir of ['endpoints', 'extensions', 'links']) {
const srcroot = path.join('packages/apps-config/src', dir);
fs
@ -103,6 +112,7 @@ for (let dir of ['extensions', 'external', 'chains', 'nodes']) {
}
const allKeys = Object.keys(all);
/** @type {Record<string, string[]>} */
const dupes = {};
allKeys.forEach((a) => {
@ -121,7 +131,7 @@ if (Object.keys(dupes).length) {
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();

View File

@ -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(' '));

View File

@ -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 = '[';

View File

@ -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/**/*",

View File

@ -13,7 +13,8 @@
"verbatimModuleSyntax": false
},
"include": [
"packages/**/src/**/*"
"packages/**/src/**/*",
"scripts/*"
],
"exclude": [
"**/node_modules/**/*"

View File

@ -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