mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-10-22 11:22:43 +02:00
eslint perf improvement (#10775)
This commit is contained in:
parent
95fbf92cc5
commit
d5bfce3243
95
.eslintrc.js
95
.eslintrc.js
@ -40,6 +40,7 @@ module.exports = {
|
||||
'@metamask/eslint-config/config/mocha',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'prettier',
|
||||
],
|
||||
|
||||
plugins: ['@babel', 'react', 'import', 'prettier'],
|
||||
@ -53,59 +54,6 @@ module.exports = {
|
||||
// Prettier changes and reasoning
|
||||
|
||||
'prettier/prettier': 'error',
|
||||
|
||||
// Our eslint config has the default setting for this as error. This
|
||||
// include beforeBlockComment: true, but in order to match the prettier
|
||||
// spec you have to enable before and after blocks, objects and arrays
|
||||
// https://github.com/prettier/eslint-config-prettier#lines-around-comment
|
||||
'lines-around-comment': [
|
||||
'error',
|
||||
{
|
||||
beforeBlockComment: true,
|
||||
afterLineComment: false,
|
||||
allowBlockStart: true,
|
||||
allowBlockEnd: true,
|
||||
allowObjectStart: true,
|
||||
allowObjectEnd: true,
|
||||
allowArrayStart: true,
|
||||
allowArrayEnd: true,
|
||||
},
|
||||
],
|
||||
// Prettier has some opinions on mixed-operators, and there is ongoing work
|
||||
// to make the output code clear. It is better today then it was when the first
|
||||
// PR to add prettier. That being said, the workaround for keeping this rule enabled
|
||||
// requires breaking parts of operations into different variables -- which I believe
|
||||
// to be worse. https://github.com/prettier/eslint-config-prettier#no-mixed-operators
|
||||
'no-mixed-operators': 'off',
|
||||
// Prettier wraps single line functions with ternaries, etc in parens by default, but
|
||||
// if the line is long enough it breaks it into a separate line and removes the parens.
|
||||
// The second behavior conflicts with this rule. There is some guides on the repo about
|
||||
// how you can keep it enabled:
|
||||
// https://github.com/prettier/eslint-config-prettier#no-confusing-arrow
|
||||
// However, in practice this conflicts with prettier adding parens around short lines,
|
||||
// when autofixing in vscode and others.
|
||||
'no-confusing-arrow': 'off',
|
||||
// There is no configuration in prettier for how it stylizes regexes, which conflicts
|
||||
// with wrap-regex.
|
||||
'wrap-regex': 'off',
|
||||
// Prettier handles all indentation automagically. it can be configured here
|
||||
// https://prettier.io/docs/en/options.html#tab-width but the default matches our
|
||||
// style.
|
||||
indent: 'off',
|
||||
// This rule conflicts with the way that prettier breaks code across multiple lines when
|
||||
// it exceeds the maximum length. Prettier optimizes for readability while simultaneously
|
||||
// maximizing the amount of code per line.
|
||||
'function-paren-newline': 'off',
|
||||
// This rule throws an error when there is a line break in an arrow function declaration
|
||||
// but prettier breaks arrow function declarations to be as readable as possible while
|
||||
// still conforming to the width rules.
|
||||
'implicit-arrow-linebreak': 'off',
|
||||
// This rule would result in an increase in white space in lines with generator functions,
|
||||
// which impacts prettier's goal of maximizing code per line and readability. There is no
|
||||
// current workaround.
|
||||
'generator-star-spacing': 'off',
|
||||
'default-param-last': 'off',
|
||||
'require-atomic-updates': 'off',
|
||||
'import/no-unassigned-import': 'off',
|
||||
'prefer-object-spread': 'error',
|
||||
'react/no-unused-prop-types': 'error',
|
||||
@ -115,28 +63,11 @@ module.exports = {
|
||||
'error',
|
||||
{ props: 'never', children: 'never' },
|
||||
],
|
||||
'react/jsx-equals-spacing': 'error',
|
||||
'react/no-deprecated': 'error',
|
||||
'react/default-props-match-prop-types': 'error',
|
||||
'react/jsx-closing-tag-location': [
|
||||
'error',
|
||||
{ selfClosing: 'tag-aligned', nonEmpty: 'tag-aligned' },
|
||||
],
|
||||
'react/jsx-no-duplicate-props': 'error',
|
||||
'react/jsx-closing-bracket-location': 'error',
|
||||
'react/jsx-first-prop-new-line': ['error', 'multiline'],
|
||||
'react/jsx-max-props-per-line': [
|
||||
'error',
|
||||
{ maximum: 1, when: 'multiline' },
|
||||
],
|
||||
'react/jsx-tag-spacing': [
|
||||
'error',
|
||||
{
|
||||
closingSlash: 'never',
|
||||
beforeSelfClosing: 'always',
|
||||
afterOpening: 'never',
|
||||
},
|
||||
],
|
||||
'default-param-last': 'off',
|
||||
'require-atomic-updates': 'off',
|
||||
|
||||
'no-invalid-this': 'off',
|
||||
'@babel/no-invalid-this': 'error',
|
||||
@ -179,6 +110,26 @@ module.exports = {
|
||||
'@babel/no-invalid-this': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/!(*.test).js'],
|
||||
rules: {
|
||||
'mocha/max-top-level-suites': 'off',
|
||||
'mocha/no-identical-tests': 'off',
|
||||
'mocha/no-nested-tests': 'off',
|
||||
'mocha/no-identical-title': 'off',
|
||||
'mocha/no-skipped-tests': 'off',
|
||||
'mocha/no-exclusive-tests': 'off',
|
||||
'mocha/no-hooks-for-single-case': 'off',
|
||||
'mocha/no-async-describe': 'off',
|
||||
'mocha/no-sibling-hooks': 'off',
|
||||
'mocha/no-global-tests': 'off',
|
||||
'mocha/no-pending-tests': 'off',
|
||||
'mocha/no-mocha-arrows': 'off',
|
||||
'mocha/no-top-level-hooks': 'off',
|
||||
'mocha/handle-done-callback': 'off',
|
||||
'mocha/no-return-and-callback': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'development/**/*.js',
|
||||
|
@ -228,10 +228,11 @@
|
||||
"enzyme": "^3.10.0",
|
||||
"enzyme-adapter-react-16": "^1.15.1",
|
||||
"eslint": "^7.7.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-mocha": "^8.0.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-react": "~7.20.0",
|
||||
"eslint-plugin-react-hooks": "^4.0.4",
|
||||
"fancy-log": "^1.3.3",
|
||||
@ -264,7 +265,7 @@
|
||||
"nyc": "^15.0.0",
|
||||
"patch-package": "^6.4.7",
|
||||
"polyfill-crypto.getrandomvalues": "^1.0.0",
|
||||
"prettier": "^2.1.1",
|
||||
"prettier": "^2.2.1",
|
||||
"prettier-plugin-sort-json": "^0.0.1",
|
||||
"proxyquire": "^2.1.3",
|
||||
"randomcolor": "^0.5.4",
|
||||
|
18
yarn.lock
18
yarn.lock
@ -9220,6 +9220,11 @@ escope@^3.6.0:
|
||||
esrecurse "^4.1.0"
|
||||
estraverse "^4.1.1"
|
||||
|
||||
eslint-config-prettier@^8.1.0:
|
||||
version "8.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.1.0.tgz#4ef1eaf97afe5176e6a75ddfb57c335121abc5a6"
|
||||
integrity sha512-oKMhGv3ihGbCIimCAjqkdzx2Q+jthoqnXSP+d86M9tptwugycmTFdVR4IpLgq2c4SHifbwO90z2fQ8/Aio73yw==
|
||||
|
||||
eslint-import-resolver-node@^0.3.3:
|
||||
version "0.3.4"
|
||||
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz#85ffa81942c25012d8231096ddf679c03042c717"
|
||||
@ -9290,10 +9295,10 @@ eslint-plugin-node@^11.1.0:
|
||||
resolve "^1.10.1"
|
||||
semver "^6.1.0"
|
||||
|
||||
eslint-plugin-prettier@^3.1.4:
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2"
|
||||
integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==
|
||||
eslint-plugin-prettier@^3.3.1:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz#7079cfa2497078905011e6f82e8dd8453d1371b7"
|
||||
integrity sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ==
|
||||
dependencies:
|
||||
prettier-linter-helpers "^1.0.0"
|
||||
|
||||
@ -19597,6 +19602,11 @@ prettier@^2.1.1:
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6"
|
||||
integrity sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==
|
||||
|
||||
prettier@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
|
||||
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
|
||||
|
||||
pretty-error@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
|
||||
|
Loading…
Reference in New Issue
Block a user