-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move react/jsx-a11y rules into shared react preset (#49244)
* move react/jsx-a11y rules into shared react preset * autofix react/jsx-closing-tag-location * autofix react/no-unknown-property * manually fix react/no-unescaped-entities * maually fix react/jsx-pascal-case * manually fix react/prefer-stateless-function * disable known violations in specific plugins/areas * remove code override
- Loading branch information
Spencer
authored
Oct 29, 2019
1 parent
75384e1
commit 19ea92a
Showing
62 changed files
with
632 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
const semver = require('semver') | ||
const PKG = require('../../package.json') | ||
|
||
module.exports = { | ||
plugins: [ | ||
'react', | ||
'react-hooks', | ||
'jsx-a11y', | ||
], | ||
|
||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
}, | ||
|
||
settings: { | ||
react: { | ||
version: semver.valid(semver.coerce(PKG.dependencies.react)), | ||
}, | ||
}, | ||
|
||
rules: { | ||
'jsx-quotes': ['error', 'prefer-double'], | ||
'react/jsx-uses-react': 'error', | ||
'react/react-in-jsx-scope': 'error', | ||
'react/jsx-uses-vars': 'error', | ||
'react/jsx-no-undef': 'error', | ||
'react/jsx-pascal-case': 'error', | ||
'react/jsx-closing-bracket-location': ['error', 'line-aligned'], | ||
'react/jsx-closing-tag-location': 'error', | ||
'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }], | ||
'react/jsx-indent-props': ['error', 2], | ||
'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }], | ||
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }], | ||
'react/no-danger': 'error', | ||
'react/self-closing-comp': 'error', | ||
'react/jsx-wrap-multilines': ['error', { | ||
declaration: true, | ||
assignment: true, | ||
return: true, | ||
arrow: true, | ||
}], | ||
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'], | ||
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks | ||
'react-hooks/exhaustive-deps': 'error', // Checks effect dependencies | ||
'jsx-a11y/accessible-emoji': 'error', | ||
'jsx-a11y/alt-text': 'error', | ||
'jsx-a11y/anchor-has-content': 'error', | ||
'jsx-a11y/aria-activedescendant-has-tabindex': 'error', | ||
'jsx-a11y/aria-props': 'error', | ||
'jsx-a11y/aria-proptypes': 'error', | ||
'jsx-a11y/aria-role': 'error', | ||
'jsx-a11y/aria-unsupported-elements': 'error', | ||
'jsx-a11y/click-events-have-key-events': 'error', | ||
'jsx-a11y/heading-has-content': 'error', | ||
'jsx-a11y/html-has-lang': 'error', | ||
'jsx-a11y/iframe-has-title': 'error', | ||
'jsx-a11y/interactive-supports-focus': 'error', | ||
'jsx-a11y/label-has-associated-control': 'error', | ||
'jsx-a11y/media-has-caption': 'error', | ||
'jsx-a11y/mouse-events-have-key-events': 'error', | ||
'jsx-a11y/no-access-key': 'error', | ||
'jsx-a11y/no-distracting-elements': 'error', | ||
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'error', | ||
'jsx-a11y/no-noninteractive-element-interactions': 'error', | ||
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error', | ||
'jsx-a11y/no-onchange': 'error', | ||
'jsx-a11y/no-redundant-roles': 'error', | ||
'jsx-a11y/role-has-required-aria-props': 'error', | ||
'jsx-a11y/role-supports-aria-props': 'error', | ||
'jsx-a11y/scope': 'error', | ||
'jsx-a11y/tabindex-no-positive': 'error', | ||
'react/jsx-equals-spacing': ['error', 'never'], | ||
'react/jsx-indent': ['error', 2], | ||
'react/no-will-update-set-state': 'error', | ||
'react/no-is-mounted': 'error', | ||
'react/no-multi-comp': ['error', { ignoreStateless: true }], | ||
'react/no-unknown-property': 'error', | ||
'react/prefer-es6-class': ['error', 'always'], | ||
'react/prefer-stateless-function': ['error', { ignorePureComponents: true }], | ||
'react/no-unescaped-entities': 'error', | ||
}, | ||
} |
Oops, something went wrong.