vue/no-bare-strings-in-template
Disallow raw human-readable text in the template that should be internationalized.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
None | No | Rule options |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
The allowlist replaces eslint-plugin-vue's punctuation defaults when present. Entries are literal substrings or /pattern/flags values using Rust regex syntax and are removed before the remaining text is checked; patterns that do not compile remain literals. Omit allowlist to retain the defaults; [] clears them. Options do not enable the rule.
Bad
Visible text embeds an untranslated string directly in the template.
<template>
<p>Translate me</p>
</template>
Good
The keyboard label comes from $t instead of a bare template string.
<template>
<kbd>{{ $t("keyboard.forward") }}</kbd>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-bare-strings-in-template": "warn"
},
"ruleOptions": {
"vue/no-bare-strings-in-template": {
"allowlist": [
"/^[DRWXYmvx]$/u"
]
}
}
},
});
Then run vp run lint.