Repository navigation
Conversation
The `max-lines` rule and the ratchet that freezes its suppressions both enumerated only `.ts`, `.tsx`, and `.mjs`. A contributor could therefore dodge the file-size budget by switching a module's extension to `.mts` or `.cts`: oxlint never applied `max-lines` to those files, and `collectCurrentSuppressions` never scanned them, so a new suppression in one would not have been caught either. Extend the oxlint override globs (300 for `.mts`/`.cts`, 800 for their test/spec variants) and the ratchet's `git ls-files` pattern to cover both extensions, so the rule and its ratchet apply uniformly across TypeScript file types. Tests cover `defaultLimitForPath` for the new extensions and `collectCurrentSuppressions` against a scratch git tree containing an `.mts` and a `.cts` suppression.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe Oxlint configuration now recognizes Priority: ⬇️ Low 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — verified the .mts/.cts gap is actually closed in both the linter config and the ratchet, and that the new tests fail without the fix.
.oxlintrc.jsonglobs widened —**/*.mts/**/*.ctsjoin the 300-linemax-linesoverride, and the test/spec override gains the four.mts/.ctstest/spec globs for its 800-line budget. That override is last inoverrides[], so it wins for test/spec files.- Ratchet extension list widened —
defaultLimitForPathnow recognizesmts|cts(test/spec → 800, plain → 300), andcollectCurrentSuppressionspasses*.mts/*.ctstogit ls-files, so a suppression added in either extension is collected against the baseline. - Tests added — new
defaultLimitForPathcases plus acollectCurrentSuppressionssuite that builds a scratch git repo and asserts.mts/.ctsdisables are found. Both are genuine: pre-change,defaultLimitForPath('a/b.test.mts')returned 300 andgit ls-filesomitted the two extensions.
I reproduced the behavior directly: a 500-line .mts/.cts now errors at 300, while 500-line .test.mts/.spec.cts pass at 800 (oxlint 1.80.0). pnpm test config/scripts/check-max-lines-ratchet.test.mjs (18 passed) and pnpm check:max-lines-ratchet (exit 0, 7 grandfathered) both pass. Only four tracked .mts/.cts files exist and none carries a disable, so the baseline is unaffected.
ℹ️ Extension-switch escape remains for .cjs/.js
This PR closes the loophole for the TypeScript family, but .mjs is the only JavaScript module extension with a budget (600 lines) — .cjs, .js, and .jsx have no max-lines override and are not scanned by the ratchet, so the same rename-to-dodge escape the PR describes still works there. That is pre-existing and may be deliberately out of scope for a TS-focused change; flagging only because the PR body's "switching an extension is no longer a way around the budget" reads as broader than what is fixed.
Technical details
# `.cjs`/`.js` remain uncapped
## Affected sites
- `.oxlintrc.json` overrides (`**/*.ts`/`.mts`/`.cts` → 300, `**/*.tsx` → 400, `**/*.mjs` → 600) — no entry covers `**/*.cjs`, `**/*.js`, or `**/*.jsx`.
- `config/scripts/check-max-lines-ratchet.mjs:99` — `git ls-files '*.ts' '*.tsx' '*.mts' '*.cts' '*.mjs'` omits `*.cjs`/`*.js`.
- Tracked examples: ~20 `.cjs` files under `config/scripts/` and `config/`, plus `mobile/*.js`, `native/windows-registry/index.js`.
## Required outcome
- Decide whether the gate is intentionally TypeScript-only. If so, the PR body's completeness claim is fine as prose but the asymmetry with `.mjs` (which is capped) is worth a comment. If the intent is to close the extension loophole generally, add the `*.cjs`/`*.js` equivalents to both the oxlint override and the ratchet's `git ls-files` list.
## Note
- Not a regression from this PR — the gap predates it. No change requested for this PR; this is a follow-up question.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
thanks , I creidted you on #22413 |
|
Big thanks! |

ELI5
The repository caps how long a source file may grow and fails CI when a new file goes over, but the cap only ever looked at
.ts,.tsx, and.mjsfiles. A file named.mtsor.ctswas invisible to both the linter rule and the ratchet that freezes its exceptions, so someone could move an oversized module to one of those extensions and the gate would stay green. This change makes both layers treat.mtsand.ctsthe same way they already treat.ts.What Changed
.oxlintrc.jsonnow lists**/*.mtsand**/*.ctsalongside**/*.tsin themax-linesoverride at 300 lines, and the test/spec override grows from four globs to eight so**/*.test.mts,**/*.test.cts,**/*.spec.mts, and**/*.spec.ctsget the same 800-line budget as their.tscounterparts.config/scripts/check-max-lines-ratchet.mjsextends thegit ls-filespattern from['*.ts', '*.tsx', '*.mjs']to['*.ts', '*.tsx', '*.mts', '*.cts', '*.mjs'], so a neweslint-disable max-linescomment inside an.mtsor.ctsfile is collected and compared against the baseline like any other file.defaultLimitForPathalso learns the two extensions, which keeps the function's answer consistent with the linter for any path it is asked about.The ratchet and the linter now agree on every TypeScript file type the repository actually ships, so switching an extension is no longer a way around the budget.
Why
The repository states the rule in
AGENTS.mdunder "Lint Rules: Do Not Disable Max Lines", andpnpm lintenforces it through two independent pieces: oxlint'smax-linesrule, andcheck:max-lines-ratchet, which freezes the set of files currently allowed to exceed the cap. Both pieces keyed off a hardcoded extension list. That list predates.mts/.ctsfiles being added to the tree, and nothing forced it to grow when they arrived.I confirmed the gap rather than inferring it. A generated 500-line
.mtsfile passesoxlint --config .oxlintrc.jsonwith zero errors, while an identical 500-line.tsfile fails withMaximum allowed is 300. The same file renamed.mtsreports nothing. That is the whole bug: the rule is correct, the file selection was not.I chose to fix the selection rather than add a separate
.mts-only rule, because a second rule would drift from the first. Extending the existing globs keeps one source of truth for what counts as a TypeScript file, and the ratchet's extension list now matches the linter's. The alternative I considered was scanning every tracked file and filtering by extension inside the script, but that would scan far more than needed and still leave oxlint's own glob list out of sync.Linked Issue
No issue was provided for this request. The gap is reproducible from the current
mainwith the two commands in the Testing section.Visual Proof
N/A — this is a lint configuration and a Node script, with no UI or interaction change.
Testing
I verified the failing behavior first, then the fix, then that nothing else moved.
defaultLimitForPath('a/b.test.mts')returned 300 instead of 800, andcollectCurrentSuppressionsreturned only the.tsentry from a scratch tree that also contained an.mtsand a.ctssuppression..mtspassedoxlintwith 0 errors before the change and fails withMaximum allowed is 300after it. The same holds for.cts.big.test.mtsand a 400-linebig.spec.ctsboth pass after the change, so the 800-line budget applies rather than the 300-line one.pnpm test config/scripts/check-max-lines-ratchet.test.mjs— 18 passed (16 existing, 2 new).pnpm testfor the neighbouring ratchets (check-ts-nocheck-ratchet,check-runtime-electron-ratchet) — 35 passed across the three files.pnpm check:max-lines-ratchet— exit 0, "7 grandfathered suppression(s), no new bypasses".oxlintbefore and after the config change — 42 errors both times, identical set, so the new globs introduced no new findings. Zeromax-lineserrors come from any existing.mtsor.ctsfile.pnpm tc:node,pnpm tc:cli,pnpm tc:web— 0 TypeScript errors each.oxfmt --checkon the three changed files — clean.lint-stagedon the staged files — exit 0.Platforms tested: Windows only for the local run. The change is pure file-extension matching with no platform branch, so macOS and Linux behave the same; CI covers all three.
AI Disclosure
ZCode with DeepSeek-V4.1-flash and GPT-5.6-Terra drafted the change, the tests, and this description. I reviewed the diff, reproduced the failure and the fix locally, and ran every command listed above before pushing.
Review
A quick self-review against the areas the contributing guide asks about.
Security: no change. The diff is a linter glob list, a Node script's
git ls-filesarguments, and a path-to-limit helper. No new input is parsed, no process is spawned, and no credential or network path is touched.Cross-platform: no change. The code uses
git ls-filesand string suffix checks, both of which behave identically on macOS, Linux, and Windows. No path separator or shortcut handling is involved.SSH/remote and local: not applicable. This is repository tooling that runs in CI and in the pre-commit hook; it does not execute on a remote host or read remote files.
Agent and integration compatibility: not applicable. No agent CLI, git provider, or integration code is involved.
Performance: neutral to slightly better in accuracy, no measurable cost. The ratchet reads at most four additional tracked files today (three
.mtsand one.ctsexist in the tree), and oxlint applies one more override glob during its existing pass.UI quality: not applicable, no UI.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
No issues in Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, or performance. The change is additive: every file that passed before still passes, because the new globs only add extensions that had no
max-linescoverage at all. Backwards compatibility is safe in the strict sense too, since a stricter rule can only fail files that were previously uncapped, and no existing.mtsor.ctsfile in the tree exceeds the budget.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)