Recognize .mts and .cts TypeScript modules#12
Open
shashwat4543 wants to merge 4 commits into
Open
Conversation
Removed redundant issue description and retained GitLab CI example.
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.
What changed
Source discovery now treats
.mtsand.ctsfiles as TypeScript sources, matching Node'smodern ESM/CJS TypeScript module extensions.
LANGUAGES[".mts"]andLANGUAGES[".cts"]nowmap to
"typescript", so existing TypeScript-aware rules (AG002, AG004, AG006, AG007, etc.)run against these files with no rule-level changes. No user-facing behavior changed for
already-supported extensions.
Threat model or motivation
Projects increasingly split TypeScript sources into
.mts(ESM) and.cts(CJS) files,especially for dual-published Node packages. Previously these were silently skipped during
discovery — meaning unsafe patterns (shell execution, unsafe fetch, missing tool validation,
etc.) inside those files produced no findings. This closes that discovery gap with no change
to trust boundaries or rule logic.
Validation
make checkpassesAdded
tests/test_discovery.py(parametrized over.mts/.cts):.mts/.ctsis scanned and detected (AG002)LANGUAGES[".mts"]/LANGUAGES[".cts"]equal"typescript"node_modules/) are still skipped.mts/.ctsfiles still respectmax_file_size_kbUpdated
CHANGELOG.mdunder[Unreleased]and removed the corresponding entry fromdocs/GOOD_FIRST_ISSUES.mdsince it's now implemented.Related issue
Closes #11