reactjs / reactjs/react.dev

[Bug]: eslint-plugin-react-hooks documentation says that 2 rules are recommended and all others are opt-in but that's not true

Open
#8,066 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug: unconfirmed
Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

Summary

https://react.dev/reference/eslint-plugin-react-hooks says:

Starting in version 6.0, these rules are available to opt-in:
...

According to that page only exhaustive-deps and rules-of-hooks are recommended.

But if you look are the source code for 7.0, you can see that extending configs.flat.recommended will more or less enable ALL the rules, including the ones related to the compiler:

https://github.com/facebook/react/blob/4b3e662e4ce54eb54a8701c48a967cc84a389501/packages/eslint-plugin-react-hooks/src/index.ts#L49-L52

Either the documentation needs to be updated or there is a bug in eslint-plugin-react-hooks where the recommended flat configs enabled too many rules. I am not in a position to decide who is wrong here :).

Page

https://react.dev/reference/eslint-plugin-react-hooks

Details

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the eslint-plugin-react-hooks documentation at react.dev/reference/eslint-plugin-react-hooks with the referenced configuration in packages/eslint-plugin-react-hooks/src/index.ts around lines 49-52. Determine whether the recommended configuration or the documentation is inconsistent, then update the relevant source and verify that the documented rule behavior matches the configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript, react
Domain
documentation, tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.