Skip to content

fix(files-matcher): build patterns from the normalized file spec - #137

Open
NotAFlightRisk wants to merge 2 commits into
privatenumber:masterfrom
NotAFlightRisk:fix/files-matcher-trailing-slash
Open

fix(files-matcher): build patterns from the normalized file spec#137
NotAFlightRisk wants to merge 2 commits into
privatenumber:masterfrom
NotAFlightRisk:fix/files-matcher-trailing-slash

Conversation

@NotAFlightRisk

@NotAFlightRisk NotAFlightRisk commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

I had exclude: ["dist/"] in a tsconfig and createFilesMatcher still returned a config for dist/index.d.ts, where tsc --listFiles on the same project doesnt list it. outDir: "dist/" goes the same way.

Its the trailing slash. tsc normalizes a spec into path components before building the pattern so the slash stops existing, and get-tsconfig builds off the raw string instead. Exclude patterns already append ($|/) to prune a directory's subtree, so with the spec's own slash in front of that the pattern ends up wanting two. Goes wrong the other way as well - files: ["index.ts/"] drops a root file tsc does pick up.

And there's a second fix here too, because the first one cant go in without it. tsc drops an include ending in ** (src/** is TS5010) while the matcher reads it as everything under src. Leave it and src/**/ goes from matching nothing to matching the lot. Both rules sit within ten lines of the one isImplicitGlobPattern already came from.

Most of the +155 is tests, the source change is 16 lines. Same on 4.14.3 and 5.0.0-beta.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant