Skip to content

Defer standalone-component migration and disable prefer-standalone lint rule - #683

Open
fpigeonjr wants to merge 2 commits into
masterfrom
gh-584-decide-standalone-component-lint-policy-for-legacy
Open

Defer standalone-component migration and disable prefer-standalone lint rule#683
fpigeonjr wants to merge 2 commits into
masterfrom
gh-584-decide-standalone-component-lint-policy-for-legacy

Conversation

@fpigeonjr

Copy link
Copy Markdown
Contributor

Description

Decides the standalone-component lint policy for legacy NgModules and closes out the human-in-the-loop architecture decision tracked in #584 (child of the ESLint lint-debt epic, #580).

Decision: defer the standalone-component migration rather than migrate or leave the rule as an unactionable warning. Rationale (evaluated and documented in AGENTS.md):

  • Of the 190 root components flagged by @angular-eslint/prefer-standalone (3 in test-app), all but one are already standalone: false and registered via declarations: in one of 46 legacy NgModules. The single standalone: true outlier (SamAutocompleteComponent) is still consumed through declarations: in two modules, so it doesn't reflect real usage either.
  • ESLint's own --fix for this rule mechanically strips standalone: false, flipping Angular's default to standalone: true. This was tried in Apply safe ESLint autofixes and lower the baseline #582/PR Apply safe ESLint autofixes and lower the warning baseline #675 and broke TestBed.configureTestingModule for every spec declaring one of these components — 827 failing tests. It's a behavior change, not a style fix.
  • Several of the affected files (e.g. hierarchical.module, progress.module, autocomplete.module, progress.component, autocomplete-multiselect.component, radiobutton.component, text.component, toolbar.component) are in the frozen scripts/consumer-deep-imports.json contract — an uncoordinated migration risks breaking real downstream consumers, not just an internal refactor.

Changes:

  • AGENTS.md — new "Standalone-component lint policy (deferred)" section under Lint, recording the decision and full rationale.
  • eslint.config.mjs (root) — explicitly sets @angular-eslint/prefer-standalone to "off" (not just a warning), with an inline comment cross-referencing the AGENTS.md rationale and this issue.
  • test-app/eslint.config.mjs — same treatment, referencing the root config's rationale.
  • eslint-baseline.json — lowered to reflect the removed findings: root 1619 → 1369, test-app 4 → 1.

If a real standalone migration is ever undertaken, it will need its own epic, planned in consumer-safe slices (NgModule → imports: rewrites, spec updates, coordinated consumer rollout) — explicitly out of scope here.

Motivation and Context

Closes #584

Type of Change (Select One and Apply Label)

  • Bug fix (non-breaking change which fixes an issue) → Apply bugfix label
  • New feature (non-breaking change which adds functionality) → Apply enhancement label
  • Breaking change (fix or feature that would cause existing functionality to change) → Apply breaking label
  • Documentation / configuration update → Apply maintenance label

How to Test

  1. npm ci && npm ci --prefix test-app
  2. npm run lint:baseline → 0 errors, 1369 warnings (root), gate passes
  3. npm --prefix test-app run lint:baseline → 0 errors, 1 warning (test-app), gate passes
  4. npm --prefix test-app test → 152 test files / 1386 tests pass
  5. npm run coverage:check → passes (coverage unaffected)
  6. npm run format:check → passes
  7. npm run validate:publish → passes (784 packed files, 67 consumer deep imports verified)
  8. cd test-app && npm run build → succeeds

Expected result: All lint/test/coverage/publish/build gates pass. eslint-baseline.json reflects the lowered warning counts, and grep -c "prefer-standalone" eslint-report.json (either workspace) reports 0.

Screenshots (if appropriate)

N/A — no UI changes, lint policy and documentation only.

Checklist

  • Branch name follows convention (e.g. gh-<number>-<slug>)
  • PR title starts with a verb in the imperative mood
  • I have self-reviewed my own code
  • format:check passes (npm run format:check)
  • lint passes (npm run lint)
  • build passes (cd test-app && npm run build)
  • Tests pass and coverage is reported (cd test-app && npm test)
  • If this change requires a documentation update, I have updated it accordingly
  • If there are dependent changes, they have been merged and published in downstream modules

…nt rule

Documents the decision to defer standalone-component migration for
legacy NgModule-declared components (#584):

- 189/190 flagged root components (3/3 in test-app) are standalone: false
  and registered via declarations: in one of 46 NgModules; the one
  standalone: true outlier is still consumed via declarations: too.
- ESLint's own --fix for this rule strips standalone: false, flipping
  Angular's default to standalone: true, which broke 827 tests when
  tried in #582/PR #675 — a behavior change, not a style fix.
- Several affected files are in the frozen consumer-deep-imports.json
  contract, so an uncoordinated migration risks breaking downstream
  consumers.

Disables @angular-eslint/prefer-standalone explicitly (not just warns)
in both eslint.config.mjs and test-app/eslint.config.mjs, with the
rationale documented in AGENTS.md under a new "Standalone-component
lint policy (deferred)" section, and lowers eslint-baseline.json to
reflect the removed findings (root: 1619 -> 1369, test-app: 4 -> 1).

Closes #584
@fpigeonjr fpigeonjr added the maintenance Repo maintenance / tooling label Sep 3, 2026
@fpigeonjr fpigeonjr self-assigned this Sep 3, 2026
@fpigeonjr
fpigeonjr requested a lite review from Copilot September 3, 2026 15:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are limited to configuration/documentation updates and align with the stated decision, with only a minor wording/path clarity nit.

Pull request overview

Disables @angular-eslint/prefer-standalone in both workspaces and documents the rationale for deferring a standalone-component migration in this raw-source Angular library, while updating the lint warning baseline to reflect the removed findings.

Changes:

  • Document the deferred standalone-component lint policy and rationale in AGENTS.md.
  • Turn off @angular-eslint/prefer-standalone in root and test-app ESLint configs (instead of leaving it as warnings).
  • Lower eslint-baseline.json warning counts to match the new lint output.
File summaries
File Description
AGENTS.md Adds a documented decision/rationale for deferring standalone migration and disabling prefer-standalone.
eslint.config.mjs Disables @angular-eslint/prefer-standalone in the root workspace and records rationale inline.
test-app/eslint.config.mjs Disables @angular-eslint/prefer-standalone in test-app, referencing the documented rationale.
eslint-baseline.json Updates warning baselines to reflect the rule being disabled.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread eslint.config.mjs Outdated
@fpigeonjr
fpigeonjr marked this pull request as ready for review September 3, 2026 15:20
@fpigeonjr
fpigeonjr requested a review from a team as a code owner September 3, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Repo maintenance / tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decide standalone-component lint policy for legacy NgModules

2 participants