Eslintrc fix (#2850)

* eslintrc: adapt changes in eslint-plugin-jsx-a11y

* Replace 'jsx-a11y/img-has-alt' with 'jsx-a11y/alt-text'.
  Reference: evcohen/eslint-plugin-jsx-a11y@24b6193

* Replace 'jsx-a11y/onclick-has-focus' with 'jsx-a11y/interactive-supports-focus'
  Reference: evcohen/eslint-plugin-jsx-a11y@cbdfeb8

* Replace 'jsx-a11y/onclick-has-role' with 'jsx-a11y/no-noninteractive-element-interactions'
  Reference: evcohen/eslint-plugin-jsx-a11y@18c9b71

* Update eslint-plugin-jsx-a11y to 5.0.0

Follow the change in Code Climate. Make sure the same eslintrc
can be executed locally and in Code Climate.

* Convert .eslintrc.json to equivlant .eslintrc.yml

* Less quotes and commas, more readability, allow comment.
pull/2856/head
Koala Yeung 2017-05-07 03:26:54 +08:00 committed by Eugen Rochko
parent 59ca634b89
commit 6f71cfeff9
4 changed files with 100 additions and 93 deletions

View File

@ -1,79 +0,0 @@
{
"env": {
"browser": true,
"node": false,
"es6": true
},
"parser": "babel-eslint",
"plugins": [
"react",
"jsx-a11y"
],
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"arrowFunctions": true,
"jsx": true,
"destructuring": true,
"modules": true,
"spread": true
}
},
"rules": {
"no-cond-assign": 2,
"no-console": 1,
"no-irregular-whitespace": 2,
"no-unreachable": 2,
"valid-typeof": 2,
"consistent-return": 2,
"dot-notation": 2,
"eqeqeq": 2,
"no-fallthrough": 2,
"no-unused-expressions": 2,
"strict": 0,
"no-catch-shadow": 2,
"indent": [1, 2],
"brace-style": 1,
"comma-spacing": [1, {"before": false, "after": true}],
"comma-style": [1, "last"],
"no-mixed-spaces-and-tabs": 1,
"no-nested-ternary": 1,
"no-trailing-spaces": 1,
"react/jsx-wrap-multilines": 2,
"react/self-closing-comp": 2,
"react/prop-types": 2,
"react/no-multi-comp": 0,
"jsx-a11y/accessible-emoji": 1,
"jsx-a11y/anchor-has-content": 1,
"jsx-a11y/aria-activedescendant-has-tabindex": 1,
"jsx-a11y/aria-props": 1,
"jsx-a11y/aria-proptypes": 1,
"jsx-a11y/aria-role": 1,
"jsx-a11y/aria-unsupported-elements": 1,
"jsx-a11y/heading-has-content": 1,
"jsx-a11y/href-no-hash": 1,
"jsx-a11y/html-has-lang": 1,
"jsx-a11y/iframe-has-title": 1,
"jsx-a11y/img-has-alt": 1,
"jsx-a11y/img-redundant-alt": 1,
"jsx-a11y/label-has-for": 1,
"jsx-a11y/mouse-events-have-key-events": 1,
"jsx-a11y/no-access-key": 1,
"jsx-a11y/no-distracting-elements": 1,
"jsx-a11y/no-onchange": 1,
"jsx-a11y/no-redundant-roles": 1,
"jsx-a11y/onclick-has-focus": 1,
"jsx-a11y/onclick-has-role": 1,
"jsx-a11y/role-has-required-aria-props": 1,
"jsx-a11y/role-supports-aria-props": 1,
"jsx-a11y/scope": 1,
"jsx-a11y/tabindex-no-positive": 1
}
}

80
.eslintrc.yml Normal file
View File

