Skip to content

no-useless-mustaches

Reports a string literal in { } ({"text"}).

It is only text, so the braces and the quotes add noise and suggest a value that is computed.

To fix, write the text without the braces.

Reported
...
<C>{#snippet children(x)}{x}{/snippet}</C>
...
<p>{"text"} {'it'} {`tpl`} {`a${b}`} {"a'b"} {text}</p>
...
After the fix
...
<C>{#snippet children(x)}{x}{/snippet}</C>
...
<p>{"text"} {'it'} {`tpl`} {`a${b}`} {"a'b"} {text}</p>
...
angular:
lint:
rules:
no-useless-mustaches: warn # off, warn (default), error
html:
lint:
rules:
no-useless-mustaches: warn # off, warn (default), error
svelte:
lint:
rules:
no-useless-mustaches: warn # off, warn (default), error
vue:
lint:
rules:
no-useless-mustaches: warn # off, warn (default), error

Enabled by the presets: html/eslint-plugin-svelte-recommended.

Suppress one line with sudsy-disable-next-line no-useless-mustaches in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint-plugin-svelte no-useless-mustaches full