Bump dev (w/ jsx linting) (#799)

This commit is contained in:
Jaco
2021-08-26 10:38:54 +02:00
committed by GitHub
parent 9eba6d7782
commit cf072c459b
23 changed files with 610 additions and 477 deletions
+8 -8
View File
@@ -8,13 +8,13 @@
"packages/*"
],
"resolutions": {
"@polkadot/api": "^5.5.1",
"@polkadot/keyring": "^7.2.1",
"@polkadot/networks": "^7.2.1",
"@polkadot/types": "^5.5.1",
"@polkadot/util": "^7.2.1",
"@polkadot/util-crypto": "^7.2.1",
"@polkadot/x-fetch": "^7.2.1",
"@polkadot/api": "^5.6.2-6",
"@polkadot/keyring": "^7.2.2-5",
"@polkadot/networks": "^7.2.2-5",
"@polkadot/types": "^5.6.2-6",
"@polkadot/util": "^7.2.2-5",
"@polkadot/util-crypto": "^7.2.2-5",
"@polkadot/x-fetch": "^7.2.2-5",
"babel-core": "^7.0.0-bridge.0",
"safe-buffer": "^5.2.1",
"typescript": "^4.3.5",
@@ -41,7 +41,7 @@
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@polkadot/dev": "^0.62.60",
"@polkadot/dev": "^0.62.62",
"@types/jest": "^27.0.1",
"i18next-scanner": "^3.0.0",
"sinon-chrome": "^3.0.1",
+4 -4
View File
@@ -9,11 +9,11 @@
"sideEffects": false,
"dependencies": {
"@babel/runtime": "^7.15.3",
"@polkadot/api": "^5.5.1",
"@polkadot/api": "^5.6.2-6",
"@polkadot/extension-dapp": "^0.39.4-3",
"@polkadot/extension-inject": "^0.39.4-3",
"@polkadot/keyring": "^7.2.1",
"@polkadot/phishing": "^0.6.260",
"@polkadot/ui-keyring": "^0.85.1"
"@polkadot/keyring": "^7.2.2-5",
"@polkadot/phishing": "^0.6.270",
"@polkadot/ui-keyring": "^0.85.2-0"
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
"sideEffects": false,
"dependencies": {
"@babel/runtime": "^7.15.3",
"@polkadot/networks": "^7.2.1"
"@polkadot/networks": "^7.2.2-5"
},
"peerDependencies": {
"@polkadot/api": "*"
+3 -3
View File
@@ -11,9 +11,9 @@
"@babel/runtime": "^7.15.3",
"@metamask/detect-provider": "^1.2.0",
"@polkadot/extension-inject": "^0.39.4-3",
"@polkadot/util": "^7.2.1",
"@polkadot/util-crypto": "^7.2.1",
"web3": "^1.3.0"
"@polkadot/util": "^7.2.2-5",
"@polkadot/util-crypto": "^7.2.2-5",
"web3": "^1.5.2"
},
"peerDependencies": {
"@polkadot/api": "*",
+9 -9
View File
@@ -15,13 +15,13 @@
"@polkadot/extension-base": "^0.39.4-3",
"@polkadot/extension-dapp": "^0.39.4-3",
"@polkadot/extension-inject": "^0.39.4-3",
"@polkadot/hw-ledger": "^7.2.1",
"@polkadot/keyring": "^7.2.1",
"@polkadot/networks": "^7.2.1",
"@polkadot/react-identicon": "^0.85.1",
"@polkadot/react-qr": "^0.85.1",
"@polkadot/util": "^7.2.1",
"@polkadot/util-crypto": "^7.2.1",
"@polkadot/hw-ledger": "^7.2.2-5",
"@polkadot/keyring": "^7.2.2-5",
"@polkadot/networks": "^7.2.2-5",
"@polkadot/react-identicon": "^0.85.2-0",
"@polkadot/react-qr": "^0.85.2-0",
"@polkadot/util": "^7.2.2-5",
"@polkadot/util-crypto": "^7.2.2-5",
"file-saver": "^2.0.5",
"i18next": "^20.4.0",
"react": "^17.0.2",
@@ -31,7 +31,7 @@
"react-is": "^17.0.2",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"styled-components": "^5.3.0"
"styled-components": "^5.3.1"
},
"devDependencies": {
"@types/bn.js": "^4.11.6",
@@ -43,7 +43,7 @@
"@types/react-router": "^5.1.16",
"@types/react-router-dom": "^5.1.8",
"@types/sinon-chrome": "^2.2.11",
"@types/styled-components": "^5.1.12",
"@types/styled-components": "^5.1.13",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
@@ -24,8 +24,14 @@ function AddAccountImage ({ className, onClick }: Props): React.ReactElement<Pro
<circle cx='132.5' cy='132.5' r='92' fill='white' fillOpacity='0.9' stroke='#E3E7ED' />
</mask>
<g mask='url(#mask0)'>
<circle cx='132.5' cy='132.5' r='92' strokeWidth='1px' fill='#1A1B20' stroke='#E3E7ED'
onClick={onClick} />
<circle
cx='132.5'
cy='132.5' r='92'
strokeWidth='1px'
fill='#1A1B20'
stroke='#E3E7ED'
onClick={onClick}
/>
<g filter='url(#filter0_f)'>
<circle cx='132.5' cy='73.1154' r='12.1154' fill='#FEE05F' />
<circle cx='132.5' cy='104.269' r='12.1154' fill='#F5836B' />
@@ -54,11 +60,14 @@ function AddAccountImage ({ className, onClick }: Props): React.ReactElement<Pro
</g>
<path
d='M145.768 133.776C146.323 133.776 146.792 133.968 147.176 134.352C147.603 134.736 147.816 135.205 147.816 135.76C147.816 136.315 147.624 136.805 147.24 137.232C146.856 137.616 146.365 137.808 145.768 137.808H134.184V149.328C134.184 149.925 133.992 150.416 133.608 150.8C133.224 151.184 132.755 151.376 132.2 151.376C131.645 151.376 131.176 151.184 130.792 150.8C130.408 150.373 130.216 149.883 130.216 149.328V137.808H118.632C118.077 137.808 117.587 137.616 117.16 137.232C116.776 136.805 116.584 136.315 116.584 135.76C116.584 135.205 116.776 134.736 117.16 134.352C117.587 133.968 118.077 133.776 118.632 133.776H130.216V122.256C130.216 121.659 130.408 121.168 130.792 120.784C131.176 120.357 131.645 120.144 132.2 120.144C132.755 120.144 133.224 120.357 133.608 120.784C133.992 121.168 134.184 121.659 134.184 122.256V133.776H145.768Z'
fill='#242529' onClick={onClick} />
fill='#242529' onClick={onClick}
/>
</g>
<defs>
<filter id='filter0_f' x='-3' y='-7' width='271' height='284.846' filterUnits='userSpaceOnUse'
colorInterpolationFilters='sRGB'>
<filter
id='filter0_f' x='-3' y='-7' width='271' height='284.846' filterUnits='userSpaceOnUse'
colorInterpolationFilters='sRGB'
>
<feFlood floodOpacity='0' result='BackgroundImageFix'/>
<feBlend mode='normal' in='SourceGraphic' in2='BackgroundImageFix' result='shape'/>
<feGaussianBlur stdDeviation='10' result='effect1_foregroundBlur'/>
@@ -60,7 +60,8 @@ function DerivationPath ({ className, defaultPath, isError, onChange, withSoftPa
</div>
<Button
className='lockButton'
onClick={_onExpand}>
onClick={_onExpand}
>
<FontAwesomeIcon
className='lockIcon'
icon={isDisabled ? faLock : faLockOpen}
@@ -47,10 +47,12 @@ describe('Derive', () => {
const wrapper = mount(
<MemoryRouter initialEntries={ [`/account/derive/${accounts[account].address}`] }>
<ActionContext.Provider value={onActionStub}>
<AccountContext.Provider value={{
accounts: accounts,
hierarchy: buildHierarchy(accounts)
}}>
<AccountContext.Provider
value={{
accounts: accounts,
hierarchy: buildHierarchy(accounts)
}}
>
<ThemeProvider theme={themes.dark}>
<Route path='/account/derive/:address'>
<Derive isLocked={locked}/>
+17 -11
View File
@@ -22,18 +22,24 @@ export default function ImportQr (): React.ReactElement {
const [account, setAccount] = useState<QrAccount | null>(null);
const [name, setName] = useState<string | null>(null);
const _setAccount = useCallback((qrAccount: QrAccount) => {
setAccount(qrAccount);
setName(qrAccount?.name || null);
}, []);
const _setAccount = useCallback(
(qrAccount: QrAccount) => {
setAccount(qrAccount);
setName(qrAccount?.name || null);
},
[]
);
const _onCreate = (): void => {
if (account && name) {
createAccountExternal(name, account.content, account.genesisHash)
.then(() => onAction('/'))
.catch((error: Error) => console.error(error));
}
};
const _onCreate = useCallback(
(): void => {
if (account && name) {
createAccountExternal(name, account.content, account.genesisHash)
.then(() => onAction('/'))
.catch((error: Error) => console.error(error));
}
},
[account, name, onAction]
);
return (
<>
@@ -60,18 +60,21 @@ function ImportSeed (): React.ReactElement {
/>
</div>
{step1
? <SeedAndPath
onAccountChange={setAccount}
onNextStep={_onNextStep}
/>
: <AccountNamePasswordCreation
buttonLabel={t<string>('Add the account with the supplied seed')}
isBusy={isBusy}
onBackClick={_onBackClick}
onCreate={_onCreate}
onNameChange={setName}
/>
? (
<SeedAndPath
onAccountChange={setAccount}
onNextStep={_onNextStep}
/>
)
: (
<AccountNamePasswordCreation
buttonLabel={t<string>('Add the account with the supplied seed')}
isBusy={isBusy}
onBackClick={_onBackClick}
onCreate={_onCreate}
onNameChange={setName}
/>
)
}
</>
);
@@ -151,10 +151,12 @@ export default function Request ({ account: { accountIndex, addressOffset, isExt
payload={data}
/>
)
: <Bytes
bytes={data}
url={url}
/>
: (
<Bytes
bytes={data}
url={url}
/>
)
}
<VerticalSpace />
<SignArea
@@ -5,7 +5,7 @@ import type { ThemeProps } from '../../types';
import { faArrowLeft, faArrowRight } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import React from 'react';
import React, { useCallback } from 'react';
import styled from 'styled-components';
interface Props {
@@ -20,6 +20,20 @@ function TransactionIndex ({ className, index, onNextClick, onPreviousClick, tot
const previousClickActive = index !== 0;
const nextClickActive = index < totalItems - 1;
const prevClick = useCallback(
(): void => {
previousClickActive && onPreviousClick();
},
[onPreviousClick, previousClickActive]
);
const nextClick = useCallback(
(): void => {
nextClickActive && onNextClick();
},
[nextClickActive, onNextClick]
);
return (
<div className={className}>
<div>
@@ -30,13 +44,13 @@ function TransactionIndex ({ className, index, onNextClick, onPreviousClick, tot
<FontAwesomeIcon
className={`arrowLeft ${previousClickActive ? 'active' : ''}`}
icon={faArrowLeft}
onClick={(): void => { previousClickActive && onPreviousClick(); }}
onClick={prevClick}
size='sm'
/>
<FontAwesomeIcon
className={`arrowRight ${nextClickActive ? 'active' : ''}`}
icon={faArrowRight}
onClick={(): void => { nextClickActive && onNextClick(); }}
onClick={nextClick}
size='sm'
/>
</div>
+8 -5
View File
@@ -3,7 +3,7 @@
import type { ThemeProps } from '../types';
import React, { useContext } from 'react';
import React, { useCallback, useContext } from 'react';
import styled from 'styled-components';
import { ActionContext, Box, Button, ButtonArea, List, VerticalSpace } from '../components';
@@ -18,10 +18,13 @@ const Welcome = function ({ className }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const onAction = useContext(ActionContext);
const _onClick = (): void => {
window.localStorage.setItem('welcome_read', 'ok');
onAction();
};
const _onClick = useCallback(
(): void => {
window.localStorage.setItem('welcome_read', 'ok');
onAction();
},
[onAction]
);
return (
<>
+11 -7
View File
@@ -4,7 +4,7 @@
import type { AccountJson, AccountsContext, AuthorizeRequest, MetadataRequest, SigningRequest } from '@polkadot/extension-base/background/types';
import type { SettingsStruct } from '@polkadot/ui-settings/types';
import React, { useEffect, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { Route, Switch } from 'react-router';
import { PHISHING_PAGE_REDIRECT } from '@polkadot/extension-base/defaults';
@@ -74,13 +74,16 @@ export default function Popup (): React.ReactElement {
const [isWelcomeDone, setWelcomeDone] = useState(false);
const [settingsCtx, setSettingsCtx] = useState<SettingsStruct>(startSettings);
const _onAction = (to?: string): void => {
setWelcomeDone(window.localStorage.getItem('welcome_read') === 'ok');
const _onAction = useCallback(
(to?: string): void => {
setWelcomeDone(window.localStorage.getItem('welcome_read') === 'ok');
if (to) {
window.location.hash = to;
}
};
if (to) {
window.location.hash = to;
}
},
[]
);
useEffect((): void => {
Promise.all([
@@ -96,6 +99,7 @@ export default function Popup (): React.ReactElement {
});
_onAction();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect((): void => {
@@ -106,10 +106,12 @@ const mountComponent = async (addressComponentProps: AddressComponentProps, cont
const { actions = actionStub } = addressComponentProps;
const wrapper = mount(
<AccountContext.Provider value={{
accounts: contextAccounts,
hierarchy: buildHierarchy(contextAccounts)
}}>
<AccountContext.Provider
value={{
accounts: contextAccounts,
hierarchy: buildHierarchy(contextAccounts)
}}
>
<Address
actions={actions}
{...addressComponentProps}
@@ -165,17 +165,21 @@ function Address ({ actions, address, children, className, genesisHash, isExtern
<>
{!!accountName && (account?.isExternal || isExternal) && (
(account?.isHardware || isHardware)
? <FontAwesomeIcon
className='hardwareIcon'
icon={faUsb}
rotation={270}
title={t('hardware wallet account')}
/>
: <FontAwesomeIcon
className='externalIcon'
icon={faQrcode}
title={t('external account')}
/>
? (
<FontAwesomeIcon
className='hardwareIcon'
icon={faUsb}
rotation={270}
title={t('hardware wallet account')}
/>
)
: (
<FontAwesomeIcon
className='externalIcon'
icon={faQrcode}
title={t('external account')}
/>
)
)}
<span title={displayName}>{displayName}</span>
</>);
+13 -10
View File
@@ -3,7 +3,7 @@
import type { ThemeProps } from '../types';
import React from 'react';
import React, { useCallback } from 'react';
import styled from 'styled-components';
import Spinner from './Spinner';
@@ -19,17 +19,20 @@ interface Props extends ThemeProps {
}
function Button ({ children, className = '', isBusy, isDisabled, onClick, to }: Props): React.ReactElement<Props> {
const _onClick = (): void => {
if (isBusy || isDisabled) {
return;
}
const _onClick = useCallback(
(): void => {
if (isBusy || isDisabled) {
return;
}
onClick && onClick();
onClick && onClick();
if (to) {
window.location.hash = to;
}
};
if (to) {
window.location.hash = to;
}
},
[isBusy, isDisabled, onClick, to]
);
return (
<button
@@ -3,7 +3,7 @@
import type { ThemeProps } from '../types';
import React from 'react';
import React, { useCallback } from 'react';
import styled from 'styled-components';
import arrow from '../assets/arrow-down.svg';
@@ -28,9 +28,11 @@ interface Props extends ThemeProps {
}
function Dropdown ({ className, defaultValue, isDisabled, isFocussed, label, onBlur, onChange, options, value }: Props): React.ReactElement<Props> {
const _onChange = ({ target: { value } }: React.ChangeEvent<HTMLSelectElement>): void => {
onChange && onChange(value.trim());
};
const _onChange = useCallback(
({ target: { value } }: React.ChangeEvent<HTMLSelectElement>) =>
onChange && onChange(value.trim()),
[onChange]
);
return (
<>
@@ -22,7 +22,8 @@ function Link ({ children, className = '', isDisabled, onClick, title, to }: Pro
return (
<div
className={`${className} isDisabled`}
title={title}>
title={title}
>
{children}
</div>
);
+10 -6
View File
@@ -3,7 +3,7 @@
import type { ThemeProps } from '../types';
import React, { useState } from 'react';
import React, { useCallback, useState } from 'react';
import { createGlobalStyle, ThemeProvider } from 'styled-components';
// FIXME We should not import from index when this one is imported there as well
@@ -16,12 +16,16 @@ interface Props {
function View ({ children, className }: Props): React.ReactElement<Props> {
const [theme, setTheme] = useState(chooseTheme());
const _theme = themes[theme];
const switchTheme = (theme: AvailableThemes): void => {
localStorage.setItem('theme', theme);
setTheme(theme);
};
const switchTheme = useCallback(
(theme: AvailableThemes): void => {
localStorage.setItem('theme', theme);
setTheme(theme);
},
[]
);
const _theme = themes[theme];
return (
<ThemeSwitchContext.Provider value={switchTheme}>
+23 -19
View File
@@ -87,7 +87,7 @@ function MenuAdd ({ className, reference }: Props): React.ReactElement<Props> {
<MenuItem className='menuItem'>
<Link
isDisabled={!mediaAllowed}
title={ !mediaAllowed
title={!mediaAllowed
? t<string>('Camera access must be first enabled in the settings')
: ''
}
@@ -99,24 +99,28 @@ function MenuAdd ({ className, reference }: Props): React.ReactElement<Props> {
</MenuItem>
<MenuItem className='menuItem ledger'>
{isLedgerEnabled
? <Link
isDisabled={!isLedgerCapable}
title={ (!isLedgerCapable && t<string>('Ledger devices can only be connected with Chrome browser')) || ''}
to={ledgerPath}
>
<FontAwesomeIcon
icon={faUsb}
rotation={270}
/>
<span>{ t<string>('Attach ledger account')}</span>
</Link>
: <Link onClick={_onOpenLedgerConnect}>
<FontAwesomeIcon
icon={faUsb}
rotation={270}
/>
<span>{ t<string>('Connect Ledger device')}</span>
</Link>
? (
<Link
isDisabled={!isLedgerCapable}
title={ (!isLedgerCapable && t<string>('Ledger devices can only be connected with Chrome browser')) || ''}
to={ledgerPath}
>
<FontAwesomeIcon
icon={faUsb}
rotation={270}
/>
<span>{ t<string>('Attach ledger account')}</span>
</Link>
)
: (
<Link onClick={_onOpenLedgerConnect}>
<FontAwesomeIcon
icon={faUsb}
rotation={270}
/>
<span>{ t<string>('Connect Ledger device')}</span>
</Link>
)
}
</MenuItem>
</Menu>
+2 -2
View File
@@ -12,7 +12,7 @@
"@polkadot/extension-ui": "^0.39.4-3"
},
"devDependencies": {
"@polkadot/dev": "^0.62.60",
"@polkadot/dev": "^0.62.62",
"babel-loader": "^8.2.2",
"browser-resolve": "^2.0.0",
"buffer": "^6.0.3",
@@ -26,7 +26,7 @@
"stream-browserify": "^3.0.0",
"thread-loader": "^3.0.4",
"url-loader": "^4.1.1",
"webpack": "^5.50.0",
"webpack": "^5.51.1",
"webpack-cli": "^4.8.0",
"webpack-extension-manifest-plugin": "^0.8.0"
}
+412 -343
View File
File diff suppressed because it is too large Load Diff