Skip to content

An eslint plugin that enforces Angular signals to be accessed via their getter

Notifications You must be signed in to change notification settings

HaasStefan/eslint-plugin-enforce-angular-signal-call

Repository files navigation

enforce-angular-signal-call

An eslint plugin which enforces that Angular signals are called with the getter.

Rules

Name Description
enforce-angular-signal-call Enforce that Angular signals are called with the getter

Example

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:

{
    "plugins": [
        "enforce-angular-signal-call"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "enforce-angular-signal-call/enforce-angular-signal-call": "warn"
    }
}

About

An eslint plugin that enforces Angular signals to be accessed via their getter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published