-
Notifications
You must be signed in to change notification settings - Fork 153
@ErikBrendel
Description
Have you read the Troubleshooting section?
Yes
Plugin version
7.6.6
ESLint version
9.33.0
Node.js version
24.2.0
Bug description
Starting with version 7.6.4, the following code snippet gets flagged by the no-node-access rule, even though it is unrelated to node access
import { dispatch, select } from "@wordpress/data" const selectMyPluginReduxStore = () => select("my-plugin/foo")
Steps to reproduce
see above
Error output/screenshots
warning Avoid direct Node access. Prefer using the methods from Testing Library testing-library/no-node-access
ESLint configuration
Expand
import eslint from "@eslint/js" import prettier from "eslint-config-prettier" import eslintImport from "eslint-plugin-import" import reactPlugin from "eslint-plugin-react" import reactHooksPlugin from "eslint-plugin-react-hooks" import simpleImportSort from "eslint-plugin-simple-import-sort"; import testingLibrary from "eslint-plugin-testing-library" import unusedImports from "eslint-plugin-unused-imports" import globals from "globals" import tseslint from "typescript-eslint" // https://eslint.org/blog/2022/08/new-config-system-part-2/#goodbye-extends%2C-hello-flat-cascade export default tseslint.config( { ignores: ["dist", "node_modules"] }, eslint.configs.recommended, { languageOptions: { globals: { ...globals.browser, ...globals.jest, }, }, }, { rules: prettier.rules }, ...tseslint.configs.recommended, { rules: { "@typescript-eslint/no-unused-vars": "off", // taken care of by unused-imports "@typescript-eslint/no-namespace": "off", // sometimes needed for type augmentation "@typescript-eslint/no-explicit-any": "off", // too strict }, }, { plugins: { "simple-import-sort": simpleImportSort, "import": eslintImport, }, rules: { "simple-import-sort/imports": "error", "simple-import-sort/exports": "error", "import/first": "error", "import/newline-after-import": "error", "import/no-duplicates": "error" }, }, { plugins: { "unused-imports": unusedImports, }, rules: { "unused-imports/no-unused-imports": "warn", "unused-imports/no-unused-vars": [ "off", // TODO maybe enable as a warning again sometime? { varsIgnorePattern: "^_", argsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_", }, ], }, }, reactPlugin.configs.flat.recommended, reactPlugin.configs.flat["jsx-runtime"], { settings: { react: { version: "detect" } }, rules: { "react/no-unescaped-entities": "off", // check that all props that are defined are also used "react/no-unused-prop-types": "error", }, }, { plugins: { "react-hooks": reactHooksPlugin }, rules: { ...reactHooksPlugin.configs.recommended.rules, "react-hooks/exhaustive-deps": "off", // too strict and annoying, maybe we can enable again after cleanup }, }, { plugins: { "testing-library": testingLibrary, }, rules: { // see also: https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-user-event.md#appendix "testing-library/prefer-user-event": "warn", "testing-library/no-node-access": "warn", "testing-library/no-container": "warn", }, }, { files: ["**/*.js", "**/*.cjs", "**/*.mjs"], rules: { "no-undef": "off", }, }, )
Rule(s) affected
no-node-access
Anything else?
No response
Do you want to submit a pull request to fix this bug?
No