Configs: Switch name verbosity of recommended and recommended-requiring-type-checking #6018
Replies: 3 comments
-
I disagreeβ"linting with type-checking" is not easy to teach. "recommended" is a universal config name across plugins. If it's the first time I start using some plugin, turning on "recommended" will be the very first thing I do when trying it outβeven before I start reading documentation. Instantly running into errors about misconfigured projects is not good UX. (Some people don't even read documentation at all!) On the other hand, I'm still convinced that type-aware linting is not universal practice, maybe not even the majority. "recommended-requiring-type-checking" is a next-level option, not a starter one. |
Beta Was this translation helpful? Give feedback.
-
That is bad behavior. You and they should not work that way. π . Please read docs? Keeping typed rules out of the recommended ruleset seriously limits what this plugin is able to provide out-of-the-box. If people use the plugin only for the basic needs, they're missing out on the most powerful & useful rules. IMO it's better for the plugin to give an informative error explaining how to fix a user's vague guesses at the right configuration. Then, the user is forced to read the docs and set up the tool properly.
This is bad (as in: I agree, that's how the world uses the plugin, and we should change that). The plugin should not be expected to run that way π. Type-aware linting -especially once the main performance issues are mitigated- is the best way to run the plugin. That's why we recommend it. |
Beta Was this translation helpful? Give feedback.
-
I love this idea in theory - the issue is that it's going to be a major breaking change for most of our users - which is difficult to stomach because of how much effort it would take to fix. Either people need to update their config to change their recommended configs around, or they need to figure out how to configure type-aware linting. Either way it would probably force a lot of people to stay on the old version for a long while. I think people don't use type-aware linting for a few reasons:
This issue specifically addresses (1), but I think before we do that ideally we need a solution for (2), (3) and (4). (2) config painsThe painpoint of (2) is generally two things:
We could actually fix both of these if we implement an automatic search algorithm for tsconfigs (#101). I believe VSCode (or is it the ts LSP?) has something like this already. In a nutshell: when you open a file, the system will walk up the tree to find the nearest tsconfig which includes the file and use that. (3) performanceI don't know if there is anything we can really do here because we have an absolute lower-bound of the build time for the project. Right now we rely upon a full build of the project before we start linting. I wonder if TS has a mechanism to let us do lazy builds (i.e. here's a file - just build its dep graph and absolutely no more). Maybe that sort of optimisation would require something like microsoft/TypeScript#47947? Also we've never done any concerted performance profiling effort on the tooling to find hotspots / problems. It's possible that we waste time redoing things unnecessarily. For example a while ago Ben/James found we were wasting a lot of time due to our use of incremental build APIs. If TS got faster, we would to... eg microsoft/TypeScript#30235 would help. Though we would need eslint/rfcs#87 to support that world. Or perhaps something like (4) OOMsSadly TS isn't really made for having multiple programs in the same thread simultaneously like we do. I think vscode gets away with it by either (a) one worker thread per tsconfig or (b) lazy type computation. I documented this problem in depth here: #1192 (comment) Side note that (3) and (4) would potentially be fixed by #4183. Or rather less fixed and more worked-around. (a) Isolate each tsconfig into a thread = no more OOMs (b) typecheck in parallel = faster perf. |
Beta Was this translation helpful? Give feedback.
-
Before You File a Proposal Please Confirm You Have Done The Following...
Description
We recommend most small-to-medium-sized projects (defined as projects where the cost of the type checker on linting is not significant) use "recommended requiring type checking" (https://typescript-eslint.io/docs/linting/configs):
But, in my experience, most projects haven't been enabling it - even with our new config docs. Users are accustomed to enabling exactly one "recommended" preset per plugin.
Proposal: let's breaking change switch the names so that "recommended" includes typed rules and "recommended without type checking does not?
recommended
recommended-without-type-checking
recommended-without-type-checking
recommended
Impacted Configurations
plugin:@typescript-eslint/recommended
plugin:@typescript-eslint/recommended-requiring-type-checking
Additional Info
If we do this, we'll need to hold users' hands through the migration. We'll want to at least:
parserOptions.project
if it doesn't yet existrecommended
torecommended-without-type-checking
parserOptions.project
more informative & link to that guideBeta Was this translation helpful? Give feedback.
All reactions