require-for-track
What it does
Section titled “What it does”Reports an @for block with no track expression. Only in .component.html files.
Why it matters
Section titled “Why it matters”Angular needs the expression to tell the items of the list apart, and it stops the build without it. With a good key it moves the elements when the list changes instead of rebuilding them.
To fix, add ; track item.id (a unique value of the item) to the @for.
Example
Section titled “Example”...<p *ngIf="!a$ | async"></p>...@for (x of xs) { <i></i> }@for (x of xs; track x.id) { <i></i> }Configuration
Section titled “Configuration”angular: lint: rules: require-for-track: error # off, warn, error (default)html: lint: rules: require-for-track: error # off, warn, error (default)svelte: lint: rules: require-for-track: error # off, warn, error (default)vue: lint: rules: require-for-track: error # off, warn, error (default)Suppress one line with sudsy-disable-next-line require-for-track in a comment of the file’s language.