mirror of
https://github.com/pezkuwichain/pezkuwi-extension.git
synced 2026-12-03 10:57:09 +00:00
Move to @pezkuwi/dev 0.86 (eslint 10 toolchain)
- @pezkuwi/dev, dev-test, dev-ts ^0.86.3 in the root and in every workspace package (they still asked for 0.84.3) - tsconfig.base target ES2022, the @pezkuwi/dev default; it carries the ErrorOptions type for `cause` - rethrown errors carry the original as `cause`; rejections are normalised to Error - page/messaging: the typed subscriber is called directly, not as `Function` - chrome mock: constant results through Promise.resolve - useLedger: drop a construction every branch below repeated - InputWithLabel: onKeyDown instead of the deprecated onKeyPress - Account: toggleActions + 1 instead of a pre-increment of a parameter - optional chains where a guard tested the same value - specs: mount<React.Component> so the wrappers are not `any`-typed - AccountsStore.set keeps its async override of KeyringStore.set: BaseStore.set handles its own failure, so it never rejects - extension-chains keeps its ChainProperties assertion: the package's own build does not load the type augmentation - the existing React Compiler findings (37, react-hooks rules only) are recorded in eslint-suppressions.json; a new one fails lint
This commit is contained in:
1 parent
0321454dc7
commit
9d769676e4
58 files changed
+2795
-3355
No files matched your search
@@ -25,7 +25,7 @@ const { configure, mount } = enzyme;
|
||||
// ...jest.requireActual('../../messaging')
|
||||
// }));
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
jest.spyOn(messaging, 'getAllMetadata').mockImplementation(() => Promise.resolve([]));
|
||||
|
||||
@@ -45,7 +45,7 @@ function Account ({ address, className, genesisHash, isExternal, isHardware, isH
|
||||
? selectedAccounts.filter((account) => account !== address)
|
||||
: [...selectedAccounts, address];
|
||||
|
||||
setSelectedAccounts && setSelectedAccounts(newList);
|
||||
setSelectedAccounts?.(newList);
|
||||
}, [address, selectedAccounts, setSelectedAccounts]);
|
||||
|
||||
const _onChangeGenesis = useCallback(
|
||||
@@ -57,7 +57,7 @@ function Account ({ address, className, genesisHash, isExternal, isHardware, isH
|
||||
);
|
||||
|
||||
const _toggleEdit = useCallback(
|
||||
(): void => setEditing(({ toggleActions }) => ({ isEditing: !isEditing, toggleActions: ++toggleActions })),
|
||||
(): void => setEditing(({ toggleActions }) => ({ isEditing: !isEditing, toggleActions: toggleActions + 1 })),
|
||||
[isEditing]
|
||||
);
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// We _could_ reformat, but just keep it as-is, since this is actually
|
||||
// externally generated and not really user-editable
|
||||
|
||||
/* eslint-disable react/jsx-sort-props */
|
||||
/* eslint-disable react/jsx-max-props-per-line */
|
||||
/* eslint-disable @stylistic/jsx-sort-props */
|
||||
/* eslint-disable @stylistic/jsx-max-props-per-line */
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ interface Props {
|
||||
}
|
||||
|
||||
function AccountManagement ({ className }: Props): React.ReactElement<Props> {
|
||||
const { url } = useParams<{url: string}>();
|
||||
const { url } = useParams<{ url: string }>();
|
||||
const decodedUrl = decodeURIComponent(url);
|
||||
const { selectedAccounts = [], setSelectedAccounts } = useContext(AccountContext);
|
||||
const { t } = useTranslation();
|
||||
@@ -28,7 +28,7 @@ function AccountManagement ({ className }: Props): React.ReactElement<Props> {
|
||||
return;
|
||||
}
|
||||
|
||||
setSelectedAccounts && setSelectedAccounts(list[decodedUrl].authorizedAccounts);
|
||||
setSelectedAccounts?.(list[decodedUrl].authorizedAccounts);
|
||||
})
|
||||
.catch(console.error);
|
||||
}, [setSelectedAccounts, decodedUrl]);
|
||||
|
||||
@@ -20,7 +20,7 @@ import Request from './Request.js';
|
||||
|
||||
const { configure, mount } = enzyme;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
const oneRequest = [{ id: '1', request: { origin: '???' }, url: 'http://pezkuwichain.io' }];
|
||||
|
||||
@@ -30,7 +30,7 @@ function Request ({ authId, className, request: { origin }, url }: Props): React
|
||||
.filter(({ isDefaultAuthSelected }) => !!isDefaultAuthSelected)
|
||||
.map(({ address }) => address);
|
||||
|
||||
setSelectedAccounts && setSelectedAccounts(defaultAccountSelection);
|
||||
setSelectedAccounts?.(defaultAccountSelection);
|
||||
}, [accounts, setSelectedAccounts]);
|
||||
|
||||
const _onApprove = useCallback(
|
||||
|
||||
@@ -29,7 +29,7 @@ const { configure, mount } = enzyme;
|
||||
// For this file, there are a lot of them
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
describe('Create Account', () => {
|
||||
|
||||
@@ -38,12 +38,11 @@ function CreateAccount ({ className }: Props): React.ReactElement {
|
||||
setSeed(seed);
|
||||
})
|
||||
.catch(console.error);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
useEffect((): void => {
|
||||
if (seed) {
|
||||
const type = chain && chain.definition.chainType === 'ethereum'
|
||||
const type = chain?.definition.chainType === 'ethereum'
|
||||
? 'ethereum'
|
||||
: DEFAULT_TYPE;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import '@pezkuwi/extension-mocks/chrome';
|
||||
|
||||
import type { ReactWrapper } from 'enzyme';
|
||||
import type * as _ from '@pezkuwi/dev-test/globals.d.ts';
|
||||
import type { AccountJson, ResponseDeriveValidate } from '@pezkuwi/extension-base/background/types';
|
||||
import type { AccountJson } from '@pezkuwi/extension-base/background/types';
|
||||
|
||||
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
||||
import enzyme from 'enzyme';
|
||||
@@ -32,7 +32,7 @@ const { configure, mount } = enzyme;
|
||||
// For this file, there are a lot of them
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
const parentPassword = 'pass';
|
||||
@@ -57,7 +57,7 @@ describe('Derive', () => {
|
||||
}> => {
|
||||
const onActionStub = jest.fn();
|
||||
|
||||
const wrapper = mount(
|
||||
const wrapper = mount<React.Component>(
|
||||
<MemoryRouter initialEntries={ [`/account/derive/${accounts[account].address}`] }>
|
||||
<ActionContext.Provider value={onActionStub}>
|
||||
<AccountContext.Provider
|
||||
@@ -110,7 +110,7 @@ describe('Derive', () => {
|
||||
throw new Error('wrong suri');
|
||||
}
|
||||
|
||||
return { address: derivedAddress, suri: defaultDerivation } as ResponseDeriveValidate;
|
||||
return { address: derivedAddress, suri: defaultDerivation };
|
||||
});
|
||||
|
||||
it('Button is disabled and password field visible, path field is hidden', () => {
|
||||
@@ -216,7 +216,7 @@ describe('Derive', () => {
|
||||
|
||||
expect(button.prop('disabled')).toBe(true);
|
||||
expect(wrapper.find('.warning-message')).toHaveLength(1);
|
||||
// eslint-disable-next-line quotes
|
||||
// eslint-disable-next-line @stylistic/quotes
|
||||
expect(wrapper.find('.warning-message').first().text()).toEqual("`///password` not supported for derivation");
|
||||
});
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ const { configure, mount } = enzyme;
|
||||
// ...jest.requireActual('../messaging')
|
||||
// }));
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
describe('Export component', () => {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { styled } from '../styled.js';
|
||||
|
||||
const MIN_LENGTH = 6;
|
||||
|
||||
interface Props extends RouteComponentProps<{address: string}> {
|
||||
interface Props extends RouteComponentProps<{ address: string }> {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ function Export ({ className, match: { params: { address } } }: Props): React.Re
|
||||
(password: string) => {
|
||||
setPass(password);
|
||||
setError('');
|
||||
}
|
||||
, []);
|
||||
},
|
||||
[]);
|
||||
|
||||
const _onExportButtonClick = useCallback(
|
||||
(): void => {
|
||||
@@ -46,7 +46,7 @@ function Export ({ className, match: { params: { address } } }: Props): React.Re
|
||||
.then(({ exportedJson }) => {
|
||||
const blob = new Blob([JSON.stringify(exportedJson)], { type: 'application/json; charset=utf-8' });
|
||||
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
fileSaver.saveAs(blob, `${address}.json`);
|
||||
|
||||
onAction('/');
|
||||
|
||||
@@ -36,8 +36,8 @@ function ExportAll ({ className }: Props): React.ReactElement<Props> {
|
||||
(password: string) => {
|
||||
setPass(password);
|
||||
setError('');
|
||||
}
|
||||
, []);
|
||||
},
|
||||
[]);
|
||||
|
||||
const _onExportAllButtonClick = useCallback(
|
||||
(): void => {
|
||||
@@ -47,7 +47,7 @@ function ExportAll ({ className }: Props): React.ReactElement<Props> {
|
||||
.then(({ exportedJson }) => {
|
||||
const blob = new Blob([JSON.stringify(exportedJson)], { type: 'application/json; charset=utf-8' });
|
||||
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
fileSaver.saveAs(blob, `batch_exported_account_${Date.now()}.json`);
|
||||
|
||||
onAction('/');
|
||||
|
||||
@@ -49,7 +49,7 @@ interface QrScanAddressProps {
|
||||
// ...jest.requireActual('../messaging')
|
||||
// }));
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
const typeName = async (wrapper: ReactWrapper, value: string) => {
|
||||
@@ -77,7 +77,6 @@ describe('ImportQr component', () => {
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
act(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
(wrapper.find('QrScanAddress').first().prop('onScan') as unknown as QrScanAddressProps['onScan'])(mockedAccount);
|
||||
|
||||
@@ -38,7 +38,7 @@ const account = {
|
||||
// For this file, there are a lot of them
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
jest.spyOn(messaging, 'getAllMetadata').mockImplementation(() => Promise.resolve([]));
|
||||
|
||||
@@ -36,7 +36,7 @@ function ImportSeed (): React.ReactElement {
|
||||
|
||||
useEffect((): void => {
|
||||
setType(
|
||||
chain && chain.definition.chainType === 'ethereum'
|
||||
chain?.definition.chainType === 'ethereum'
|
||||
? 'ethereum'
|
||||
: DEFAULT_TYPE
|
||||
);
|
||||
|
||||
@@ -120,7 +120,7 @@ function Extrinsic ({ className, payload, request: { blockNumber, genesisHash, m
|
||||
const chain = useMetadata(genesisHash);
|
||||
const specVersion = useRef(bnToBn(hexSpec)).current;
|
||||
const decoded = useMemo(
|
||||
() => chain && chain.hasMetadata
|
||||
() => chain?.hasMetadata
|
||||
? decodeMethod(method, chain, specVersion)
|
||||
: { args: null, method: null },
|
||||
[method, chain, specVersion]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2019-2026 @pezkuwi/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable deprecation/deprecation */
|
||||
/* eslint-disable @typescript-eslint/no-deprecated */
|
||||
|
||||
import type { Chain } from '@pezkuwi/extension-chains/types';
|
||||
import type { Ledger, LedgerGeneric } from '@pezkuwi/hw-ledger';
|
||||
|
||||
@@ -41,7 +41,7 @@ const { configure, mount } = enzyme;
|
||||
// For this file, there are a lot of them
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
describe('Signing requests', () => {
|
||||
@@ -345,7 +345,6 @@ describe('Signing requests', () => {
|
||||
wrapper.find('FontAwesomeIcon.arrowRight').simulate('click');
|
||||
await act(flushAllPromises);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
act(() => {
|
||||
emitter.emit('request', [signRequests[0]]);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user