Skip to content

Proposal of recommended config in eslint-plugin-react-hooks #16872

@maximandrews

Description

@maximandrews

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
If you are using eslint-plugin-react-hooks you need to put rules configuration manually. What if in the next version you will add some more rules?
Should everyone who use it after future release add all the new rules to config manually?

What is the expected behavior?
I propose instead of instructing on every new rule to create recommended config as in eslint-plugin-react, as follows:

export default {
  rules: {
    'rules-of-hooks': RuleOfHooks,
    'exhaustive-deps': ExhaustiveDeps
  },
  configs: {
    recommended: {
      plugins: [ 'react-hooks' ],
      parserOptions: {
        ecmaFeatures: { jsx: true }
      },
      rules: {
        'react-hooks/rules-of-hooks': 'error',
        'react-hooks/exhaustive-deps': 'warn'
      }
    }
  }
};

Also, to instruct to extend instead:

extends: [
  'eslint:recommended',
  'plugin:react/recommended',
  'plugin:react-hooks/recommended'
],

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions