зеркало из https://github.com/mozilla/treeherder.git
Bug 1432840 - Use the AirBnb React ESLint preset
Previously only 65 rules were enabled, since the `eslint:recommended` and `plugin:react/recommended` entries in `extends` had no effect, since when using ESLint's API rather than CLI, the options must be passed inside the `baseConfig` property instead. This commit corrects the usage of `extends` and switches us to AirBnb's React ESLint preset rather than manually opting into rules: https://github.com/airbnb/javascript Even with the temporarily disabled rules (which can be gradually fixed in the future), there are now over 200 ESLint rules enabled, giving a significant increase in coverage. Note: We're having to use v15 of `eslint-config-airbnb` rather than v16 until we update to newer Neutrino, since the latest preset has dropped support for the ESLint v3 that comes with Neutrino 4.
This commit is contained in:
Родитель
7c20363e48
Коммит
13627f006b
|
@ -16,100 +16,88 @@ module.exports = neutrino => {
|
|||
.loader('eslint', props => merge(props, {
|
||||
options: {
|
||||
plugins: ['react'],
|
||||
envs: ['browser', 'es6', 'node'],
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaFeatures: {
|
||||
es6: true,
|
||||
jsx: true,
|
||||
impliedStrict: false
|
||||
}
|
||||
envs: ['browser', 'es6', 'commonjs'],
|
||||
baseConfig: {
|
||||
extends: ['airbnb']
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:react/recommended',
|
||||
],
|
||||
rules: {
|
||||
'arrow-body-style': ['error', 'as-needed', {
|
||||
requireReturnForObjectLiteral: false,
|
||||
}],
|
||||
'arrow-parens': ['error', 'as-needed', {
|
||||
requireForBlockBody: true,
|
||||
}],
|
||||
'arrow-spacing': ['error', { before: true, after: true }],
|
||||
'accessor-pairs': 'error',
|
||||
'block-spacing': ['error', 'always'],
|
||||
'comma-spacing': 'error',
|
||||
'comma-style': 'error',
|
||||
'curly': ['error', 'multi-line', 'consistent'],
|
||||
'eol-last': 'error',
|
||||
'eqeqeq': 'error',
|
||||
'guard-for-in': 'error',
|
||||
'key-spacing': ['error', {
|
||||
beforeColon: false,
|
||||
afterColon: true
|
||||
}],
|
||||
'keyword-spacing': 'error',
|
||||
'linebreak-style': 'error',
|
||||
'new-cap': 'error',
|
||||
'new-parens': 'error',
|
||||
'no-array-constructor': 'error',
|
||||
'no-bitwise': 'error',
|
||||
'no-caller': 'error',
|
||||
'no-div-regex': 'error',
|
||||
'no-else-return': 'error',
|
||||
'no-empty-pattern': 'error',
|
||||
'no-eval': 'error',
|
||||
'no-extend-native': 'error',
|
||||
'no-extra-bind': 'error',
|
||||
'no-floating-decimal': 'error',
|
||||
'no-implied-eval': 'error',
|
||||
'no-iterator': 'error',
|
||||
'no-label-var': 'error',
|
||||
'no-labels': 'error',
|
||||
'no-lone-blocks': 'error',
|
||||
'no-lonely-if': 'error',
|
||||
'no-multi-spaces': 'error',
|
||||
'no-multi-str': 'error',
|
||||
'no-native-reassign': 'error',
|
||||
'no-new': 'error',
|
||||
'no-new-func': 'error',
|
||||
'no-new-object': 'error',
|
||||
'no-new-wrappers': 'error',
|
||||
'no-octal-escape': 'error',
|
||||
'no-proto': 'error',
|
||||
'no-return-assign': 'error',
|
||||
'no-script-url': 'error',
|
||||
'no-self-compare': 'error',
|
||||
'no-sequences': 'error',
|
||||
'no-shadow-restricted-names': 'error',
|
||||
'no-spaced-func': 'error',
|
||||
'no-trailing-spaces': 'error',
|
||||
'no-undef-init': 'error',
|
||||
'no-undef': 'error',
|
||||
'no-unexpected-multiline': 'error',
|
||||
'no-unneeded-ternary': 'error',
|
||||
'no-unused-expressions': 'error',
|
||||
'no-unused-vars': 'error',
|
||||
'no-useless-call': 'error',
|
||||
'no-void': 'error',
|
||||
'no-with': 'error',
|
||||
'object-curly-spacing': ['error', 'always'],
|
||||
'react/jsx-uses-react': 'error',
|
||||
'react/jsx-uses-vars': 'error',
|
||||
'semi': 'error',
|
||||
'space-before-blocks': 'error',
|
||||
'space-before-function-paren': ['error', {
|
||||
anonymous: 'always',
|
||||
named: 'never',
|
||||
asyncArrow: 'always'
|
||||
}],
|
||||
'quote-props': ['error', 'as-needed', {
|
||||
keywords: false,
|
||||
unnecessary: true,
|
||||
numbers: false
|
||||
}],
|
||||
'yoda': 'error'
|
||||
// TODO: Fix & remove these deviations from AirBnB style (bug 1183749).
|
||||
'array-bracket-spacing': 'off',
|
||||
'block-scoped-var': 'off',
|
||||
'camelcase': 'off',
|
||||
'class-methods-use-this': 'off',
|
||||
'comma-dangle': 'off',
|
||||
'consistent-return': 'off',
|
||||
'default-case': 'off',
|
||||
'func-names': 'off',
|
||||
'global-require': 'off',
|
||||
'import/first': 'off',
|
||||
'import/no-named-as-default': 'off',
|
||||
'import/prefer-default-export': 'off',
|
||||
// Indentation is disabled pending a switch from 4 to 2 space for JS.
|
||||
'indent': 'off',
|
||||
'jsx-a11y/alt-text': 'off',
|
||||
'jsx-a11y/label-has-for': 'off',
|
||||
'jsx-a11y/no-noninteractive-element-interactions': 'off',
|
||||
'jsx-a11y/no-static-element-interactions': 'off',
|
||||
'jsx-quotes': 'off',
|
||||
'lines-around-directive': 'off',
|
||||
'max-len': 'off',
|
||||
'no-alert': 'off',
|
||||
'no-continue': 'off',
|
||||
'no-extra-semi': 'off',
|
||||
'no-loop-func': 'off',
|
||||
'no-mixed-operators': 'off',
|
||||
'no-multi-assign': 'off',
|
||||
'no-nested-ternary': 'off',
|
||||
'no-param-reassign': 'off',
|
||||
'no-plusplus': 'off',
|
||||
'no-prototype-builtins': 'off',
|
||||
'no-redeclare': 'off',
|
||||
'no-restricted-properties': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'no-shadow': 'off',
|
||||
'no-underscore-dangle': 'off',
|
||||
'no-use-before-define': 'off',
|
||||
'no-useless-constructor': 'off',
|
||||
'no-useless-escape': 'off',
|
||||
'no-useless-return': 'off',
|
||||
'no-var': 'off',
|
||||
'object-property-newline': 'off',
|
||||
'object-shorthand': 'off',
|
||||
'one-var': 'off',
|
||||
'one-var-declaration-per-line': 'off',
|
||||
'padded-blocks': 'off',
|
||||
'prefer-arrow-callback': 'off',
|
||||
'prefer-const': 'off',
|
||||
'prefer-rest-params': 'off',
|
||||
'prefer-spread': 'off',
|
||||
'prefer-template': 'off',
|
||||
'quotes': 'off',
|
||||
'radix': 'off',
|
||||
'react/forbid-prop-types': 'off',
|
||||
'react/jsx-boolean-value': 'off',
|
||||
'react/jsx-closing-bracket-location': 'off',
|
||||
'react/jsx-curly-spacing': 'off',
|
||||
'react/jsx-filename-extension': 'off',
|
||||
'react/jsx-first-prop-new-line': 'off',
|
||||
'react/jsx-indent': 'off',
|
||||
'react/jsx-indent-props': 'off',
|
||||
'react/jsx-max-props-per-line': 'off',
|
||||
'react/jsx-tag-spacing': 'off',
|
||||
'react/jsx-wrap-multilines': 'off',
|
||||
'react/no-array-index-key': 'off',
|
||||
'react/no-danger': 'off',
|
||||
'react/no-multi-comp': 'off',
|
||||
'react/prefer-stateless-function': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'react/require-default-props': 'off',
|
||||
'react/self-closing-comp': 'off',
|
||||
'react/sort-comp': 'off',
|
||||
'space-infix-ops': 'off',
|
||||
'spaced-comment': 'off',
|
||||
'strict': 'off',
|
||||
'vars-on-top': 'off',
|
||||
},
|
||||
globals: [
|
||||
'$',
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
"angular1-ui-bootstrap4": "2.4.22",
|
||||
"bootstrap": "4.0.0-beta.2",
|
||||
"deepmerge": "1.5.2",
|
||||
"eslint-config-airbnb": "15.1.0",
|
||||
"eslint-plugin-jsx-a11y": "5.1.1",
|
||||
"eslint-plugin-react": "7.5.1",
|
||||
"font-awesome": "4.7.0",
|
||||
"hawk": "6.0.2",
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
],
|
||||
"ignoreDeps": [
|
||||
"deepmerge",
|
||||
"eslint-config-airbnb",
|
||||
"eslint-plugin-jsx-a11y",
|
||||
"eslint-plugin-react",
|
||||
"neutrino",
|
||||
"neutrino-lint-base",
|
||||
"neutrino-preset-karma",
|
||||
|
|
54
yarn.lock
54
yarn.lock
|
@ -215,6 +215,12 @@ argparse@^1.0.7:
|
|||
dependencies:
|
||||
sprintf-js "~1.0.2"
|
||||
|
||||
aria-query@^0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.7.0.tgz#4af10a1e61573ddea0cf3b99b51c52c05b424d24"
|
||||
dependencies:
|
||||
ast-types-flow "0.0.7"
|
||||
|
||||
arr-diff@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
|
||||
|
@ -327,6 +333,10 @@ assign-symbols@^1.0.0:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
|
||||
|
||||
ast-types-flow@0.0.7:
|
||||
version "0.0.7"
|
||||
resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad"
|
||||
|
||||
ast-types@0.9.6:
|
||||
version "0.9.6"
|
||||
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9"
|
||||
|
@ -376,6 +386,12 @@ aws4@^1.2.1:
|
|||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"
|
||||
|
||||
axobject-query@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-0.1.0.tgz#62f59dbc59c9f9242759ca349960e7a2fe3c36c0"
|
||||
dependencies:
|
||||
ast-types-flow "0.0.7"
|
||||
|
||||
babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
|
||||
|
@ -2229,6 +2245,10 @@ d@1:
|
|||
dependencies:
|
||||
es5-ext "^0.10.9"
|
||||
|
||||
damerau-levenshtein@^1.0.0:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514"
|
||||
|
||||
dashdash@^1.12.0:
|
||||
version "1.14.1"
|
||||
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
|
||||
|
@ -2541,6 +2561,10 @@ elliptic@^6.0.0:
|
|||
minimalistic-assert "^1.0.0"
|
||||
minimalistic-crypto-utils "^1.0.0"
|
||||
|
||||
emoji-regex@^6.1.0:
|
||||
version "6.5.1"
|
||||
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2"
|
||||
|
||||
emojis-list@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
|
||||
|
@ -2775,6 +2799,18 @@ escope@^3.6.0:
|
|||
esrecurse "^4.1.0"
|
||||
estraverse "^4.1.1"
|
||||
|
||||
eslint-config-airbnb-base@^11.3.0:
|
||||
version "11.3.2"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.3.2.tgz#8703b11abe3c88ac7ec2b745b7fdf52e00ae680a"
|
||||
dependencies:
|
||||
eslint-restricted-globals "^0.1.1"
|
||||
|
||||
eslint-config-airbnb@15.1.0:
|
||||
version "15.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-15.1.0.tgz#fd432965a906e30139001ba830f58f73aeddae8e"
|
||||
dependencies:
|
||||
eslint-config-airbnb-base "^11.3.0"
|
||||
|
||||
eslint-import-resolver-node@^0.3.1:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a"
|
||||
|
@ -2818,6 +2854,18 @@ eslint-plugin-import@^2.2.0:
|
|||
minimatch "^3.0.3"
|
||||
read-pkg-up "^2.0.0"
|
||||
|
||||
eslint-plugin-jsx-a11y@5.1.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-5.1.1.tgz#5c96bb5186ca14e94db1095ff59b3e2bd94069b1"
|
||||
dependencies:
|
||||
aria-query "^0.7.0"
|
||||
array-includes "^3.0.3"
|
||||
ast-types-flow "0.0.7"
|
||||
axobject-query "^0.1.0"
|
||||
damerau-levenshtein "^1.0.0"
|
||||
emoji-regex "^6.1.0"
|
||||
jsx-ast-utils "^1.4.0"
|
||||
|
||||
eslint-plugin-react@7.5.1:
|
||||
version "7.5.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.5.1.tgz#52e56e8d80c810de158859ef07b880d2f56ee30b"
|
||||
|
@ -2837,6 +2885,10 @@ eslint-plugin-react@^6.10.0:
|
|||
jsx-ast-utils "^1.3.4"
|
||||
object.assign "^4.0.4"
|
||||
|
||||
eslint-restricted-globals@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz#35f0d5cbc64c2e3ed62e93b4b1a7af05ba7ed4d7"
|
||||
|
||||
eslint@^3.16.1:
|
||||
version "3.19.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc"
|
||||
|
@ -4350,7 +4402,7 @@ jsprim@^1.2.2:
|
|||
json-schema "0.2.3"
|
||||
verror "1.10.0"
|
||||
|
||||
jsx-ast-utils@^1.3.4:
|
||||
jsx-ast-utils@^1.3.4, jsx-ast-utils@^1.4.0:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1"
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче