Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I havesearched for related issues and found none that match my proposal.
- I have searched thecurrent rule list and found no rules that match my proposal.
- I haveread the FAQ and my problem is not listed.
Relevant Package
typescript-estree
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
The current error message for files that ESLint attempts to lint but aren't included in any TSConfig is confusing and seemingly contradictory:
Parsing error: ESLint was configured to run on `<tsconfigRootDir>/sandbox\test.mjs` using `parserOptions.project`:- <tsconfigRootDir>/jsconfig.json- <tsconfigRootDir>/src\jsconfig.json...However, none of those TSConfigs include this file.Problem
The phrase "ESLint was configured to run on [file] usingparserOptions.project" is confusing because it sounds like the user explicitly configured ESLint to lint this file with those specific TSConfigs. In reality:
- ESLint's file inclusion rules determined the file should be linted
- The
parserOptions.projectsetting exists globally - None of the TSConfigs actually cover this file
This creates an apparent contradiction: "configured to run using X" followed by "but X doesn't include this file" makes it sound like the configuration is broken or nonsensical.
Solution
Consider rewording to make the two-step process clearer:
Parsing error: ESLint is attempting to lint `<tsconfigRootDir>/sandbox\test.mjs`, but this file is not included in any of the TSConfigs specified in `parserOptions.project`:- <tsconfigRootDir>/jsconfig.json- <tsconfigRootDir>/src\jsconfig.json...Either:- Exclude this file from linting (add it to `ignores`)- Add this file's location to one of the TSConfig's `include` patterns- Create a new TSConfig that includes this file and add it to `parserOptions.project`- Use a separate ESLint configuration for this file without type-aware lintingSee the typescript-eslint docs for more info: https://typescript-eslint.io/troubleshooting/typed-linting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-fileThis makes it clear that:
- ESLint wants to lint the file (for reasons separate from
parserOptions.project) - The type-checking feature requires TSConfig coverage
- There's a mismatch between these two things