Repository navigation
Conversation
paperwork used the extension without the dot as the type, and there is no detective for mts or cts, so these files always had no dependencies. Map both to ts. .cts files are CommonJS, so ts.mixedImports defaults to true for them and require() calls are found. Fixes dependents#167
Author
|
Friendly ping when you have time. Is there anything you'd like changed here? |
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.
Fixes #167.
paperwork()turns the extension into the type by stripping the dot, so.mtsand.ctsbecamemtsandcts, whichgetDetectivedoes not know. No detective ran and these files always returned[](so dependency-tree and madge saw no dependencies).Now:
.mtsmaps tots, the same as.ts. Options underts(likeskipTypeImports) apply..ctsmaps totstoo. Because.ctsfiles are CommonJS,ts.mixedImportsdefaults totruefor them, soconst x = require('./x.cjs')is found (this is what the issue expects forc.cts). Passingts: { mixedImports: false }turns that off. If you would rather keep.ctsexactly like.ts(norequire()by default), I can drop that part.The if/else chain became a
switch, because xo'sunicorn/prefer-switchasks for one once there are more branches. Behavior for the other extensions is the same. The README line on extension mapping is updated.Tests: 4 new paperwork tests with
.mts/.ctsfixtures (all fail onmain).npm test(xo, type check, vitest: 57 tests) passes.