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 Proposal Please Confirm You Have Done The Following...
- I havesearched for related issues and found none that match my proposal.
- I haveread the FAQ and my problem is not listed.
Description
The stylistic config includes thehttps://typescript-eslint.io/rules/consistent-generic-constructors/ rule, which (in it's default configuration) conflicts with the requirements of TS 5.5's newisolatedDeclarations mode.
In isolatedDeclarations mode, the following code is illegal:
export const s = new Set<string>();
giving an error: "Variable must have an explicit type annotation with --isolatedDeclarations."
TypeScript Playground
Whereas in ESLint, the opposite pattern is disallowed by theconsistent-generic-constructors
from the stylistic config:
export const s: Set<string> = new Set();
gives a different error: "The generic type arguments should be specified as part of the constructor type arguments."
ESLint Playground
Ideally, users using both the stylistic config and the isolatedDeclartions tsconfig option should have a less frustrating out-of-the-box experience. I think ESLint devs are better positioned to make the call on what that should look like, but I few options that I can think of would be:
- Turn off
consistent-generic-constructors
by default in the stylistic config, or - Change the default behavior of
consistent-generic-constructors
to avoid running on isolatedDeclarations projects, or - Change the default behavior to distinguish local and exported declarations so it can give errors that don't contradict the isolatedDeclarations ones.
Impacted Configurations
stylistic
Additional Info
No response