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

Bug: [v8.0.0-alpha.10] incorrect error message Parsing error: "parserOptions.programs" #9096

Open
4 tasks done
OlivierZal opened this issue May 14, 2024 · 1 comment
Open
4 tasks done
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Milestone

Comments

@OlivierZal
Copy link

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Issue Description

Bug discussed and confirmed by @JoshuaKGoldberg and @bradzacher.

Config working with typescript-eslint v7.9.0 does not work with v8.0.0-alpha.10, raising:

/Users/<...>/eslint.config.js
  0:0  error  Parsing error: "parserOptions.programs" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided program instance(s): eslint.config.js

although I don't use any home-made program.

Potential culprit: https://github.com/typescript-eslint/typescript-eslint/pull/8834/files

Reproduction Repository Link

https://github.com/OlivierZal/melcloud-api/blob/e118342a2ce16c49e41e145844bc318e344cfe52/eslint.config.js

Repro Steps

  1. git clone https://github.com/OlivierZal/melcloud-api
  2. git co e118342a2ce16c49e41e145844bc318e344cfe52
  3. eslint .
  4. npm i typescript-eslint@8.0.0-alpha.10 --force
  5. eslint .
  6. compare the 2 outputs (see attached screenshots: v7.9.0 vs v8.0.0-alpha)

v7
v8

Versions

package version
@typescript-eslint/eslint-plugin 8.0.0-alpha.10
TypeScript 5.4.5
ESLint 9.2.0
node 22.1.0
@OlivierZal OlivierZal added bug Something isn't working triage Waiting for maintainers to take a look labels May 14, 2024
@bradzacher
Copy link
Member

Actually I think the error message is wrong but the error itself is correct.

You have type-aware linting turned on:
https://github.com/OlivierZal/melcloud-api/blob/e118342a2ce16c49e41e145844bc318e344cfe52/eslint.config.js#L15

Then you are using ...tsEslint.configs.disableTypeChecked.rules to disable the type-aware rules
https://github.com/OlivierZal/melcloud-api/blob/e118342a2ce16c49e41e145844bc318e344cfe52/eslint.config.js#L244

However this is a misuse of the config because the config has more than just .rules - it also
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages%2Feslint-plugin%2Fsrc%2Fconfigs%2Fdisable-type-checked.ts#L11

So because you're misusing the config - you never disable type-aware parsing for JS files. You've disabled all the rules but the parser is still generating types for JS files. Hence the parser is erroring on a JS file because it's not included in a tsconfig.

Docs on correct use of the config
https://typescript-eslint.io/users/configs#disable-type-checked
Or alternately (as mentioned on discord) using the extends prop provided by our config util:
https://typescript-eslint.io/packages/typescript-eslint#flat-config-extends


So yeah - the message is wrong - it should say Parsing error: "parserOptions.projects" has been provided ...
But the error itself is correct.

@bradzacher bradzacher added package: typescript-estree Issues related to @typescript-eslint/typescript-estree accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels May 14, 2024
@bradzacher bradzacher changed the title Bug: [v8.0.0-alpha.10] Parsing error: "parserOptions.programs" Bug: [v8.0.0-alpha.10] incorrect error message Parsing error: "parserOptions.programs" May 14, 2024
@bradzacher bradzacher added this to the 8.0.0 milestone May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
Development

No branches or pull requests

2 participants