Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
Before You File a Documentation Request Please Confirm You Have Done The Following...
- I have looked for existingopen or closed documentation requests that match my proposal.
- I haveread the FAQ and my problem is not listed.
Suggested Changes
Thetypescript-eslint
documentation (https://typescript-eslint.io/packages/typescript-eslint/) describes two basic use cases:
- Using the recommended rules:
tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended,);
- Fully customizing the rules:
tseslint.config({plugins:{"@typescript-eslint":tseslint.plugin,},languageOptions:{parser:tseslint.parser,parserOptions:{project:true,},},rules:{"@typescript-eslint/no-floating-promises":"error",},},);
These examples both work fine for me: I can either use the recommend rules OR fully customize my own set of rules.
But, there is no example that explains how to use the recommended rules while customizing a few of them. For example, I would like to use the recommended rules PLUS no-floating-promises=error. I cannot figure out how to. I have tried:
...tseslint.config({files:["**/*.ts","**/*.tsx"],extends:[eslint.configs.recommended, ...tseslint.configs.recommended],rules:{"@typescript-eslint/no-floating-promises":"error",},}),
Which gives me the error:
Error: Error while loading rule '@typescript-eslint/no-floating-promises': 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.
I've also tried:
[...tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended,{rules:{"@typescript-eslint/no-floating-promises":"error",},}),
Which does not enable the rule.
I have no mental model for whattseslint.config
is actually doing so I'm having trouble understand what should/shouldn't work here, but by specifying BOTH recommended configurations it looks like I got what I wanted:
tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended,{plugins:{"@typescript-eslint":tseslint.plugin,},languageOptions:{parser:tseslint.parser,parserOptions:{project:true,},},rules:{"@typescript-eslint/no-floating-promises":"error",},},)
If this is how you're meant to accomplish recommended config + customizations, it would be good to document it.
Thanks for listening!
Affected URL(s)
https://typescript-eslint.io/packages/typescript-eslint/
Additional Info
No response