Closed
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
import * as espree from 'espree';
import eslint from '@eslint/js';
import tseslintA from 'typescript-eslint';
export default tseslintA.config(
eslint.configs.recommended,
...tseslintA.configs.recommendedTypeChecked,
{
files: ['index.ts'],
languageOptions: {
parser: espree,
parserOptions: {
EXPERIMENTAL_useProjectService: true,
}
}
}
);
ESLint Config
No response
tsconfig
No response
Expected Result
ESLint doesn't always know the parserName
provided in rule contexts:
* @param {string | undefined} parserName The name of the parser in the config
lintingProblems = runRules(
sourceCode,
configuredRules,
ruleId => getRuleFromConfig(ruleId, config),
void 0,
Actual Result
...but we define it as:
typescript-eslint/packages/utils/src/ts-eslint/Rule.ts
Lines 196 to 199 in c322099
And now we have this unfortunate stdout bug - note the Parser: undefined
:
Error: Error while loading rule '@typescript-eslint/await-thenable': 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/index.ts
Additional Info
I'll file an ESLint issue soon asking that ESLint tries to glean that parser name if possible. The espree
module exports a name = 'espree'
that can be useful.
Edit: eslint/eslint#18645
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
7.15.0 |
@typescript-eslint/parser |
7.15.0 |
@typescript-eslint/utils |
7.15.0 |
ESLint |
8.6.0 |
💖