Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint v9 support? #18

Open
karlhorky opened this issue Apr 9, 2024 · 1 comment · May be fixed by #19
Open

ESLint v9 support? #18

karlhorky opened this issue Apr 9, 2024 · 1 comment · May be fixed by #19

Comments

@karlhorky
Copy link
Contributor

karlhorky commented Apr 9, 2024

Hi @hluisson, hope things are good with you!

Running the Quickstart setup for typescript-eslint works with ESLint v9, but adding eslint-plugin-jsx-expressions along with the languageOptions.parserOptions config afterwards leads to an error:

➜  a pnpm eslint . --max-warnings 0                   

Oops! Something went wrong! :(

ESLint: 9.0.0

Error: Error while loading rule 'jsx-expressions/strict-logical-expressions': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.
Occurred while linting /Users/k/p/a/eslint.config.js
    at throwError (/Users/k/p/a/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:39:11)
    at Object.getParserServices (/Users/k/p/a/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:23:9)
    at create (/Users/k/p/a/node_modules/.pnpm/[email protected]_@[email protected][email protected]_typescript@5_psweyfgckaeztdobw6zk24wuua/node_modules/eslint-plugin-jsx-expressions/dist/rules/strict-logical-expressions.js:60:52)
    at Object.create (/Users/k/p/a/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:38:20)
    at createRuleListeners (/Users/k/p/a/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/linter.js:1003:21)
    at /Users/k/p/a/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/linter.js:1129:84
    at Array.forEach (<anonymous>)
    at runRules (/Users/k/p/a/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/linter.js:1061:34)
    at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (/Users/k/p/a/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/linter.js:1910:31)
    at Linter._verifyWithFlatConfigArray (/Users/k/p/a/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/linter/linter.js:2046:21)

Config (ESLint Flat Config):

eslint.config.js

// @ts-check

import eslint from '@eslint/js';
import jsxExpressions from 'eslint-plugin-jsx-expressions';
import tseslint from 'typescript-eslint';

export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.recommendedTypeChecked,
  {
    languageOptions: {
      parserOptions: {
        project: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
  {
    plugins: { 'jsx-expressions': jsxExpressions },
    rules: {
      'jsx-expressions/strict-logical-expressions': 'error',
    },
  },
);

Downgrading to ESLint v8 ([email protected]) resolves the issue (1 error is expected):

$ pnpm i
Packages: +28 -18
++++++++++++++++++++++++++++------------------
Progress: resolved 140, reused 140, downloaded 0, added 28, done
The following dependencies have build scripts that were ignored: 

devDependencies:
- @eslint/js 9.0.0
+ @eslint/js 8.57.0 (9.0.0 is available)
- eslint 9.0.0
+ eslint 8.57.0 (9.0.0 is available)

 WARN  Issues with peer dependencies found
.
└─┬ eslint-plugin-jsx-expressions 1.3.2
  └── ✕ unmet peer @typescript-eslint/parser@"^4.0.0 || ^5.0.0 || ^6.0.0": found 7.6.0 in typescript-eslint

Done in 1.1s
$ pnpm eslint . --max-warnings 0

/Users/k/p/repro-eslint-plugin-jsx-expressions-eslint-v9-error/index.ts
  1:7  error  'a' is assigned a value but never used  @typescript-eslint/no-unused-vars

✖ 1 problems (1 errors, 0 warnings)

Reproduction:

cc @JoshuaKGoldberg

@JoshuaKGoldberg
Copy link

JoshuaKGoldberg commented Apr 24, 2024

This should be fixed by #17, I think. It was closed :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants