Repository navigation
chore: enforce file size limits with oxlint - #3804
Conversation
Size Report
Startup median (7 runs, lower is better):
|
|
The lint config change at b3b1538 looks right, and nothing in the code blocks merge. All 20 checks pass on this head, and there are no conflicts. Before it is ready, please answer the design question at the end and fix the stale reference in test/integration/provider-scenarios/android-settings-contract.ts:10. Not blocking, take or leave: (1) The two legacy overrides in oxlint.config.ts:104 set max-lines to off for 13 test files and 4 production files, so the removed ratchet's no-growth rule is gone. I grew src/tests/cli-config.test.ts from 1282 to 1782 lines in a scratch copy of the head, and oxlint 1.79.0 passed it. A listed file that shrinks below 1000 also keeps its exemption and can regrow to any size. (2) android-settings-contract.ts:10 cites scripts/tests/test-file-size-ratchet.test.ts, which this PR deletes. About a dozen test headers also say the parent "may not grow (docs/agents/testing.md)", for example src/tests/remote-connection-platform-axis.test.ts:11 and packages/remote/src/tests/upload-client-cancellation.test.ts:7. That rule no longer exists, and testing.md does not contain it. My search was keyword based, so there may be more. (3) CONTRIBUTING.md:221 says the limit covers production TypeScript/JavaScript files, but the globs only match ts, tsx and mjs. A planted 1001-line .mts file passed. Either name the extensions in the text or widen the glob to cover mts, cts, cjs and js. The 1000 literal also appears in two override blocks, which could be hoisted. Would it be simpler to replace "off" on the 17 legacy files with a per-file cap equal to its current length, generated from one {path: max} map in oxlint.config.ts? That keeps the no-growth rule with no git history lookup. The map would also be the single list of debt. Is dropping the no-growth rule acceptable, as the PR documents, or should the legacy entries become caps? |
b3b1538 to
7363fca
Compare
|
Addressed in I agree with the proposed caps: preserving the legacy no-growth ceiling is preferable to turning enforcement off. One Also addressed the take-or-leave notes:
Evidence from a disposable checkout: all 17 files pass at their cap and fail with one added line. Your All 36 runnable checks passed on the pushed head with |
|
Thanks, 7363fca answers the design question. CI was still running when I checked, and there are no conflicts. This is ready for human review. |
|
Summary
Replace the 200-line git-history test-file size ratchet with oxlint
max-lines. 22 files changed: net production 0 lines, tooling/config/tests −192 lines, contributor docs +6 lines (total −186).Enforce 1,000 lines, including comments/blanks, for
**/*.test.{ts,tsx,mjs}and root/package production.ts,.tsx,.mjssources, excluding test support. Editors, affected lint, and CI use the same rule.One
LEGACY_FILE_LINE_CAPSmap caps 13 oversized tests and four production modules at their recorded lengths. Growth beyond those caps fails; other lint rules remain active. Caps require explicit lowering/removal when files shrink: automatic history-based shrink ratcheting is dropped. Review follow-up removes stale size-policy headers and the deleted-guard reference, documents exact extensions, and shares the default limit constant.Closes #3787.
Validation
8369106dbfb93ea0d43dba2e9f8737e1c2cb1ad2; tested/pushed head7363fca7e56833d8be3b4c1058f29b7e72ac3f32.pnpm check:affected --run --head 7363fca7e56833d8be3b4c1058f29b7e72ac3f32: 36 runnable checks passed,exactCommit=true; receipt.tmp/validation/run-IulDXN/receipt.json. Unit run: 1,922 files, 16,144 tests passed, one skipped.cli-config.test.tsmakes affected lint fail:File has too many lines (1782). Maximum allowed is 1282.Scratch checkout removed.