eslint-config
eslint-config copied to clipboard
`ts/consistent-type-imports` "You have used a rule which requires parserServices to be generated."
Describe the bug
I'm having the same as https://github.com/antfu/eslint-config/issues/372 when I try to change this config:
import antfu from '@antfu/eslint-config';
export default antfu({
rules: {
- 'ts/consistent-type-imports': 'off',
+ 'ts/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }],
'ts/consistent-type-definitions': ['error', 'type'],
},
});
I assume that this is happening because the rule is being configured in the global config instead of in a TS override… but that doesn't explain why the following ts/consistent-type-definitions
works fine.
Oops! Something went wrong! :(
ESLint: 9.8.0
Error: Error while loading rule 'ts/consistent-type-imports': 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 ./tsconfig.json
at throwError (./node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:39:11)
at getParserServices (./node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:20:9)
at create (./node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js:85:68)
at Object.create (./node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:31:20)
at createRuleListeners (./node_modules/eslint/lib/linter/linter.js:977:21)
at ./node_modules/eslint/lib/linter/linter.js:1108:84
at Array.forEach (<anonymous>)
at runRules (./node_modules/eslint/lib/linter/linter.js:1039:34)
at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (./node_modules/eslint/lib/linter/linter.js:1947:31)
at Linter._verifyWithFlatConfigArray (./node_modules/eslint/lib/linter/linter.js:2086:21)
Reproduction
Config pasted above
System Info
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Pro
Shell: 3.7.1 - /opt/homebrew/bin/fish
Binaries:
Node: 22.3.0 - /usr/local/bin/node
npm: 10.8.1 - /usr/local/bin/npm
Latest versions:
"@antfu/eslint-config": "^2.24.0",
"eslint": "^9.8.0",
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a minimal reproducible of the bug.
Contributions
- [ ] I am willing to submit a PR to fix this issue
- [ ] I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)