Skip to content

no-object-in-text-mustaches

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.

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.

Reported
...
<C>{#snippet children(x)}{x}{/snippet}</C>
...
<p>{{ a: 1 }} {[1]} {function () {}} {text}</p>
...
After the fix
...
<C>{#snippet children(x)}{x}{/snippet}</C>
...
<p>{{ a: 1 }} {[1]} {function () {}} {text}</p>
...
angular:
lint:
rules:
no-object-in-text-mustaches: warn # off, warn (default), error
html:
lint:
rules:
no-object-in-text-mustaches: warn # off, warn (default), error
svelte:
lint:
rules:
no-object-in-text-mustaches: warn # off, warn (default), error
vue:
lint:
rules:
no-object-in-text-mustaches: warn # off, warn (default), error

Enabled 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.

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)