Pattern: Use of unnecessary mustache
Issue: -
This rule reports mustache interpolation with a string literal value.
The mustache interpolation with a string literal value can be changed to a static contents.
<template>
<!-- ✓ GOOD -->
Lorem ipsum
{{ foo }}
<!-- ✗ BAD -->
{{ 'Lorem ipsum' }}
{{ "Lorem ipsum" }}
{{ `Lorem ipsum` }}
</template>
{
"vue/no-useless-mustaches": ["error", {
"ignoreIncludesComment": false,
"ignoreStringEscape": false
}]
}
ignoreIncludesComment
... Iftrue
, do not report expressions containing comments. defaultfalse
.ignoreStringEscape
... Iftrue
, do not report string literals with useful escapes. defaultfalse
.
<template>
<!-- ✓ GOOD -->
{{ 'Lorem ipsum'/* comment */ }}
<!-- ✗ BAD -->
{{ 'Lorem ipsum' }}
</template>
<template>
<!-- ✓ GOOD -->
{{ 'Lorem \n ipsum' }}
</template>