banana-in-box
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: errorhtml/angular-eslint-recommended
What it does
Section titled “What it does”Reports a two-way binding written the wrong way round, ([ngModel]). Only in .component.html files.
Why it matters
Section titled “Why it matters”([x]) is not a binding: Angular reads it as a property binding to a name that does not exist, and the template fails to compile or the binding does nothing.
To fix, write [(ngModel)]: the banana (round) goes in the box (square).
Example
Section titled “Example”<input ([ngModel])="a" [(ngModel)]="b" />...Configuration
Section titled “Configuration”angular: lint: rules: banana-in-box: error # off, warn, error (default)html: lint: rules: banana-in-box: error # off, warn, error (default)svelte: lint: rules: banana-in-box: error # off, warn, error (default)vue: lint: rules: banana-in-box: error # off, warn, error (default)Enabled by the presets: html/angular-eslint-recommended.
Suppress one line with sudsy-disable-next-line banana-in-box in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| angular-eslint | banana-in-box |
full |