@ -0,0 +1,80 @@
---
env:
browser: true
node: false
es6: true
parser: babel-eslint
plugins:
- react
- jsx-a11y
parserOptions:
sourceType: module
ecmaFeatures:
arrowFunctions: true
jsx: true
destructuring: true
modules: true
spread: true
rules:
no-cond-assign: error
no-console: warn
no-irregular-whitespace: error
no-unreachable: error
valid-typeof: error
consistent-return: error
dot-notation: error
eqeqeq: error
no-fallthrough: error
no-unused-expressions: error
strict: off
no-catch-shadow: error
indent:
- warn
- 2
brace-style: warn
comma-spacing:
- warn
- before: false
after: true
comma-style:
- warn
- last
no-mixed-spaces-and-tabs: warn
no-nested-ternary: warn
no-trailing-spaces: warn
react/jsx-wrap-multilines: error
react/self-closing-comp: error
react/prop-types: error
react/no-multi-comp: off
jsx-a11y/accessible-emoji: warn
jsx-a11y/anchor-has-content: warn
jsx-a11y/alt-text: warn
jsx-a11y/aria-activedescendant-has-tabindex: warn
jsx-a11y/aria-props: warn
jsx-a11y/aria-proptypes: warn
jsx-a11y/aria-role: warn
jsx-a11y/aria-unsupported-elements: warn
jsx-a11y/heading-has-content: warn
jsx-a11y/href-no-hash: warn
jsx-a11y/html-has-lang: warn
jsx-a11y/iframe-has-title: warn
jsx-a11y/img-redundant-alt: warn
jsx-a11y/interactive-supports-focus: warn
jsx-a11y/label-has-for: warn
jsx-a11y/mouse-events-have-key-events: warn
jsx-a11y/no-access-key: warn
jsx-a11y/no-distracting-elements: warn
jsx-a11y/no-noninteractive-element-interactions: warn
jsx-a11y/no-onchange: warn
jsx-a11y/no-redundant-roles: warn
jsx-a11y/role-has-required-aria-props: warn
jsx-a11y/role-supports-aria-props: warn
jsx-a11y/scope: warn
jsx-a11y/tabindex-no-positive: warn

View File

@ -9,7 +9,7 @@
"start": "babel-node ./streaming/index.js --presets es2015,stage-2",
"storybook": "start-storybook -p 9001 -c storybook",
"test": "npm run test:lint && npm run test:mocha",
"test:lint": "eslint -c .eslintrc.json --ext=js --ext=jsx app/javascript/",
"test:lint": "eslint -c .eslintrc.yml --ext=js --ext=jsx app/javascript/",
"test:mocha": "mocha --require ./spec/javascript/setup.js --compilers js:babel-register ./spec/javascript/components/*.test.jsx"
},
"repository": {
@ -112,7 +112,7 @@
"chai-enzyme": "^0.6.1",
"enzyme": "^2.8.2",
"eslint": "^3.19.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-jsx-a11y": "^5.0.0",
"eslint-plugin-react": "^6.10.3",
"jsdom": "^9.11.0",
"minimist": "^1.2.0",

View File

@ -232,9 +232,9 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"
aria-query@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.3.0.tgz#cb8a9984e2862711c83c80ade5b8f5ca0de2b467"
aria-query@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.5.0.tgz#85e3152cd8cc5bab18dbed61cd9c4fce54fa79c3"
dependencies:
ast-types-flow "0.0.7"
@ -389,6 +389,12 @@ axios@^0.15.3:
dependencies:
follow-redirects "1.0.0"
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-cli@^6.23.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-cli/-/babel-cli-6.23.0.tgz#52ff946a2b0f64645c35e7bd5eea267aa0948c0f"
@ -2514,16 +2520,16 @@ escope@^3.6.0:
esrecurse "^4.1.0"
estraverse "^4.1.1"
eslint-plugin-jsx-a11y@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-4.0.0.tgz#779bb0fe7b08da564a422624911de10061e048ee"
eslint-plugin-jsx-a11y@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-5.0.0.tgz#88c1d26b2d145ef077ab3d130be15243ac06a877"
dependencies:
aria-query "^0.3.0"
aria-query "^0.5.0"
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.0.0"
object-assign "^4.0.1"
jsx-ast-utils "^1.4.0"
eslint-plugin-react@^6.10.3:
version "6.10.3"
@ -3751,7 +3757,7 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.3.6"
jsx-ast-utils@^1.0.0, jsx-ast-utils@^1.3.4:
jsx-ast-utils@^1.3.4, jsx-ast-utils@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.0.tgz#5afe38868f56bc8cc7aeaef0100ba8c75bd12591"
dependencies:
@ -3990,11 +3996,11 @@ lodash.tail@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.tail/-/lodash.tail-4.1.1.tgz#d2333a36d9e7717c8ad2f7cacafec7c32b444664"
lodash@4.x.x, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.1, lodash@^4.3.0:
lodash@4.x.x, "lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
lodash@^4.15.0, lodash@^4.2.0, lodash@^4.6.1, lodash@~4.16.4:
lodash@~4.16.4:
version "4.16.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.16.4.tgz#01ce306b9bad1319f2a5528674f88297aeb70127"