microsoft / microsoft/TypeScript
Investigate implicit excludes
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Today, TypeScript will implicitly set exclude to ./node_modules and something like .*/**/* to avoid dot files.
Unfortunately, there are two problems I believe I've found from chatting with users.
First, users often end up setting exclude which overrides the defaults. This often means that users accidentally over-include files, and that can cause performance issues.
Next, these defaults don't work out well enough, and end up going a bit off the rails in certain scenarios. For example, consider the following .js monorepo.
packages
+- package-aaa
| +- node_modules <- the cute tiny 10MB node_modules
|
+- jsconfig.json
+- node_modules <- the slightly bigger 10GB node_modules
shared by each package
Notice that jsconfig.json or not, one of these node_modules is going to be crawled through unless exclude is set appropriately. And regardless of whether exclude is implicitly or explicitly on, it's usually wrong. In this case, it should (probably) be **/node_modules/**/*. For example, check out https://github.com/IBM/report-toolkit/pull/44/files
What I'm suggesting is to harden exclude to always contain the following paths regardless of whether exclude is set.
**/node_modules/**/*.*/**
To disable this, users will have to turn off a setting like enableImplicitExcludePatterns.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the .js monorepo layout described in the issue, comparing behavior with and without jsconfig.json and with an explicit exclude. Investigate how the current implicit exclude behavior handles both node_modules locations and dot files. Done means establishing an agreed approach for enforcing or disabling the proposed patterns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100