no-object-in-text-mustaches
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: warnhtml/eslint-plugin-svelte-recommended
What it does
Section titled “What it does”Reports an object, an array, a function or a class written in { } among text. It reads the first token of the expression, so an arrow function is not found.
Why it matters
Section titled “Why it matters”It renders as [object Object] or as the source of the function, which is never what the page should show.
To fix, use the value in an attribute or in code, or show a field of it.
Example
Section titled “Example”...<C>{#snippet children(x)}{x}{/snippet}</C>...<p>{{ a: 1 }} {[1]} {function () {}} {text}</p>......<C>{#snippet children(x)}{x}{/snippet}</C>...<p>{{ a: 1 }} {[1]} {function () {}} {text}</p>...Configuration
Section titled “Configuration”angular: lint: rules: no-object-in-text-mustaches: warn # off, warn (default), errorhtml: lint: rules: no-object-in-text-mustaches: warn # off, warn (default), errorsvelte: lint: rules: no-object-in-text-mustaches: warn # off, warn (default), errorvue: lint: rules: no-object-in-text-mustaches: warn # off, warn (default), errorEnabled by the presets: html/eslint-plugin-svelte-recommended.
Suppress one line with sudsy-disable-next-line no-object-in-text-mustaches 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 |
|---|---|---|---|
| eslint-plugin-svelte | no-object-in-text-mustaches |
partial | an arrow function is not found (the check reads the first token) |