Repository navigation
fix(lint): decide the TypeScript 7 parser from every TypeScript in the repository — 3.9.2 - #333
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
3.9.0 (#324/#325) installs procoder's own typescript-eslint beside TypeScript 6 when the project's TypeScript is past
tsESLintMaxMajor, because npm refuses typescript-eslint into a TS 7 project.TypescriptEslintFor(root)decided that fromroot/node_modules/typescriptonly.In a repo laid out like Kuvryn Orbit (Go backend at the root, the app in
web/with TypeScript 7.0.2 atweb/node_modules/typescript, nothing at the root)doctorreportedGAP typescript-eslint (repo) missing ... manual: npm i -D typescript-eslint, andinitwould run the project-local install npm rejects with ERESOLVE.resolvedTSESLinthad the same root-only view, so the owned copy was never resolved for the repo either.Fix
anyTSPastRange(root)walks the repo (not intonode_modulesor dot directories, depth-bounded) for any installed TypeScript past the range. Any such location selectsTypescriptEslintTS7.TypescriptEslintFor(doctor, init, tools via cmd/procoder) andresolvedTSESLint(doctor, tools.Resolve) use it.tsESLintEntryalready resolved per file (tsMajorwalks up from the file, soweb/src/a.tsfindsweb/node_modules/typescript).lintTSBaselinebuilt one config fromfiles[0]only; it now probes for a file past the range, so a mixed run uses the owned parser.Test
TestTypescriptInASubdirectoryDecidesTheParser(internal/lint/ts7_test.go): TS 7 only underweb/, TS 7 beside a TS 5 location, and TS 6 in a subdirectory. Failed on the old code (all three assertions on init choice, doctor resolution), passes now.Not covered by a new test: the
lintTSBaselinemixed-files probe. The full suite passed exceptTestSessionStartStaysInsideTheBudget, a 3s timing budget that tripped while the machine was loaded and passed on rerun.