Closed Bug 2089610 Opened 24 days ago Closed 4 days ago

Add a mach ts command to count a project's tsc errors and compare them with a saved run

Categories

(Developer Infrastructure :: Linting and Formatting: JavaScript, enhancement)

enhancement

Tracking

(firefox163 fixed)

RESOLVED FIXED
163 Branch
Tracking Status
firefox163 --- fixed

People

(Reporter: dao, Assigned: dao)

References

(Blocks 1 open bug)

Details

Attachments

(3 external files)

The TypeScript agent skills (bug 2089016) measure a checkJs project by running tsc on it and bucketing the errors, and check a patch by comparing the error sets before and after it. They do both with a script bundled in one skill, tsc-summary.mjs, which all four skills run from that skill's directory.

Move it into tools/ts/ as ./mach ts summary, so the skills and people share one tool:

  • ./mach ts summary <project-dir> [--save FILE] [--members TYPE] [--all] runs tsc with --pretty false on the project and prints the error total and the counts per file, per error code, per unresolved name and per type that lacks a property. It reports a tsc crash or a non-zero exit with no diagnostics as a failure rather than as 0 errors. --save keeps tsc's raw output.
  • ./mach ts summary <project-dir> --diff FILE compares this run with the output saved in FILE as error sets, ignoring positions and the order of union members. It refuses a file that holds no diagnostics and exits with 1 when the sets differ.

Unlike the script, the command installs the top-level node_modules itself, as ./mach ts check does.

This also passes --noEmit to mach ts check, which could write compiled JS next to a project's sources.

Assignee: nobody → dao+bmo
Status: NEW → ASSIGNED
Summary: Add mach ts commands to summarize a project's tsc errors and compare two runs → Add a mach ts command to count a project's tsc errors and compare them with a saved run
Attachment #9675244 - Attachment description: Bug 2089610 - Add mach ts summary and mach ts diff. r?Standard8 → Bug 2089610 - Add mach ts summary to count a project's tsc errors and compare them with a saved run. r?Standard8
Attachment #9675244 - Attachment description: Bug 2089610 - Add mach ts summary to count a project's tsc errors and compare them with a saved run. r?Standard8 → Bug 2089610 - Add mach ts summary to count a project's tsc errors by file and cause. r?Standard8
Pushed by dgottwald@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/01540ffba0c5 https://hg.mozilla.org/integration/autoland/rev/8cfa63924459 Pass --noEmit to tsc in mach ts check, so it can't write compiled JS next to a project's sources. r=Standard8
Keywords: leave-open
Component: Lint and Formatting → Linting and Formatting: JavaScript
Pushed by dgottwald@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/fccb44330972 https://hg.mozilla.org/integration/autoland/rev/918a0a23da05 Add mach ts summary to count a project's tsc errors by file and cause. r=Standard8 https://github.com/mozilla-firefox/firefox/commit/ab613253b44c https://hg.mozilla.org/integration/autoland/rev/789c0581d818 Add mach ts summary --save and --diff to compare a project's tsc errors with a saved run. r=Standard8
Keywords: leave-open
Status: ASSIGNED → RESOLVED
Closed: 4 days ago
Resolution: --- → FIXED
Target Milestone: --- → 163 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: