Skip to content

[bug] Could not find "no-direct-set-state-in-use-layout-effect" in plugin "@eslint-react/hooks-extra" #1260

@mcibique

Description

@mcibique

Describe the bug

I upgraded to v2 and I see eslint throwing an error:

Oops! Something went wrong! :(

ESLint: 9.36.0

TypeError: Key "rules": Key "@eslint-react/hooks-extra/no-direct-set-state-in-use-layout-effect": Could not find "no-direct-set-state-in-use-layout-effect" in plugin "@eslint-react/hooks-extra".

It's because I'm using all config rules and the rule in the error message is still present in the preset.

I see that rule has been merged to another rule in 2.0.0 and it's no longer in the docs as well. Commenting the line out locally in node_modules/@eslint-react/eslint-plugin/dist/index.js fixed the issue for me.

Reproduction

  1. npm install --save-dev globals eslint @eslint/js @eslint-react/eslint-plugin
  2. touch index.js
  3. Create a minimal eslint.config.mjs will all rules
import eslintReact from "@eslint-react/eslint-plugin";
import { defineConfig } from "eslint/config";

export default defineConfig([
  {
    files: ["**/*.js", "**/*.jsx"],
    extends: [eslintReact.configs.all],
  },
]);
  1. npx eslint

Expected behavior

Eslint not throwing an error.

Platform and versions

Node: v22.15.1
@eslint-react/eslint-plugin: "2.0.5"

Stack trace

Oops! Something went wrong! :(

ESLint: 9.36.0

TypeError: Key "rules": Key "@eslint-react/hooks-extra/no-direct-set-state-in-use-layout-effect": Could not find "no-direct-set-state-in-use-layout-effect" in plugin "@eslint-react/hooks-extra".
    at throwRuleNotFoundError (/home/user/project/node_modules/eslint/lib/config/config.js:100:16)
    at Config.validateRulesConfig (/home/user/project/node_modules/eslint/lib/config/config.js:603:5)
    at new Config (/home/user/project/node_modules/eslint/lib/config/config.js:484:9)
    at [finalizeConfig] (/home/user/project/node_modules/eslint/lib/config/flat-config-array.js:212:10)
    at FlatConfigArray.getConfigWithStatus (/home/user/project/node_modules/@eslint/config-array/dist/cjs/index.cjs:1404:55)
    at FlatConfigArray.getConfig (/home/user/project/node_modules/@eslint/config-array/dist/cjs/index.cjs:1422:15)
    at entryFilter (/home/user/project/node_modules/eslint/lib/eslint/eslint-helpers.js:322:27)
    at async NodeHfs.<anonymous> (file:///home/user/project/node_modules/@humanfs/core/src/hfs.js:574:24)
    at async NodeHfs.walk (file:///home/user/project/node_modules/@humanfs/core/src/hfs.js:614:3)
    at async globSearch (/home/user/project/node_modules/eslint/lib/eslint/eslint-helpers.js:363:20)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: ReleasedThe issue has been releasedType: BugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions