IAEMOD-61187: Guard the ESLint warning baseline against regressions - #638
Open
fpigeonjr wants to merge 2 commits into
Open
IAEMOD-61187: Guard the ESLint warning baseline against regressions#638fpigeonjr wants to merge 2 commits into
fpigeonjr wants to merge 2 commits into
Conversation
Adds a ratcheting warning-baseline gate for ESLint, wired into CI alongside the existing ng lint step for both the root workspace and test-app. - eslint-baseline.json records the current accepted warning ceiling per workspace (root: 1631, test-app: 4), measured from ng lint --format json. - scripts/check-lint-baseline.mjs sums errorCount/warningCount from an ESLint JSON report and fails if warnings exceed the baseline for that workspace, or if there are any errors at all (regardless of warning count). --bump lowers (never raises) the baseline to the measured count, so cleanup PRs can lock in a reduction without editing CI config. - package.json / test-app/package.json add lint:report, lint:baseline, and lint:baseline:bump scripts. - .github/workflows/lint.yml runs the new baseline gate after each existing ng lint step. - scripts/check-lint-baseline.test.mjs covers pass/fail/bump/error- precedence/malformed-baseline cases via node --test. Closes #581
There was a problem hiding this comment.
Pull request overview
Adds an ESLint warning-baseline ratchet for the root workspace and test app.
Changes:
- Adds baseline-checking and bump commands with unit tests.
- Records current warning ceilings.
- Integrates baseline checks into CI and ignores generated artifacts.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/lint.yml |
Runs baseline guards in CI. |
.gitignore |
Ignores generated ESLint artifacts. |
eslint-baseline.json |
Records workspace warning ceilings. |
package.json |
Adds root baseline scripts. |
test-app/package.json |
Adds test-app baseline scripts. |
scripts/check-lint-baseline.mjs |
Implements checking and ratcheting. |
scripts/check-lint-baseline.test.mjs |
Tests the baseline CLI behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…uard - check-lint-baseline.mjs (--bump): validate the workspace entry exists and is numeric before computing the ratchet, instead of silently treating a missing/typo'd workspace (e.g. --bump roots) as 0 and reporting "nothing to bump". - Add scripts/check-baseline-not-increased.mjs, a new CI-only guard that compares eslint-baseline.json on the PR branch against the base branch's committed version and fails if any shared workspace's ceiling increased, closing the gap where a contributor could raise a baseline directly in the same PR that introduces new warnings. - Wire the new guard into .github/workflows/lint.yml (fetch-depth: 0, runs only on pull_request, diffs against the PR's base commit). - scripts/check-baseline-not-increased.test.mjs: 8 node --test cases covering unchanged/lowered/raised baselines, multi-workspace raises, new workspace entries, missing base file, and invalid values. - scripts/check-lint-baseline.test.mjs: add a case for --bump on an unknown workspace failing loudly.
fpigeonjr
marked this pull request as ready for review
August 26, 2026 21:10
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.
Description
Adds a ratcheting warning-baseline gate for ESLint, wired into CI alongside the existing
ng lintstep for both the root workspace andtest-app.eslint-baseline.json(new) — records the current accepted warning ceiling per workspace, measured fromng lint --format json:root: 1631,test-app: 4. This is the reproducible baseline from the ESLint migration (tslint → ESLint + Angular template a11y gate (ADR-0006) #566) and the warn-first debt tracked in Burn down ESLint and Angular lint debt #580.scripts/check-lint-baseline.mjs(new) — reads an ESLint JSON report, sumserrorCount/warningCountper workspace, and:errorCount > 0, regardless of the warning count — errors are never allowed.warningCountexceeds the recorded baseline for that workspace, printingexpected: <= N/actual: Mplus a remediation hint.--bump <workspace> <report>, which lowers (never raises) the baseline to the measured warning count, so a cleanup PR can lock in a reduction without hand-editingeslint-baseline.jsonor CI config.scripts/check-lint-baseline.test.mjs(new) — 12node --testcases covering pass/fail thresholds, error-precedence over warnings, ratchet-only--bumpbehaviour, and malformed/missing baseline entries.package.json/test-app/package.json— addlint:report(JSON-formatng lintrun),lint:baseline(report + gate), andlint:baseline:bumpscripts to each workspace..github/workflows/lint.yml— adds a "Guard <workspace> ESLint warning baseline" step after each existingng lintstep..gitignore— ignore the generatedeslint-report.json/.eslintcacheartifacts in both workspaces.Motivation and Context
#580 (burn down ESLint/Angular lint debt) needs a gate that prevents the accepted warning baseline from regressing while cleanup PRs are still landing incrementally.
ng lint's built-inmaxWarningsoption only supports one fixed number and would need a CI-config edit on every cleanup PR to ratchet down; this script keeps the ratchet in a single committed JSON file instead.Closes #581
Type of Change (Select One and Apply Label)
bugfixlabelenhancementlabelbreakinglabelmaintenancelabelHow to Test
npm ci && npm run lint:baseline— should print✓ root: 1631 warnings (baseline 1631), 0 errors. Lint baseline gate passed.test-app:npm ci --prefix test-app && npm --prefix test-app run lint:baseline— should print✓ test-app: 4 warnings (baseline 4), 0 errors. Lint baseline gate passed.node --test scripts/*.test.mjs— 12 tests should pass.any-typed export to any root.tsfile, then re-runnpm run lint:baseline— it should fail with✖ root: ESLint warning baseline exceededand print expected (1631) vs. actual (1632) counts. Revert the temp change.Lintworkflow runs the new "Guard root/test-app ESLint warning baseline" steps after each existing lint step and passes on this branch.Expected result: Both workspaces' lint baseline gates pass at the current recorded counts; the unit tests all pass; an injected extra warning fails the gate with an actionable message; ESLint errors would fail the gate regardless of warning count (verified via the "fails on errors even when warnings are within baseline" unit test, since no errors currently exist in the repo to reproduce live).
Screenshots (if appropriate)
N/A — CI/configuration change only.
Checklist
gh-<number>-<slug>)format:checkpasses (npm run format:check)lintpasses (npm run lint)buildpasses (cd test-app && npm run build)cd test-app && npm test)