Skip to content

Bug (v8): .js files not found with parserOptions.project set to tsconfig.eslint.json including **/*.js #9749

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

Closed
4 tasks done
JoshuaKGoldberg opened this issue Aug 7, 2024 · 11 comments
Labels
bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. triage Waiting for team members to take a look

Comments

@JoshuaKGoldberg
Copy link
Member

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

Coming over from maxnowack/signaldb#817: with v7, npm run lint passes in that repository. But when upgrading to v8:

/Users/josh/repos/signaldb/.eslintrc.js
  0:0  error  Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): .eslintrc.js

/Users/josh/repos/signaldb/commitlint.config.js
  0:0  error  Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): commitlint.config.js

/Users/josh/repos/signaldb/examples/appwrite/next.config.js
  0:0  error  Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): examples/appwrite/next.config.js

/Users/josh/repos/signaldb/examples/firebase/next.config.js
  0:0  error  Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): examples/firebase/next.config.js

/Users/josh/repos/signaldb/examples/replication-http/next.config.js
  0:0  error  Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): examples/replication-http/next.config.js

/Users/josh/repos/signaldb/examples/rxdb/next.config.js
  0:0  error  Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): examples/rxdb/next.config.js

/Users/josh/repos/signaldb/examples/supabase/next.config.js
  0:0  error  Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): examples/supabase/next.config.js

...despite parserOptions.project: './tsconfig.eslint.json' explicitly having include: ["**/*.js"] (among other entries).

Reproduction Repository Link

https://github.com/maxnowack/signaldb/tree/ab50bdeb84dbcc3ce6241b1ac53d239eef6d08d2

Repro Steps

  1. clone the repo
  2. npm install
  3. npm run lint

Versions

package version
@typescript-eslint/eslint-plugin 8.0.1
@typescript-eslint/parser 8.0.1
TypeScript 5.5.4
ESLint 8.57.0

💖

@JoshuaKGoldberg JoshuaKGoldberg added bug Something isn't working triage Waiting for team members to take a look labels Aug 7, 2024
@bradzacher
Copy link
Member

despite parserOptions.project: './tsconfig.eslint.json' explicitly having include: ["**/*.js"]

It doesn't have allowJs or checkJs though. So I think TS ignores the JS files from the glob.

@JoshuaKGoldberg
Copy link
Member Author

...which brings up the question, why was this passing in v7? What changed?

@bradzacher
Copy link
Member

v7.18.0...v8.0.1

IDK we can poke and see what might have caused it

@bradzacher
Copy link
Member

we enabled single run inference by default -- maybe that changed their lint run?

@gallayl
Copy link

gallayl commented Aug 7, 2024

I also have a similar issue here
The difference is that the errored files are explicitly listed in my tsconfig

@jessekrubin
Copy link

jessekrubin commented Aug 8, 2024

I AM NOT THE ONLY ONE! THIS WAS DRIVING ME BANANAS!

I have this problem using both the classic project and new fancy projectService config opts

I am experiencing it with (PROJROOT)/*.config.ts files. the files are 100% in my tsconfig. The problem goes away if I take the EXACT same config and rename it to tsconfig.json, but if I use tsconfig.lint.json/tsconfig.eslint.json (with the same exact eslint settings except for the project/tsconfig path) I get 0:0 error Parsing error: ~/projthingy/yet-another-stupid-config-file.config.ts was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject

@JoshuaKGoldberg
Copy link
Member Author

The problem goes away if I take the EXACT same config and rename it to tsconfig.json

Aha! For parserOptions.projectService, there's your issue. When we say "the same logic as your editor", we mean it only picks up tsconfig.json files. This is something we should put in the FAQs (linking: #9753). Quite a few folks are getting tripped up by it; I don't think this is clear enough in the docs.

Btw, for the project service, the only way to load in a file other than that is the allowDefaultProject & defaultProject options. Those only apply for "out-of-project" files (those not in a tsconfig.json). These are the things mentioned later down in https://typescript-eslint.io/blog/announcing-typescript-eslint-v8#project-service.

@jessekrubin
Copy link

@JoshuaKGoldberg Aha back at ya! That does make sense (despite being super tired — dog was bruffing all night at the neighborhood).

What if I want do not include stuff in my tsconfig.json and it is my primary “build” config? I have a million “tsconfig.eslint.json” files and flip flopping my build setups around sounds annoying. Does projectService grep around for adjacent tsconfig looking things?

@JoshuaKGoldberg
Copy link
Member Author

Then your best bet is to stick with parserOptions.project. Which is another good FAQ to note for #9753. If you're using tsconfig.jsons for building in a way that conflicts with intellisense then parserOptions.project will give you the fine-grained control you're looking for.

Anyway, this specific issue was meant to be for parserOptions.project in the first place, so I'd say if you have more issues there it'd be good to file a new issue or discussion.

@jessekrubin
Copy link

Sounds good to me! Thanks for your speedy responses. I guess moving to using “tsconfig.build.json” isn’t a terrible thing.

@JoshuaKGoldberg
Copy link
Member Author

Ok! Added a note to #9753 (comment) that this is an FAQ. Thanks all!

@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2024
@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Aug 27, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. triage Waiting for team members to take a look
Projects
None yet
Development

No branches or pull requests

4 participants