Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prefer-readonly-signals] New rule for checking that signals are defined as readonly #1719

Open
m-thalmann opened this issue Feb 9, 2024 · 0 comments
Labels
package: eslint-plugin Angular-specific TypeScript rules triage This issue needs to be looked at and categorized by a maintainer

Comments

@m-thalmann
Copy link

Description and reproduction of the issue

The new Angular signals should only be updated using the .set() or .update() function, never overwritten.
For this reason I propose a new rule which checks that all signals are marked as readonly.

Incorrect examples

myCounter = signal(0);
anotherCounter = input(0);
doubleCounter = computed(() => this.myCounter() * 2);

Correct examples

readonly myCounter = signal(0);
// ...
@m-thalmann m-thalmann added package: eslint-plugin Angular-specific TypeScript rules triage This issue needs to be looked at and categorized by a maintainer labels Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: eslint-plugin Angular-specific TypeScript rules triage This issue needs to be looked at and categorized by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant