An open API service indexing awesome lists of open source software.

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

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"
}
}
```