Skip to content

feat(eslint-plugin): [no-implicit-takeuntil-destroyed] add rule#2803

Merged
JamesHenry merged 2 commits into
angular-eslint:mainfrom
rznn7:feat/add-rule-no-implicit-takeuntil-destroyed
Jan 1, 2026
Merged

feat(eslint-plugin): [no-implicit-takeuntil-destroyed] add rule#2803
JamesHenry merged 2 commits into
angular-eslint:mainfrom
rznn7:feat/add-rule-no-implicit-takeuntil-destroyed

Conversation

@rznn7

@rznn7 rznn7 commented Nov 23, 2025

Copy link
Copy Markdown
Contributor

Hi!

Fixes #2672

First time I am working on a lint rule, hope it fits! I tried to avoid false positives as much as possible.

Worth noting it would not report takeUntilDestroyed() usage in a constructor that is not in a @Component or @Injectable, but I assumed it was out of scope for this rule.

Working on this also made me realize that a rule for the inject() function would also be coherent.

@rznn7 rznn7 force-pushed the feat/add-rule-no-implicit-takeuntil-destroyed branch 2 times, most recently from 3c093be to e691df7 Compare November 24, 2025 23:37
@rznn7 rznn7 force-pushed the feat/add-rule-no-implicit-takeuntil-destroyed branch from e691df7 to 29561f9 Compare December 7, 2025 18:45
@rznn7

rznn7 commented Dec 7, 2025

Copy link
Copy Markdown
Contributor Author

Hi ! May I ask a review for this PR?

@nx-cloud

nx-cloud Bot commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 585e278

Command Status Duration Result
nx run-many -t test ✅ Succeeded 5s View ↗
nx run-many -t build ✅ Succeeded 12s View ↗
nx run-many -t test --configuration ci ✅ Succeeded <1s View ↗
nx run-many -t build typecheck test check-rule-... ✅ Succeeded 4m 11s View ↗
nx-cloud record -- pnpm nx sync:check ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm format-check ✅ Succeeded 6s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-01 16:16:21 UTC

nx-cloud[bot]

This comment was marked as outdated.

@JamesHenry JamesHenry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for the delay and the need for your to rebase @rznn7. You will also please need to address the CI feedback.

Worth noting it would not report takeUntilDestroyed() usage in a constructor that is not in a @component or @Injectable, but I assumed it was out of scope for this rule.

I'm not seeing anything in your code or tests that backs this up, why do you feel this would be the case?


I think we should link to https://angular.dev/guide/di/dependency-injection-context where you currently have (constructor or field initializer) in the error message

@rznn7

rznn7 commented Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

No worries, thank for your answer!

Worth noting it would not report takeUntilDestroyed() usage in a constructor that is not in a @component or @Injectable, but I assumed it was out of scope for this rule.

I'm not seeing anything in your code or tests that backs this up, why do you feel this would be the case?

I meant that it would not report an error in the constructor of a class that is not an @Injectable or @Component even so it would not be correct to do so. (The rule simply check if it is called from a constructor). Do you think we should also check that the class is being instantiated by the DI system? Sorry if I this is not clear 😅.

edit: added failing test case for this: #2803 (comment)

@rznn7 rznn7 force-pushed the feat/add-rule-no-implicit-takeuntil-destroyed branch from 29561f9 to e492e31 Compare December 8, 2025 23:03
@rznn7 rznn7 force-pushed the feat/add-rule-no-implicit-takeuntil-destroyed branch from e492e31 to ba0e5b5 Compare December 8, 2025 23:09
@JamesHenry

Copy link
Copy Markdown
Member

I meant that it would not report an error in the constructor of a class that is not an @Injectable or @component

But it WILL though?? You haven't added any code to prevent that, nor tests to prove that, that's what I'm saying. You are saying it would not do that, but it will?

@JamesHenry

JamesHenry commented Dec 9, 2025

Copy link
Copy Markdown
Member

Maybe this is a language barrier, did you mean that it should not? And that you haven't implemented it yet?

@rznn7 rznn7 force-pushed the feat/add-rule-no-implicit-takeuntil-destroyed branch 2 times, most recently from bbfa5a5 to 4724e4d Compare December 9, 2025 20:39
@rznn7 rznn7 requested a review from JamesHenry December 9, 2025 20:41
nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

@JamesHenry

Copy link
Copy Markdown
Member

Failing CI

@JamesHenry

Copy link
Copy Markdown
Member

Otherwise LGTM

@rznn7 rznn7 force-pushed the feat/add-rule-no-implicit-takeuntil-destroyed branch from 926f4a2 to cd0bce3 Compare December 16, 2025 12:50
@rznn7

rznn7 commented Dec 16, 2025

Copy link
Copy Markdown
Contributor Author

Hope it works now 👍

@nx-cloud nx-cloud Bot 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.

Important

A new CI pipeline execution was requested that may update the conclusion below...

Nx Cloud has identified a possible root cause for your failed CI:

Our E2E tests are failing due to a pre-existing infrastructure issue where @angular-eslint/template-parser distribution files are missing from the test registry. The similar-task-failure-detector confirmed this same error exists in the main branch. Since this PR only adds a new ESLint rule and doesn't modify the template-parser package or build configuration, these failures are unrelated to the PR changes and require infrastructure fixes to the template-parser build/packaging pipeline.

No code changes were suggested for this issue.

If the issue was transient, you can trigger a rerun by pushing an empty commit:

git commit --allow-empty -m "chore: trigger rerun"
git push

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

@JamesHenry JamesHenry merged commit 97e7f88 into angular-eslint:main Jan 1, 2026
6 checks passed
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