Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! feat: create core base for …
Browse files Browse the repository at this point in the history
…react/node/legacy lint configs
  • Loading branch information
Hotell committed Mar 16, 2022
1 parent a7b3207 commit 99c84db
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions packages/eslint-plugin/src/configs/react-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ const configHelpers = require('../utils/configHelpers');

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: [
// airbnb config doesn't exposes react and react-a11y as public config
// this is a temporary solution which will be addressed later
'eslint-config-airbnb/rules/react',
'eslint-config-airbnb/rules/react-a11y',
// Extended configs are applied in order, so these configs that turn other rules off should come last
'prettier',
],
plugins: ['jsx-a11y', 'react', 'react-hooks'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
pragma: 'React',
version: 'detect',
},
// copied from https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/rules/react.js#L575
propWrapperFunctions: [
'forbidExtraProps', // https://www.npmjs.com/package/airbnb-prop-types
'exact', // https://www.npmjs.com/package/prop-types-exact
'Object.freeze', // https://tc39.github.io/ecma262/#sec-object.freeze
],
},
rules: {
/**
* airbnb eslint rules
* - turn off airbnb rules that are re-set ub airbnb/react+react-a11y configs
*/
'no-underscore-dangle': 'off',
'class-methods-use-this': 'off',

/**
* react eslint rules
* @see https://github.com/yannickcr/eslint-plugin-react
Expand All @@ -36,6 +38,9 @@ module.exports = {
],
'react/no-string-refs': 'error',
'react/self-closing-comp': 'error',
// NOTE: following rules has been turned off to override `airbnb/rules/react`, which we don't use anymore
// TODO: needs to be checked against core react eslint plugin if we need those turn off explicitly
// @see https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/rules/react.js
'react/button-has-type': 'off',
'react/destructuring-assignment': 'off',
'react/forbid-prop-types': 'off',
Expand Down Expand Up @@ -82,6 +87,9 @@ module.exports = {
* @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
*/
'jsx-a11y/tabindex-no-positive': 'error',
// NOTE: following rules has been turned off to override `airbnb/rules/react-a11y`
// TODO: needs to be checked against core jsx-a11y eslint plugin if we need those turn off explicitly
// @see https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb/rules/react-a11y.js
'jsx-a11y/alt-text': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/aria-activedescendant-has-tabindex': 'off',
Expand Down

0 comments on commit 99c84db

Please sign in to comment.