Skip to content

Wave 4: Test suite fixes and TSLint -> ESLint migration#423

Open
tobydrinkall wants to merge 3 commits into
devin/1782984123-angular20-core-upgradefrom
devin/1782985025-wave4-test-lint
Open

Wave 4: Test suite fixes and TSLint -> ESLint migration#423
tobydrinkall wants to merge 3 commits into
devin/1782984123-angular20-core-upgradefrom
devin/1782985025-wave4-test-lint

Conversation

@tobydrinkall

@tobydrinkall tobydrinkall commented Jul 2, 2026

Copy link
Copy Markdown

Summary

Wave 4 of the Angular 9→21 migration: test + lint modernization on top of the Wave 1 core-upgrade branch.

  • Tests: the repo had no unit specs, so ng test exited 1 with an empty suite. Added minimal specs (comment.pipe.spec.ts, settings.service.spec.ts using TestBed.inject) so npm test -- --watch=false --browsers=ChromeHeadless runs 7 green tests. No karma.conf changes were needed (Wave 1 already updated karma/jasmine).
  • Lint: migrated TSLint → ESLint via ng add @angular-eslint/schematics (flat eslint.config.js, @angular-eslint/builder:lint target in angular.json), removed tslint + tslint.json. Rules for later waves are disabled rather than mass-rewriting code: prefer-standalone, prefer-inject, template/prefer-control-flow, and template a11y click/focus rules (Wave 2/3 territory); no-empty-function allows empty DI constructors. Real issues were fixed instead of suppressed: letconst, unused error callback params, unused Observable import, (data as any)data['feedType'], declare let ga: Function → typed fn, removed empty ngOnInits. One inline disable keeps the legacy item selector (template change deferred).
  • e2e: removed EOL protractor setup (e2e/ dir, angular.json e2e target, e2e script, protractor/jasminewd2/ts-node/jasmine-spec-reporter deps).
  • Regenerated package-lock.json; set cli.packageManager: npm in angular.json (stale yarn.lock otherwise breaks ng add).

Verified locally: npm run build, npm test -- --watch=false --browsers=ChromeHeadless, and npm run lint all pass.

Link to Devin session: https://app.devin.ai/sessions/b8f234ccdeae49be8179afe0b48b633c
Requested by: @tobydrinkall


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Open in Devin Review (Staging)
Open in Devin Review

Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
@tobydrinkall tobydrinkall self-assigned this Jul 2, 2026
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 3 potential issues.

Open in Devin Review

Comment thread src/app/shared/services/settings.service.ts
@@ -1,11 +1,11 @@
import { Injectable } from '@angular/core';
import { Injectable, OnDestroy } from '@angular/core';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: OnDestroy on a root-provided service has limited practical effect

The SettingsService is providedIn: 'root' (line 6), meaning it lives for the entire application lifetime. Angular only calls ngOnDestroy on root services when the root injector is destroyed (i.e., when the app shuts down). Adding implements OnDestroy here is technically correct but provides no practical cleanup benefit during normal application use - the event listener will persist for the app's lifetime regardless. This is not a bug, but worth noting that the OnDestroy implementation gives an impression of lifecycle management that doesn't materially help.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed this has limited practical effect for a root-provided service; the implements OnDestroy was added by ESLint's use-lifecycle-interface auto-fix since the pre-existing ngOnDestroy() method was already there. Keeping it for correctness.

Comment thread package.json
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"lint": "ng lint"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚩 Protractor e2e tests removed without replacement

The PR removes all Protractor-based e2e tests (e2e/ directory) and the e2e npm script. While Protractor is deprecated and this removal is expected during modernization, no replacement e2e framework (Cypress, Playwright, etc.) is introduced. The new unit tests (comment.pipe.spec.ts, settings.service.spec.ts) partially compensate but don't cover integration/e2e scenarios. This may be intentional if e2e is planned for a follow-up, but worth confirming.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Intentional — Protractor is EOL and its removal (without a replacement in this PR) was explicitly in scope for Wave 4. A modern e2e framework can be added in a follow-up if desired.

Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 2 new potential issues.

Open in Devin Review


darkColorSchemeMedia = window.matchMedia('(prefers-color-scheme: dark)');

private boundColorSchemeChangeHandler = this.handleSystemPreferredColorSchemeChange.bind(this);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Event listener fix correctly resolves a pre-existing cleanup bug

The old code called .bind(this) inline in both subscribeToSystemPreferredColorScheme and unSubscribeToSystemPrefferedColorScheme, which meant removeEventListener received a different function reference than addEventListener and thus never actually removed the listener. The new code at src/app/shared/services/settings.service.ts:19 stores the bound handler once, so removeEventListener at line 64 now correctly removes the same function that was added at line 43. This is a correct and important fix.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread src/app/shared/services/settings.service.spec.ts
Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread eslint.config.js
@@ -0,0 +1,59 @@
// @ts-check
const eslint = require("@eslint/js");
const { defineConfig } = require("eslint/config");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: ESLint config uses defineConfig from eslint/config subpath export

The eslint.config.js imports defineConfig from eslint/config (eslint.config.js:3). This subpath export was introduced in ESLint v9.x and is available in the resolved v10.6.0 (per package-lock.json). However, the @eslint/js package is pinned to ^10.0.1 while eslint is ^10.3.0 — these are separate packages and don't strictly need version alignment, but keeping them in sync is a common recommendation to avoid subtle rule behavior differences.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Info noted — these versions were generated by ng add @angular-eslint/schematics, so they match what angular-eslint 21.4.0 expects; leaving as-is.

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.

1 participant