-
Notifications
You must be signed in to change notification settings - Fork 50.1k
Closed
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
eslint-plugin-react-hooks version: 6.0.0-rc.2 (latest RC at time of writing)
Steps To Reproduce
pnpm add --save-dev eslint [email protected]- Create
eslint.config.jswith"react-hooks/incompatible-library": "error",followingincompatible-librarydocs page by @poteto in Add new eslint rule reference docs reactjs/react.dev#7986 pnpm eslint .- Observe error
Could not find "incompatible-library" in plugin "react-hooks"💥 (more output below)
➜ workspace git:(main) ✗ pnpm eslint .
Oops! Something went wrong! :(
ESLint: 9.36.0
TypeError: Key "rules": Key "react-hooks/incompatible-library": Could not find "incompatible-library" in plugin "react-hooks".
at throwRuleNotFoundError (/project/workspace/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/config/config.js:100:16)
at Config.validateRulesConfig (/project/workspace/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/config/config.js:603:5)
at new Config (/project/workspace/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/config/config.js:484:9)
at [finalizeConfig] (/project/workspace/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/config/flat-config-array.js:212:10)
at FlatConfigArray.getConfigWithStatus (/project/workspace/node_modules/.pnpm/@[email protected]/node_modules/@eslint/config-array/dist/cjs/index.cjs:1404:55)
at FlatConfigArray.getConfig (/project/workspace/node_modules/.pnpm/@[email protected]/node_modules/@eslint/config-array/dist/cjs/index.cjs:1422:15)
at entryFilter (/project/workspace/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint-helpers.js:322:27)
at async NodeHfs.<anonymous> (file:///project/workspace/node_modules/.pnpm/@[email protected]/node_modules/@humanfs/core/src/hfs.js:574:24)
at async NodeHfs.walk (file:///project/workspace/node_modules/.pnpm/@[email protected]/node_modules/@humanfs/core/src/hfs.js:614:3)
at async globSearch (/project/workspace/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint-helpers.js:363:20)Link to code example: https://codesandbox.io/p/devbox/dr6nk2?file=%2Feslint.config.js%3A7%2C3
The current behavior
The react-hooks/incompatible-library rule is not found
The expected behavior
The react-hooks/incompatible-library rule is found and used
Additional details
The react-hooks/incompatible-library rule added in #34027 by @josephsavona is referenced here:
react/compiler/packages/babel-plugin-react-compiler/src/CompilerError.ts
Lines 956 to 980 in e08f53b
| case ErrorCategory.UseMemo: { | |
| return { | |
| category, | |
| severity: ErrorSeverity.Error, | |
| name: 'use-memo', | |
| description: | |
| 'Validates usage of the useMemo() hook against common mistakes. See [`useMemo()` docs](https://react.dev/reference/react/useMemo) for more information.', | |
| recommended: true, | |
| }; | |
| } | |
| case ErrorCategory.IncompatibleLibrary: { | |
| return { | |
| category, | |
| severity: ErrorSeverity.Warning, | |
| name: 'incompatible-library', | |
| description: | |
| 'Validates against usage of libraries which are incompatible with memoization (manual or automatic)', | |
| recommended: true, | |
| }; | |
| } | |
| default: { | |
| assertExhaustive(category, `Unsupported category ${category}`); | |
| } | |
| } | |
| } |
It appears as if this was not included in the published source of [email protected] on npm:
All other documented RC rules are present and can be found.
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug