Skip to content

Update Angular to v22, adopt OnPush, and modernize tooling - #176

Merged
RHSplinter merged 4 commits into
mainfrom
update-angular-22
Jun 24, 2026
Merged

Update Angular to v22, adopt OnPush, and modernize tooling#176
RHSplinter merged 4 commits into
mainfrom
update-angular-22

Conversation

@RHSplinter

Copy link
Copy Markdown
Owner

Why

DevToolBox was on Angular 21. This brings the app up to Angular 22 (the current major), adopts the change-detection and tooling defaults that Angular 22 now expects, and trims dependencies that became deprecated or redundant along the way.

What changed

Angular 22 upgrade

  • Ran ng update for @angular/core, @angular/cli, @angular/material, and @angular-eslint/schematics to v22, with TypeScript bumped to ^6.
  • Reworked eslint.config.js for @angular-eslint v22: the individual plugins no longer export flat-config presets, so it now consumes the angular-eslint umbrella package (tsRecommended / templateRecommended / templateAccessibility).
  • README updated to reflect Angular 22.

OnPush change detection

  • Replaced the migration-applied ChangeDetectionStrategy.Eager with OnPush across all 13 components (diff-viewer was already OnPush). The app uses a consistent event-output + input-binding architecture, so OnPush is runtime-safe.
  • Removed the now-redundant prefer-on-push-component-change-detection eslint override; the codebase is fully compliant with the recommended rule.
  • Updated unit specs for OnPush semantics: @Input-driven specs use componentRef.setInput(...), and internal-state specs force the component view via its own ChangeDetectorRef.detectChanges().

