diff --git a/jsx-a11y.js b/jsx-a11y.js index 46011ab..bf12f99 100644 --- a/jsx-a11y.js +++ b/jsx-a11y.js @@ -1,3 +1,5 @@ +const {mapDeprecatedRules} = require('./utils') + module.exports = { env: { browser: true, @@ -9,6 +11,9 @@ module.exports = { }, plugins: ['jsx-a11y'], rules: { + ...mapDeprecatedRules([ + 'jsx-a11y/label-has-for', // see label-has-associated-control + ]), 'jsx-a11y/accessible-emoji': 'error', 'jsx-a11y/alt-text': 'warn', 'jsx-a11y/anchor-has-content': 'error', @@ -20,12 +25,13 @@ module.exports = { 'jsx-a11y/aria-unsupported-elements': 'error', 'jsx-a11y/autocomplete-valid': 'error', 'jsx-a11y/click-events-have-key-events': 'error', + 'jsx-a11y/control-has-associated-label': 'off', 'jsx-a11y/heading-has-content': 'error', 'jsx-a11y/html-has-lang': 'error', 'jsx-a11y/iframe-has-title': 'error', 'jsx-a11y/img-redundant-alt': 'error', 'jsx-a11y/interactive-supports-focus': 'warn', - 'jsx-a11y/label-has-for': 'off', // deprecated -> label-has-associated-control + 'jsx-a11y/label-has-associated-control': 'error', 'jsx-a11y/lang': 'error', 'jsx-a11y/media-has-caption': 'warn', 'jsx-a11y/mouse-events-have-key-events': 'error', @@ -43,7 +49,5 @@ module.exports = { 'jsx-a11y/role-supports-aria-props': 'error', 'jsx-a11y/scope': 'error', 'jsx-a11y/tabindex-no-positive': 'warn', - 'jsx-a11y/label-has-associated-control': 'error', - 'jsx-a11y/control-has-associated-label': 'off', }, } diff --git a/react.js b/react.js index 9942fbb..91ad123 100644 --- a/react.js +++ b/react.js @@ -39,17 +39,27 @@ module.exports = { }, }, rules: { + 'react/boolean-prop-naming': 'off', + 'react/button-has-type': 'off', + 'react/default-props-match-prop-types': 'error', + 'react/destructuring-assignment': 'off', 'react/display-name': ['error', {ignoreTranspilerName: false}], 'react/forbid-component-props': 'off', + 'react/forbid-dom-props': 'off', 'react/forbid-elements': 'off', 'react/forbid-foreign-prop-types': 'error', 'react/forbid-prop-types': 'off', 'react/function-component-definition': 'off', 'react/jsx-boolean-value': 'off', + 'react/jsx-curly-brace-presence': [ + 'warn', + {props: 'never', children: 'ignore'}, + ], 'react/jsx-filename-extension': ['error', {extensions: ['.js']}], 'react/jsx-fragments': 'off', 'react/jsx-handler-names': 'off', 'react/jsx-key': 'error', + 'react/jsx-max-depth': 'off', 'react/jsx-no-bind': 'off', 'react/jsx-no-comment-textnodes': 'error', 'react/jsx-no-duplicate-props': 'error', @@ -57,13 +67,16 @@ module.exports = { 'react/jsx-no-script-url': 'error', 'react/jsx-no-target-blank': 'error', 'react/jsx-no-undef': 'error', - 'react/jsx-props-no-spreading': 'off', + 'react/jsx-no-useless-fragment': 'warn', 'react/jsx-pascal-case': 'error', + 'react/jsx-props-no-spreading': 'off', + 'react/jsx-sort-default-props': 'off', 'react/jsx-sort-props': 'off', 'react/jsx-uses-react': 'error', 'react/jsx-uses-vars': 'error', - 'react/no-array-index-key': 'off', // sometimes you don't care about the issues or they don't apply + 'react/no-access-state-in-setstate': 'error', 'react/no-adjacent-inline-elements': 'warn', + 'react/no-array-index-key': 'off', // sometimes you don't care about the issues or they don't apply 'react/no-children-prop': 'off', 'react/no-danger': 'off', 'react/no-danger-with-children': 'error', @@ -74,16 +87,21 @@ module.exports = { 'react/no-find-dom-node': 'error', 'react/no-is-mounted': 'error', 'react/no-multi-comp': 'off', + 'react/no-redundant-should-component-update': 'error', 'react/no-render-return-value': 'error', 'react/no-set-state': 'off', 'react/no-string-refs': 'error', + 'react/no-this-in-sfc': 'error', + 'react/no-typos': 'error', 'react/no-unescaped-entities': 'warn', 'react/no-unknown-property': 'error', + 'react/no-unsafe': 'warn', // if you need it there should be a comment explaining why 'react/no-unused-prop-types': 'error', + 'react/no-unused-state': 'error', 'react/no-will-update-set-state': 'error', 'react/prefer-es6-class': 'off', - 'react/prefer-stateless-function': 'off', 'react/prefer-read-only-props': 'off', + 'react/prefer-stateless-function': 'off', 'react/prop-types': 'error', 'react/react-in-jsx-scope': 'error', 'react/require-default-props': 'off', // sometimes the default value is undefined so that's fine... @@ -96,24 +114,6 @@ module.exports = { 'react/static-property-placement': 'off', 'react/style-prop-object': 'error', 'react/void-dom-elements-no-children': 'error', - 'react/default-props-match-prop-types': 'error', - 'react/jsx-curly-brace-presence': [ - 'warn', - {props: 'never', children: 'ignore'}, - ], - 'react/no-access-state-in-setstate': 'error', - 'react/no-redundant-should-component-update': 'error', - 'react/no-this-in-sfc': 'error', - 'react/no-typos': 'error', - 'react/no-unsafe': 'warn', // if you need it there should be a comment explaining why - 'react/no-unused-state': 'error', - 'react/boolean-prop-naming': 'off', - 'react/button-has-type': 'off', - 'react/destructuring-assignment': 'off', - 'react/forbid-dom-props': 'off', - 'react/jsx-max-depth': 'off', - 'react/jsx-sort-default-props': 'off', - 'react/jsx-no-useless-fragment': 'warn', 'react-hooks/exhaustive-deps': 'warn', 'react-hooks/rules-of-hooks': 'error', diff --git a/stylistic.js b/stylistic.js index af8a916..45bb438 100644 --- a/stylistic.js +++ b/stylistic.js @@ -66,7 +66,6 @@ module.exports = { 'no-array-constructor': 'off', '@typescript-eslint/no-array-constructor': 'error', - // variables 'init-declarations': 'off', '@typescript-eslint/init-declarations': 'off', @@ -80,6 +79,7 @@ module.exports = { '@typescript-eslint/member-delimiter-style': 'off', '@typescript-eslint/member-ordering': 'off', '@typescript-eslint/method-signature-style': 'off', + '@typescript-eslint/naming-convention': 'off', '@typescript-eslint/no-confusing-non-null-assertion': 'off', // prettier reformats their "correct" example anyway 🤷‍♂️ '@typescript-eslint/no-extra-non-null-assertion': 'error', '@typescript-eslint/no-non-null-assertion': 'error', @@ -88,7 +88,6 @@ module.exports = { '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn', '@typescript-eslint/prefer-for-of': 'off', // I prefer for of, but I don't want to lint for it '@typescript-eslint/typedef': 'off', - '@typescript-eslint/naming-convention': 'off', }, }, ],