Repository navigation
fix(lint): include .mts and .cts in line-limit checks - #22413
Conversation
Based on the report and proposal by @DeryFerd. Co-authored-by: DeryFerd <[email protected]>
…92-lint-extensions
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe max-lines configuration now applies the 300-line source limit and 800-line test/spec limit to Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to The line-limit configuration and ratchet updates for 🚥 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.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: a8650b62-321d-4323-9ea7-9ea3687230b3
📒 Files selected for processing (3)
.oxlintrc.jsonconfig/scripts/check-max-lines-ratchet.mjsconfig/scripts/check-max-lines-ratchet.test.mjs
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- oxlint budgets — the production
max-linesoverride now matches**/*.mtsand**/*.ctsalongside**/*.tsat 300, and the test/spec override grows to eight globs so.test/.spec.mts/.ctsget the 800 test budget. - Ratchet scanner —
defaultLimitForPathlearnsmts|cts(both source and test/spec forms),collectCurrentSuppressionsadds*.mts/*.ctsto itsgit ls-filesenumeration, and the failure help text now names.ts/.mts/.cts. - Tests — new
.mts/.ctscases fordefaultLimitForPathandcollectMobileBumps, a scratch-repo scanner case (tracked-only, self-file excluded,.mts.backup/.ctsxsuffix boundaries), and an installed-oxlint boundary test that pins exact diagnostics for both.oxlintrc.jsonandmobile/.oxlintrc.json.
Verified locally: the focused suite passes (22 tests), pnpm check:max-lines-ratchet exits 0 with its 7 grandfathered suppressions, installed oxlint 1.80.0 discovers and lints .mts/.cts in both explicit and directory-traversal modes, and oxfmt --check is clean on the three files. The four tracked .mts/.cts files top out at 332 total lines and emit no max-lines diagnostics, so no baseline entry is needed.
ℹ️ .js / .jsx / .cjs remain outside the caps
The diff correctly closes the .mts/.cts hole, but the write-up’s "changing extension is no longer a way around the budget" is broader than what shipped: oxlint still discovers and lints .js/.jsx (and .cjs), yet none has a max-lines override, so an oversized module can still move to one of those. Not a blocker for this PR — flagging only so the residual surface is tracked if the intent is to close extension-switching generally.
Technical details
# `.js`/`.jsx`/`.cjs` have no max-lines budget
## Affected sites
- `.oxlintrc.json:158` — `["**/*.ts", "**/*.mts", "**/*.cts"]`; no `.js`/`.jsx`/`.cjs` entry.
- `config/scripts/check-max-lines-ratchet.mjs:26` — `defaultLimitForPath` has no branch for `.js`/`.jsx`/`.cjs` (they fall through to 300 if ever enumerated, but they are not in `git ls-files` at line 96 either).
- `config/scripts/check-max-lines-ratchet.mjs:96` — enumeration is `['*.ts','*.tsx','*.mts','*.cts','*.mjs']`.
## Evidence
- `pnpm exec oxlint --format json native/windows-registry` → 2 files; `mobile/plugins` → 1; a bare `.cjs` file → 1. oxlint lints these extensions.
- No `max-lines` override exists for any of them, so they are uncapped both in the linter and in the ratchet.
## Required outcome
- None for this PR. If pursued, add matching `max-lines` globs (and any test/spec variants) plus the `git ls-files` patterns in the same change, exactly as this PR did for `.mts`/`.cts`.
## Open questions for the human
- Is closing `.js`/`.jsx`/`.cjs` intended follow-up work, or deliberately out of scope (config/fixture files)?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Relocated the installed-oxlint boundary fixtures — the two
it.eachconfig cases (enforces exact budgets with installed oxlint and %s) now discard thebeforeEachtmpdir scratch and recreate it beneath the config under test (dirname(join(repoRoot, config))— repo root for.oxlintrc.json,mobile/formobile/.oxlintrc.json), re-runninggit initthere so the.mts/.ctsfixtures sit under the config whose globs they exercise.
Verified locally: ORCA_BACKGROUND_LAUNCH=1 pnpm vitest run config/scripts/check-max-lines-ratchet.test.mjs → 22/22 pass, and git status is clean afterward (the relocated fixtures are removed by afterEach). No production code changed in this delta; the prior review's only note (.js/.jsx/.cjs remain uncapped) is unchanged and intentionally out of scope.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

ELI5
TypeScript files keep the same size limits regardless of whether their extension is .ts, .mts or .cts.
What Changed
Oxlint applies the existing production and test limits to .mts/.cts. The suppression scanner enumerates those tracked extensions and recognizes their test/spec variants.
Why
Extend the existing limits and scanner together so a TypeScript file cannot escape the rule by switching among .ts, .mts and .cts. No allowances, disables or new budgets are added.
Linked Issue
Related to #21792. Adapted from @DeryFerd.
Visual Proof
N/A — development lint configuration and scanner only; no application UI or behavior changes.
Testing
22 passing focused ratchet tests exercise tracked files and installed oxlint boundary cases. Node typecheck and changed-code quality pass. Executed on macOS; Git options are baseline compatible, but no old-Git or Windows/Linux runtime run is claimed.
ORCA_BACKGROUND_LAUNCH=1AI Disclosure
Review
Reviewed production/test glob parity, suppression enumeration and unchanged limits. Existing newline-delimited unusual-filename handling and JavaScript extension budgets are outside this scope. CodeRabbit’s fixture-location finding is addressed: root and mobile fixtures now live below their owning configuration directory and are removed after each test.
Agent skill upstream boundary
Notes
No full application build, full lint, or full suite is claimed; CI covers broader validation.
Checklist