Tooling / CI

  • Bumped both GitHub Actions workflows to Node 24.x LTS (satisfies Angular 22's ^24.15.0 engine requirement).
  • Set an explicit rootDir in cypress/tsconfig.json to fix a TypeScript 6 regression (TS5011) that was breaking the entire e2e suite.

Dependency cleanup

  • Removed three deprecated, unused direct dependencies: @angular/animations (unused optional peer), @angular/platform-browser-dynamic (app bootstraps via @angular/platform-browser), and @types/diff (redundant stub; diff ships its own types).

Notes for reviewers

  • tsconfig.app.json / tsconfig.spec.json suppress the nullishCoalescingNotNullable and optionalChainNotNullable extended diagnostics. These were added by the Angular 22 migration because the tightened reactive-forms template typing now flags the existing ?. / ?? usage in time-converter.component.html as redundant. The operators remain meaningful at runtime, so the diagnostics are suppressed rather than rewriting every expression.
  • The $safeNavigationMigration() markers in the time-converter template are an official Angular 22 compiler construct (transformed at build time) and are intended to stay in source.

Verification

  • Lint: clean
  • Unit tests: 109/109 passing, 100% coverage
  • E2E (Cypress): 34/34 passing, confirming OnPush behaves correctly under real user interaction
  • Production build: succeeds

RHSplinter and others added 4 commits June 24, 2026 10:57
Run ng update for @angular/core, @angular/cli, @angular/material and @angular-eslint to v22, applying the official v22 migrations (explicit ChangeDetectionStrategy.Eager, safe-navigation, strict-template diagnostics, tsconfig updates).

- Migrate ESLint flat config to the angular-eslint v22 umbrella package, since the individual plugins no longer expose preset configs.
- Disable prefer-on-push-component-change-detection to keep the migration's behavior-preserving Eager strategy.
- Bump CI Node version from 20.x to 22.x (required by Angular 22).
- Update README to reference Angular 22.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace ChangeDetectionStrategy.Eager with OnPush across all components

- Remove now-redundant prefer-on-push-component-change-detection eslint override

- Update unit specs for OnPush (setInput / component-view CDR detectChanges)

- Bump GitHub Actions workflows to Node 24.x LTS

- Set explicit rootDir in cypress tsconfig for TypeScript 6 (TS5011)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Drop @angular/animations (unused; optional peer, app has no provideAnimations)

- Drop @angular/platform-browser-dynamic (unused; app bootstraps via @angular/platform-browser)

- Drop @types/diff (redundant stub; diff ships its own type definitions)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates DevToolBox to Angular 22 and TypeScript 6, aligns component change detection with OnPush, and modernizes linting/Cypress/CI configuration to match the updated ecosystem expectations.

Changes:

  • Upgraded Angular framework/tooling packages to v22 and TypeScript to v6; updated README to reflect the new Angular version.
  • Adopted ChangeDetectionStrategy.OnPush across components and adjusted unit tests to use setInput(...) / explicit ChangeDetectorRef.detectChanges() patterns.
  • Modernized tooling configs: switched ESLint flat-config to the angular-eslint umbrella presets, tightened Cypress env handling, fixed Cypress TS rootDir regression, and bumped CI Node to 24.x.

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tsconfig.spec.json Suppresses specific Angular compiler extended diagnostics in spec builds.
tsconfig.app.json Suppresses specific Angular compiler extended diagnostics in app builds.
src/app/component/tools/time-converter/time-converter.component.ts Enables OnPush change detection for the time converter component.
src/app/component/tools/time-converter/time-converter.component.html Applies Angular 22 safe-navigation migration markers in template expressions.
src/app/component/tools/json-validator/json-validator.component.ts Enables OnPush change detection for the JSON validator component.
src/app/component/tools/json-validator/json-validator.component.spec.ts Updates tests to trigger CD explicitly under OnPush.
src/app/component/tools/base64-encoder/base64-encoder.component.ts Enables OnPush change detection for the Base64 encoder component.
src/app/component/tools/base64-encoder/base64-encoder.component.spec.ts Updates tests to trigger CD explicitly under OnPush.
src/app/component/nav-list/nav-list.component.ts Enables OnPush change detection for the nav list component.
src/app/component/nav-list/nav-list.component.spec.ts Updates tests to trigger CD explicitly under OnPush.
src/app/component/home/home.component.ts Enables OnPush change detection for the home component.
src/app/component/footer/footer.component.ts Enables OnPush change detection for the footer component.
src/app/component/error/error.component.ts Enables OnPush change detection for the error component.
src/app/component/common/text-area/text-area.component.ts Enables OnPush change detection for the text-area component.
src/app/component/common/text-area/text-area.component.spec.ts Updates tests to use componentRef.setInput(...) under OnPush.
src/app/component/common/readonly-text-area/readonly-text-area.component.ts Enables OnPush change detection for the readonly text-area component.
src/app/component/common/readonly-text-area/readonly-text-area.component.spec.ts Updates tests to use componentRef.setInput(...) under OnPush.
src/app/component/common/output-field/output-field.component.ts Enables OnPush change detection for the output-field component.
src/app/component/common/output-field/output-field.component.spec.ts Updates tests to use componentRef.setInput(...) under OnPush.
src/app/component/common/json-viewer/json-viewer.component.ts Enables OnPush change detection for the JSON viewer component.
src/app/component/common/json-viewer/json-viewer.component.spec.ts Updates tests to rely on setInput(...) + detectChanges() instead of manual ngOnChanges().
src/app/app.component.ts Enables OnPush change detection for the root app component.
README.md Updates documentation to state the project is now Angular 22.
package.json Updates Angular/CLI/ESLint deps for v22, removes redundant deps, bumps TypeScript to v6.
eslint.config.js Migrates ESLint flat config to angular-eslint umbrella presets for TS/templates.
cypress/tsconfig.json Adds rootDir to address TS6/Cypress compilation regression.
cypress.config.ts Disables legacy Cypress env exposure via allowCypressEnv: false.
.github/workflows/deploy.yml Bumps CI Node version to 24.x.
.github/workflows/build.yml Bumps CI Node version to 24.x.

@RHSplinter
RHSplinter merged commit b704f49 into main Jun 24, 2026
14 checks passed
@RHSplinter
RHSplinter deleted the update-angular-22 branch June 24, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants