Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
Relevant Package
typescript-estree
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
We should lock down this API to start with and widen it as needed.
In particular we know that the default project can and will cause perf issues if used incorrectly.
EG if it matches too many files it'll cause dramatic slowdowns.
Based on what @JoshuaKGoldberg has found - it'll create one new ts.Program
per file. This process is slow - but given the number of files is small then it shouldn't impact things too badly. If someone does something dumb like pass a glob like **/*.ts
to match their entire project then their run will be stupidly slow for no good reason.
In a nutshell - the motivation against this was the entire reason we moved away from "default programs" back in v2.0.0. Because people accidentally fell into the default program and their lint runs slowed to a crawl because of them.
We should do the following:
(1) ban obviously dumb globs like *
, **/*
, **/*.*
, etc. Essentially any glob that doesn't match the regex \w
should be banned with an explicit failure like
Unnecessarily wide globs are disallowed. If you have a usecase for them please file an issue in the typescript-eslint project.
(2) ban too many files matching the glob. We should pick a sensible default that we think won't noticably impact the run performance (say, 5 files) and if the lint run matches against more than that many files - we should explicitly fail like
{count}
files have matched the default project. Having many files run with the default project is known to cause performance issues and slow down your lint run.
Consider creating a separatetsconfig.json
to match these fileshttps://typescript-eslint.io/docs/link/to/guide/about/this/optimisation
.
If you're ok with slower lint runs then setparserOptions.iLikeSlowLintRunsAndICannotLie_DO_NOT_USE_THIS_OR_YOU_WILL_BE_FIRED
to an integer greater than{count}
Additional Info
No response