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
It's not unheard of for folks to setparserOptions.project
to a different config file than a TSConfig. For example, someone could easily accidentally do:
parserOptions:{project:'eslint.config.js',}
...at which point their config would give a lovely spew like:
/Users/josh/repos/repros/index.ts 0:0 error Parsing error: eslint.config.js(1,1): error TS1327: String literal with double quotes expected.eslint.config.js(1,8): error TS1328: Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.eslint.config.js(1,15): error TS1136: Property assignment expected.eslint.config.js(1,32): error TS1328: Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.eslint.config.js(2,1): error TS1327: String literal with double quotes expected.eslint.config.js(2,8): error TS1328: Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.eslint.config.js(2,17): error TS1136: Property assignment expected.eslint.config.js(2,41): error TS1328: Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.eslint.config.js(4,1): error TS1327: String literal with double quotes expected.eslint.config.js(4,7): error TS1328: Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.eslint.config.js(4,8): error TS1327: String literal with double quotes expected.eslint.config.js(4,16): error TS1328: Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal
Yuck.
Proposal: ifparserOptions.project
is set to something that's not a valid TSConfig, how about the tooling give a specialized error message?
Vaguely:
/Users/josh/repos/repros/index.ts 0:0 error Parsing error: Unable to load parserOptions.project: "eslint.config.js" as a TSConfig. Is this a valid JSON(C) TSConfig file?See https://typescript-eslint.io/getting-started/typed-linting for information on typed linting.
Additional Info
Ideated out of this Discord thread:https://discord.com/channels/1026804805894672454/1317907420403732571
💖