https://github.com/haasstefan/eslint-plugin-enforce-angular-signal-call
An eslint plugin that enforces Angular signals to be accessed via their getter
https://github.com/haasstefan/eslint-plugin-enforce-angular-signal-call
angular angular-signals eslint typescript-eslint
Last synced: 30 days ago
JSON representation
An eslint plugin that enforces Angular signals to be accessed via their getter
- Host: GitHub
- URL: https://github.com/haasstefan/eslint-plugin-enforce-angular-signal-call
- Owner: HaasStefan
- Created: 2024-09-25T20:06:43.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-06T21:20:02.000Z (about 1 year ago)
- Last Synced: 2025-10-06T22:59:49.248Z (30 days ago)
- Topics: angular, angular-signals, eslint, typescript-eslint
- Language: TypeScript
- Homepage:
- Size: 62.5 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `enforce-angular-signal-call`
An eslint plugin which enforces that Angular signals are called with the getter.
## Rules
| Name | Description |
| :----------------------------------------------------------------------- | :------------------------------------------------------ |
| [enforce-angular-signal-call](docs/rules/enforce-angular-signal-call.md) | Enforce that Angular signals are called with the getter |
## Example
```ts
const mySignal = signal(false);
console.log(mySignal); // ❌
console.log(mySignal()); // ✅
if (mySignal) { // ❌
console.log('mySignal is truthy');
}
if (mySignal()) { // ✅
console.log('mySignal() is truthy');
}
```
## Installation
```npm install --save-dev eslint-plugin-angular-signal-call```
## Usage
Add `angular-signal-call` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
```json
{
"plugins": [
"enforce-angular-signal-call"
]
}
```
Then configure the rules you want to use under the rules section.
```json
{
"rules": {
"enforce-angular-signal-call/enforce-angular-signal-call": "warn"
}
}
```