eqeqeq
Angular templatesHTMLVue / SvelteVue / Sveltesuspiciousno fixdefault: warnhtml/angular-eslint-recommended
What it does
Section titled “What it does”Reports == and != in the bindings, interpolations and block parameters of an Angular template. Only in .component.html files.
Why it matters
Section titled “Why it matters”The loose operators convert their operands before they compare, so 0 == '' and null == undefined are true and the template shows content for a value the author did not mean.
To fix, write === and !==.
Example
Section titled “Example”...<p *ngIf="a == b && c !== d">{{ a != b ? "x == y" : 1 }}</p>...<p *ngIf="!a$ | async"></p>@if (a == 1) { <b></b> }...@for (x of xs; track x.id) { <i></i> }Configuration
Section titled “Configuration”angular: lint: rules: eqeqeq: warn # off, warn (default), errorhtml: lint: rules: eqeqeq: warn # off, warn (default), errorsvelte: lint: rules: eqeqeq: warn # off, warn (default), errorvue: lint: rules: eqeqeq: warn # off, warn (default), errorEnabled by the presets: html/angular-eslint-recommended.
Suppress one line with sudsy-disable-next-line eqeqeq in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| angular-eslint | eqeqeq |
partial | allowNullOrUndefined is not an option |