vue/html-quotes
Enforce quotes style of HTML attributes.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
happy-path, nuxt, ecosystem, opinionated |
Yes | Rule options |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
The attributes use single quotes or no quotes instead of the double-quote convention.
<template>
<div class='foo'></div>
<div class=foo></div>
<div v-if='ready'></div>
</template>
Good
Both ordinary attributes and directive expressions use double quotes.
<template>
<div class="foo"></div>
<div v-if="ready"></div>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/html-quotes": "warn"
}
},
});
Then run vp run lint.