microsoft / microsoft/TypeScript

Investigate implicit excludes

Offen
#35,121 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Domain: Performance
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das in der Issue beschriebene .js-Monorepo-Layout zu reproduzieren, und vergleiche das Verhalten mit und ohne jsconfig.json sowie mit einem expliziten exclude. Untersuche, wie das aktuelle implizite exclude-Verhalten sowohl mit node_modules-Speicherorten als auch mit Punktdateien umgeht. Erledigt ist die Aufgabe, wenn ein abgestimmter Ansatz für das Durchsetzen oder Deaktivieren der vorgeschlagenen Muster festgelegt wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.