1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

@metamask/eslint-config*@6.0.0 (#10858)

* @metamask/eslint-config*@6.0.0

* Minor eslintrc reorg
This commit is contained in:
Erik Marks 2021-04-08 14:34:55 -07:00 committed by GitHub
parent e77aa0b7b5
commit e18deda0da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 181 additions and 172 deletions

View File

@ -36,7 +36,7 @@ module.exports = {
extends: [
'@metamask/eslint-config',
'@metamask/eslint-config/config/nodejs',
'@metamask/eslint-config-nodejs',
'prettier',
],
@ -48,19 +48,16 @@ module.exports = {
},
rules: {
// Prettier changes and reasoning
'prettier/prettier': 'error',
'import/no-unassigned-import': 'off',
'prefer-object-spread': 'error',
'default-param-last': 'off',
'prefer-object-spread': 'error',
'require-atomic-updates': 'off',
'import/no-unassigned-import': 'off',
'no-invalid-this': 'off',
'@babel/no-invalid-this': 'error',
// prettier handles these
semi: 'off',
// Prettier handles this
'@babel/semi': 'off',
'node/no-process-env': 'off',
@ -90,7 +87,7 @@ module.exports = {
},
{
files: ['test/e2e/**/*.spec.js'],
extends: ['@metamask/eslint-config/config/mocha'],
extends: ['@metamask/eslint-config-mocha'],
rules: {
'mocha/no-hooks-for-single-case': 'off',
'mocha/no-setup-in-describe': 'off',
@ -110,7 +107,7 @@ module.exports = {
},
{
files: ['**/*.test.js'],
extends: ['@metamask/eslint-config/config/mocha'],
extends: ['@metamask/eslint-config-mocha'],
rules: {
'mocha/no-setup-in-describe': 'off',
},

View File

@ -352,13 +352,13 @@ describe('migration #48', function () {
data: {
AddressBookController: {
addressBook: {
1: {
'1': {
address1: {
chainId: '1',
foo: 'bar',
},
},
100: {
'100': {
address1: {
chainId: '100',
foo: 'bar',
@ -417,7 +417,7 @@ describe('migration #48', function () {
data: {
AddressBookController: {
addressBook: {
2: {
'2': {
address1: {
chainId: '2',
key2: 'kaplar',
@ -490,7 +490,7 @@ describe('migration #48', function () {
AddressBookController: {
addressBook: {
'0x1': { foo: { bar: 'baz' } },
kaplar: { foo: { bar: 'baz' } },
'kaplar': { foo: { bar: 'baz' } },
},
bar: {
baz: 'buzz',
@ -506,7 +506,7 @@ describe('migration #48', function () {
AddressBookController: {
addressBook: {
'0x1': { foo: { bar: 'baz' } },
kaplar: { foo: { bar: 'baz' } },
'kaplar': { foo: { bar: 'baz' } },
},
bar: {
baz: 'buzz',

View File

@ -199,7 +199,7 @@ async function start() {
body: JSON_PAYLOAD,
headers: {
'User-Agent': 'metamaskbot',
Authorization: `token ${GITHUB_COMMENT_TOKEN}`,
'Authorization': `token ${GITHUB_COMMENT_TOKEN}`,
},
});
if (!response.ok) {

View File

@ -200,7 +200,9 @@
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.5.5",
"@lavamoat/allow-scripts": "^1.0.4",
"@metamask/eslint-config": "^5.0.0",
"@metamask/eslint-config": "^6.0.0",
"@metamask/eslint-config-mocha": "^6.0.0",
"@metamask/eslint-config-nodejs": "^6.0.0",
"@metamask/forwarder": "^1.1.0",
"@metamask/test-dapp": "^4.0.1",
"@sentry/cli": "^1.58.0",

View File

@ -73,7 +73,7 @@ module.exports = {
'function-parentheses-newline-inside': 'always-multi-line',
'function-parentheses-space-inside': 'never-single-line',
'function-whitespace-after': 'always',
indentation: 2,
'indentation': 2,
'length-zero-no-unit': true,
// 'max-empty-lines': 1,
'media-feature-colon-space-after': 'always',

View File

@ -131,27 +131,27 @@ const AssetListItem = ({
};
AssetListItem.propTypes = {
className: PropTypes.string,
'className': PropTypes.string,
'data-testid': PropTypes.string,
iconClassName: PropTypes.string,
onClick: PropTypes.func.isRequired,
tokenAddress: PropTypes.string,
tokenSymbol: PropTypes.string,
tokenDecimals: PropTypes.number,
tokenImage: PropTypes.string,
warning: PropTypes.node,
primary: PropTypes.string,
secondary: PropTypes.string,
identiconBorder: PropTypes.bool,
'iconClassName': PropTypes.string,
'onClick': PropTypes.func.isRequired,
'tokenAddress': PropTypes.string,
'tokenSymbol': PropTypes.string,
'tokenDecimals': PropTypes.number,
'tokenImage': PropTypes.string,
'warning': PropTypes.node,
'primary': PropTypes.string,
'secondary': PropTypes.string,
'identiconBorder': PropTypes.bool,
};
AssetListItem.defaultProps = {
className: undefined,
'className': undefined,
'data-testid': undefined,
iconClassName: undefined,
tokenAddress: undefined,
tokenImage: undefined,
warning: undefined,
'iconClassName': undefined,
'tokenAddress': undefined,
'tokenImage': undefined,
'warning': undefined,
};
export default AssetListItem;

View File

@ -9,7 +9,7 @@ export default function UserPreferencedCurrencyDisplay({
ethLogoHeight = 12,
ethNumberOfDecimals,
fiatNumberOfDecimals,
numberOfDecimals: propsNumberOfDecimals,
'numberOfDecimals': propsNumberOfDecimals,
showEthLogo,
type,
...restProps
@ -38,22 +38,22 @@ export default function UserPreferencedCurrencyDisplay({
}
UserPreferencedCurrencyDisplay.propTypes = {
className: PropTypes.string,
'className': PropTypes.string,
'data-testid': PropTypes.string,
prefix: PropTypes.string,
value: PropTypes.string,
numberOfDecimals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
hideLabel: PropTypes.bool,
hideTitle: PropTypes.bool,
style: PropTypes.object,
showEthLogo: PropTypes.bool,
ethLogoHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
type: PropTypes.oneOf([PRIMARY, SECONDARY]),
ethNumberOfDecimals: PropTypes.oneOfType([
'prefix': PropTypes.string,
'value': PropTypes.string,
'numberOfDecimals': PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
'hideLabel': PropTypes.bool,
'hideTitle': PropTypes.bool,
'style': PropTypes.object,
'showEthLogo': PropTypes.bool,
'ethLogoHeight': PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
'type': PropTypes.oneOf([PRIMARY, SECONDARY]),
'ethNumberOfDecimals': PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
fiatNumberOfDecimals: PropTypes.oneOfType([
'fiatNumberOfDecimals': PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),

View File

@ -12,16 +12,16 @@ const CLASSNAME_ROUNDED = 'btn--rounded';
const CLASSNAME_FIRST_TIME = 'btn--first-time';
const typeHash = {
default: CLASSNAME_DEFAULT,
primary: CLASSNAME_PRIMARY,
secondary: CLASSNAME_SECONDARY,
warning: 'btn-warning',
danger: 'btn-danger',
'default': CLASSNAME_DEFAULT,
'primary': CLASSNAME_PRIMARY,
'secondary': CLASSNAME_SECONDARY,
'warning': 'btn-warning',
'danger': 'btn-danger',
'danger-primary': 'btn-danger-primary',
link: 'btn-link',
'link': 'btn-link',
// TODO: Legacy button type to be deprecated
confirm: CLASSNAME_CONFIRM,
raised: CLASSNAME_RAISED,
'confirm': CLASSNAME_CONFIRM,
'raised': CLASSNAME_RAISED,
'first-time': CLASSNAME_FIRST_TIME,
};

View File

@ -50,17 +50,17 @@ export default function CurrencyDisplay({
}
CurrencyDisplay.propTypes = {
className: PropTypes.string,
currency: PropTypes.string,
'className': PropTypes.string,
'currency': PropTypes.string,
'data-testid': PropTypes.string,
denomination: PropTypes.oneOf([GWEI]),
displayValue: PropTypes.string,
hideLabel: PropTypes.bool,
hideTitle: PropTypes.bool,
numberOfDecimals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
prefix: PropTypes.string,
prefixComponent: PropTypes.node,
style: PropTypes.object,
suffix: PropTypes.string,
value: PropTypes.string,
'denomination': PropTypes.oneOf([GWEI]),
'displayValue': PropTypes.string,
'hideLabel': PropTypes.bool,
'hideTitle': PropTypes.bool,
'numberOfDecimals': PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
'prefix': PropTypes.string,
'prefixComponent': PropTypes.node,
'style': PropTypes.object,
'suffix': PropTypes.string,
'value': PropTypes.string,
};

View File

@ -24,13 +24,13 @@ const basic = {
const advanced = {
'Network Name': 'Ethereum Mainnet',
'Chain ID': '1',
Ticker: 'ETH',
'Ticker': 'ETH',
};
const tooltips = {
'Network Name': 'The name that is associated with this network',
'Chain ID': 'The numeric value representing the ID of this network',
Ticker: 'The currency symbol of the primary currency for this network',
'Ticker': 'The currency symbol of the primary currency for this network',
};
export const definitionList = () => (

View File

@ -36,11 +36,11 @@ export default function IconButton({
}
IconButton.propTypes = {
onClick: PropTypes.func.isRequired,
Icon: PropTypes.func.isRequired,
disabled: PropTypes.bool,
label: PropTypes.string.isRequired,
tooltipRender: PropTypes.func,
className: PropTypes.string,
'onClick': PropTypes.func.isRequired,
'Icon': PropTypes.func.isRequired,
'disabled': PropTypes.bool,
'label': PropTypes.string.isRequired,
'tooltipRender': PropTypes.func,
'className': PropTypes.string,
'data-testid': PropTypes.string,
};

View File

@ -51,14 +51,14 @@ export default function ListItem({
}
ListItem.propTypes = {
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
titleIcon: PropTypes.node,
subtitle: PropTypes.node,
children: PropTypes.node,
icon: PropTypes.node,
rightContent: PropTypes.node,
midContent: PropTypes.node,
className: PropTypes.string,
onClick: PropTypes.func,
'title': PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
'titleIcon': PropTypes.node,
'subtitle': PropTypes.node,
'children': PropTypes.node,
'icon': PropTypes.node,
'rightContent': PropTypes.node,
'midContent': PropTypes.node,
'className': PropTypes.string,
'onClick': PropTypes.func,
'data-testid': PropTypes.string,
};

View File

@ -24,20 +24,20 @@ const MenuItem = ({
);
MenuItem.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
'children': PropTypes.node.isRequired,
'className': PropTypes.string,
'data-testid': PropTypes.string,
iconClassName: PropTypes.string,
onClick: PropTypes.func,
subtitle: PropTypes.node,
'iconClassName': PropTypes.string,
'onClick': PropTypes.func,
'subtitle': PropTypes.node,
};
MenuItem.defaultProps = {
className: undefined,
'className': undefined,
'data-testid': undefined,
iconClassName: undefined,
onClick: undefined,
subtitle: undefined,
'iconClassName': undefined,
'onClick': undefined,
'subtitle': undefined,
};
export default MenuItem;

View File

@ -31,13 +31,13 @@ const Tab = (props) => {
};
Tab.propTypes = {
activeClassName: PropTypes.string,
className: PropTypes.string,
'activeClassName': PropTypes.string,
'className': PropTypes.string,
'data-testid': PropTypes.string,
isActive: PropTypes.bool, // required, but added using React.cloneElement
name: PropTypes.string.isRequired,
onClick: PropTypes.func,
tabIndex: PropTypes.number, // required, but added using React.cloneElement
'isActive': PropTypes.bool, // required, but added using React.cloneElement
'name': PropTypes.string.isRequired,
'onClick': PropTypes.func,
'tabIndex': PropTypes.number, // required, but added using React.cloneElement
};
Tab.defaultProps = {

View File

@ -18,8 +18,8 @@ const styles = {
'&$materialError': {
color: '#aeaeae',
},
fontWeight: '400',
color: '#aeaeae',
'fontWeight': '400',
'color': '#aeaeae',
},
materialFocused: {},
materialUnderline: {
@ -32,7 +32,7 @@ const styles = {
color: '#aeaeae',
},
materialWhitePaddedInput: {
padding: '8px',
'padding': '8px',
'&::placeholder': {
color: '#aeaeae',
@ -61,12 +61,12 @@ const styles = {
'label + &': {
marginTop: '9px',
},
border: '1px solid #BBC0C5',
height: '48px',
borderRadius: '6px',
padding: '0 16px',
display: 'flex',
alignItems: 'center',
'border': '1px solid #BBC0C5',
'height': '48px',
'borderRadius': '6px',
'padding': '0 16px',
'display': 'flex',
'alignItems': 'center',
'&$inputFocused': {
border: '1px solid #2f9ae0',
},
@ -188,8 +188,8 @@ const getBorderedThemeInputProps = ({
});
const themeToInputProps = {
material: getMaterialThemeInputProps,
bordered: getBorderedThemeInputProps,
'material': getMaterialThemeInputProps,
'bordered': getBorderedThemeInputProps,
'material-white-padded': getMaterialWhitePaddedThemeInputProps,
};

View File

@ -20,13 +20,13 @@ const basic = {
const advanced = {
'Network Name': 'Ethereum Mainnet',
'Chain ID': '1',
Ticker: 'ETH',
'Ticker': 'ETH',
};
const tooltips = {
'Network Name': 'The name that is associated with this network',
'Chain ID': 'The numeric value representing the ID of this network',
Ticker: 'The currency symbol of the primary currency for this network',
'Ticker': 'The currency symbol of the primary currency for this network',
};
export const truncatedDefinitionList = () => (

View File

@ -22,7 +22,7 @@ proxyquire('./send.container.js', {
},
},
'react-router-dom': { withRouter: () => undefined },
redux: { compose: (_, arg2) => () => arg2() },
'redux': { compose: (_, arg2) => () => arg2() },
'../../store/actions': actionSpies,
'../../ducks/send/send.duck': duckActionSpies,
'./send.utils.js': {

View File

@ -5,16 +5,16 @@ import DropdownSearchList from '../dropdown-search-list';
import TextField from '../../../components/ui/text-field';
const characterWidthMap = {
1: 5.86,
2: 10.05,
3: 10.45,
4: 11.1,
5: 10,
6: 10.06,
7: 9.17,
8: 10.28,
9: 10.06,
0: 11.22,
'1': 5.86,
'2': 10.05,
'3': 10.45,
'4': 11.1,
'5': 10,
'6': 10.06,
'7': 9.17,
'8': 10.28,
'9': 10.06,
'0': 11.22,
'.': 4.55,
};

View File

@ -29,17 +29,17 @@ describe('selectors', function () {
permissions: [
{
'@context': ['https://github.com/MetaMask/rpc-cap'],
caveats: [
'caveats': [
{
name: 'exposedAccounts',
type: 'filterResponse',
value: ['0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5'],
},
],
date: 1585676177970,
id: '840d72a0-925f-449f-830a-1aa1dd5ce151',
invoker: 'peepeth.com',
parentCapability: 'eth_accounts',
'date': 1585676177970,
'id': '840d72a0-925f-449f-830a-1aa1dd5ce151',
'invoker': 'peepeth.com',
'parentCapability': 'eth_accounts',
},
],
},
@ -47,17 +47,17 @@ describe('selectors', function () {
permissions: [
{
'@context': ['https://github.com/MetaMask/rpc-cap'],
caveats: [
'caveats': [
{
type: 'filterResponse',
value: ['0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5'],
name: 'exposedAccounts',
},
],
date: 1585685128948,
id: '6b9615cc-64e4-4317-afab-3c4f8ee0244a',
invoker: 'https://remix.ethereum.org',
parentCapability: 'eth_accounts',
'date': 1585685128948,
'id': '6b9615cc-64e4-4317-afab-3c4f8ee0244a',
'invoker': 'https://remix.ethereum.org',
'parentCapability': 'eth_accounts',
},
],
},
@ -104,17 +104,17 @@ describe('selectors', function () {
permissions: [
{
'@context': ['https://github.com/MetaMask/rpc-cap'],
caveats: [
'caveats': [
{
name: 'exposedAccounts',
type: 'filterResponse',
value: ['0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5'],
},
],
date: 1585676177970,
id: '840d72a0-925f-449f-830a-1aa1dd5ce151',
invoker: 'peepeth.com',
parentCapability: 'eth_accounts',
'date': 1585676177970,
'id': '840d72a0-925f-449f-830a-1aa1dd5ce151',
'invoker': 'peepeth.com',
'parentCapability': 'eth_accounts',
},
],
},
@ -122,7 +122,7 @@ describe('selectors', function () {
permissions: [
{
'@context': ['https://github.com/MetaMask/rpc-cap'],
caveats: [
'caveats': [
{
type: 'filterResponse',
value: [
@ -132,10 +132,10 @@ describe('selectors', function () {
name: 'exposedAccounts',
},
],
date: 1585685128948,
id: '6b9615cc-64e4-4317-afab-3c4f8ee0244a',
invoker: 'https://remix.ethereum.org',
parentCapability: 'eth_accounts',
'date': 1585685128948,
'id': '6b9615cc-64e4-4317-afab-3c4f8ee0244a',
'invoker': 'https://remix.ethereum.org',
'parentCapability': 'eth_accounts',
},
],
},
@ -190,7 +190,7 @@ describe('selectors', function () {
permissions: [
{
'@context': ['https://github.com/MetaMask/rpc-cap'],
caveats: [
'caveats': [
{
name: 'exposedAccounts',
type: 'filterResponse',
@ -203,10 +203,10 @@ describe('selectors', function () {
],
},
],
date: 1586359844177,
id: '3aa65a8b-3bcb-4944-941b-1baa5fe0ed8b',
invoker: 'https://remix.ethereum.org',
parentCapability: 'eth_accounts',
'date': 1586359844177,
'id': '3aa65a8b-3bcb-4944-941b-1baa5fe0ed8b',
'invoker': 'https://remix.ethereum.org',
'parentCapability': 'eth_accounts',
},
],
},
@ -214,17 +214,17 @@ describe('selectors', function () {
permissions: [
{
'@context': ['https://github.com/MetaMask/rpc-cap'],
caveats: [
'caveats': [
{
name: 'exposedAccounts',
type: 'filterResponse',
value: ['0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5'],
},
],
date: 1585676177970,
id: '840d72a0-925f-449f-830a-1aa1dd5ce151',
invoker: 'peepeth.com',
parentCapability: 'eth_accounts',
'date': 1585676177970,
'id': '840d72a0-925f-449f-830a-1aa1dd5ce151',
'invoker': 'peepeth.com',
'parentCapability': 'eth_accounts',
},
],
},
@ -347,7 +347,7 @@ describe('selectors', function () {
permissions: [
{
'@context': ['https://github.com/MetaMask/rpc-cap'],
caveats: [
'caveats': [
{
name: 'exposedAccounts',
type: 'filterResponse',
@ -357,10 +357,10 @@ describe('selectors', function () {
],
},
],
date: 1586359844177,
id: '3aa65a8b-3bcb-4944-941b-1baa5fe0ed8b',
invoker: 'https://remix.ethereum.org',
parentCapability: 'eth_accounts',
'date': 1586359844177,
'id': '3aa65a8b-3bcb-4944-941b-1baa5fe0ed8b',
'invoker': 'https://remix.ethereum.org',
'parentCapability': 'eth_accounts',
},
],
},
@ -368,17 +368,17 @@ describe('selectors', function () {
permissions: [
{
'@context': ['https://github.com/MetaMask/rpc-cap'],
caveats: [
'caveats': [
{
name: 'exposedAccounts',
type: 'filterResponse',
value: ['0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5'],
},
],
date: 1585676177970,
id: '840d72a0-925f-449f-830a-1aa1dd5ce151',
invoker: 'peepeth.com',
parentCapability: 'eth_accounts',
'date': 1585676177970,
'id': '840d72a0-925f-449f-830a-1aa1dd5ce151',
'invoker': 'peepeth.com',
'parentCapability': 'eth_accounts',
},
],
},
@ -386,17 +386,17 @@ describe('selectors', function () {
permissions: [
{
'@context': ['https://github.com/MetaMask/rpc-cap'],
caveats: [
'caveats': [
{
name: 'exposedAccounts',
type: 'filterResponse',
value: ['0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5'],
},
],
date: 1585616816623,
id: 'ce625215-f2e9-48e7-93ca-21ba193244ff',
invoker: 'uniswap.exchange',
parentCapability: 'eth_accounts',
'date': 1585616816623,
'id': 'ce625215-f2e9-48e7-93ca-21ba193244ff',
'invoker': 'uniswap.exchange',
'parentCapability': 'eth_accounts',
},
],
},

View File

@ -2689,10 +2689,20 @@
web3 "^0.20.7"
web3-provider-engine "^16.0.1"
"@metamask/eslint-config@^5.0.0":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@metamask/eslint-config/-/eslint-config-5.0.0.tgz#70c1ca854ce9b3b1cabd89cb736e8bb36127d164"
integrity sha512-eZt17NofPMmtoNjmBGOhUdAmyL0C+2/smtqAkVhpzZsU2ZGv+4Kekn8p8gcNONOYN8EotpWUxGkN1CTdVLdWZw==
"@metamask/eslint-config-mocha@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@metamask/eslint-config-mocha/-/eslint-config-mocha-6.0.0.tgz#407fc07d4bdfbc79b64989fa9a56a5a671aa4721"
integrity sha512-Hf1JYLWsW9JQWWwlLHltK1l0wqLOjCF0z5V2Dwt0oGUjFdAoVm8fOa2TisrgHNHYuAtyd+ZaIEm/xQce1L2ovg==
"@metamask/eslint-config-nodejs@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@metamask/eslint-config-nodejs/-/eslint-config-nodejs-6.0.0.tgz#df77bb35b91556030f1b23ad4ff51c1caf033339"
integrity sha512-nx7VhJRpJKQrcdDvy2bLCSWqBmWftgqxyG+BUw06XcWQzbmZTn94EXdLlH6zTQxmR4C+m+AOy5ung0NSUwmY3g==
"@metamask/eslint-config@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@metamask/eslint-config/-/eslint-config-6.0.0.tgz#ec53e8ab278073e882411ed89705bc7d06b78c81"
integrity sha512-LyakGYGwM8UQOGhwWa+5erAI1hXuiTgf/y7USzOomX6H9KiuY09IAUYnPh7ToPG2sedD2F48UF1bUm8yvCoZOw==
"@metamask/eth-ledger-bridge-keyring@^0.3.0":
version "0.3.0"