Open
Description
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.
Relevant Package
utils
Playground Link
No response
Repro Code
{}
ESLint Config
import * as parserJsonc from "jsonc-eslint-parser";
import tseslint from "typescript-eslint";
export default tseslint.config(
tseslint.configs.base,
{
files: ["**/package.json"],
languageOptions: {
parser: parserJsonc
}
},
{
languageOptions: {
parserOptions: {
project: true,
},
},
rules: {
"@typescript-eslint/consistent-type-assertions": "error"
}
},
);
tsconfig
Expected Result
getParserServices
should give a complaint saying that the parser is some other one, not @typescript-eslint/parser
.
Actual Result
> eslint package.json
Oops! Something went wrong! :(
ESLint: 8.57.0
Error: Error while loading rule '@typescript-eslint/consistent-type-assertions': 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.
Parser: undefined
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/josh/repos/repros/package.json
at throwError (/Users/josh/repos/repros/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:40:11)
at getParserServices (/Users/josh/repos/repros/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:20:9)
at create (/Users/josh/repos/repros/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-assertions.js:88:61)
at Object.create (/Users/josh/repos/repros/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:38:20)
at createRuleListeners (/Users/josh/repos/repros/node_modules/eslint/lib/linter/linter.js:895:21)
at /Users/josh/repos/repros/node_modules/eslint/lib/linter/linter.js:1066:110
at Array.forEach (<anonymous>)
at runRules (/Users/josh/repos/repros/node_modules/eslint/lib/linter/linter.js:1003:34)
at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (/Users/josh/repos/repros/node_modules/eslint/lib/linter/linter.js:1730:31)
at Linter._verifyWithFlatConfigArray (/Users/josh/repos/repros/node_modules/eslint/lib/linter/linter.js:1861:21)
Additional Info
See isolated repro: https://github.com/JoshuaKGoldberg/repros/tree/ts-eslint-unknown-parser-flat-config
Versions
package | version |
---|---|
typescript-eslint |
7.6.0 |
ESLint |
8.57.0 |
😩