vue/no-bare-strings-in-template
eslint-plugin-vue
No autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-bare-strings-in-template": "error",
},
},
]; <h1>Lorem ipsum</h1>
<div
title="Lorem ipsum"
aria-label="Lorem ipsum"
aria-placeholder="Lorem ipsum"
aria-roledescription="Lorem ipsum"
aria-valuetext="Lorem ipsum"
/>
<img alt="Lorem ipsum">
<input placeholder="Lorem ipsum">
<h1 v-text="'Lorem ipsum'" />
<!-- Does not check -->
<h1>{{ 'Lorem ipsum' }}</h1>
<div
v-bind:title="'Lorem ipsum'"
/>
</template><h1>{{ $t('foo.bar') }}</h1>
<h1>{{ foo }}</h1>
<h1 v-t="'foo.bar'"></h1>Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vue/no-bare-strings-in-template
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-bare-strings-in-template": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce new lines between multi-line properties in Vue components
Enforce newlines between operands of ternary expressions in <template>
Disallow custom modifiers on v-model used on the component