jsx-eslint / eslint-plugin-react

React-specific linting rules for ESLint
MIT License
8.86k stars 2.75k forks source link

[Bug]: #3739

Closed aspizu closed 2 months ago

aspizu commented 2 months ago

Is there an existing issue for this?

Description Overview

[Error - 1:19:43 AM] An unexpected error occurred:
[Error - 1:19:43 AM] TypeError: context.getScope is not a function
Occurred while linting /home/aspizu/Documents/Projects/reproca/example/eslint.config.js:5
Rule: "react/no-string-refs"
    at Object.getParentES6Component (/home/aspizu/Documents/Projects/reproca/example/node_modules/eslint-plugin-react/lib/util/componentUtil.js:140:23)
    at isRefsUsage (/home/aspizu/Documents/Projects/reproca/example/node_modules/eslint-plugin-react/lib/rules/no-string-refs.js:52:24)
    at MemberExpression (/home/aspizu/Documents/Projects/reproca/example/node_modules/eslint-plugin-react/lib/rules/no-string-refs.js:101:13)
    at ruleErrorHandler (/home/aspizu/Documents/Projects/reproca/example/node_modules/eslint/lib/linter/linter.js:1145:48)
    at /home/aspizu/Documents/Projects/reproca/example/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/aspizu/Documents/Projects/reproca/example/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/aspizu/Documents/Projects/reproca/example/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/home/aspizu/Documents/Projects/reproca/example/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (/home/aspizu/Documents/Projects/reproca/example/node_modules/eslint/lib/linter/node-event-generator.js:340:14)

Expected Behavior

import eslint from "@eslint/js"
import reactRecommended from "eslint-plugin-react/configs/recommended.js"
import tseslint from "typescript-eslint"

export default tseslint.config(
    eslint.configs.all,
    ...tseslint.configs.all,
    {
        rules: {
            camelcase: "off",
            "@typescript-eslint/naming-convention": "off",
            "sort-keys": "off",
            "@typescript-eslint/no-unsafe-argument": "off",
            "sort-imports": "off",
            "@typescript-eslint/prefer-enum-initializers": "off",
            "func-style": ["error", "declaration"],
            "one-var": ["error", "never"],
            "@typescript-eslint/no-shadow": "off",
            "no-magic-numbers": "off",
            "@typescript-eslint/no-magic-numbers": "off",
            "@typescript-eslint/prefer-readonly-parameter-types": "off",
            "no-undefined": "off",
            "no-ternary": "off",
            "@typescript-eslint/explicit-function-return-type": "off",
            "no-return-await": "off",
            "@typescript-eslint/return-await": ["error", "always"],
            "no-void": "off"
        },
        languageOptions: {
            parserOptions: {
                EXPERIMENTAL_useProjectService: true
            }
        }
    },
    reactRecommended
)

eslint-plugin-react version

v7.34.1

eslint version

v9.0.0

node version

v10.5.2

ljharb commented 2 months ago

This isn't a bug; we're not compatible with eslint 9 yet, and so you simply can't upgrade to it until we are.

Duplicate of #3699.

aspizu commented 2 months ago

how is anyone supposed to know this? atleast put it in the readme.

ljharb commented 2 months ago

It’s in the peer deps, and it’s in the npm install output.