vue/no-boolean-attr-value
Disallow explicit values for boolean HTML attributes
Default severity: warning
Presets: nuxt, opinionated
Automatic fix: Available for supported findings
Applies to: Vue SFC templates and blocks, with script context where the rule requires it
Options: No rule-specific options. Severity and preset selection are configurable.
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({
lint: {
vize: {
"preset": "incremental",
"rules": {
"vue/no-boolean-attr-value": "warn"
}
},
},
});
vp run lint
Bad
The boolean disabled and checked attributes redundantly contain string values.
<template>
<input disabled="disabled" />
<input checked="checked" />
<button disabled="true">Save</button>
</template>
Good
The presence of each boolean attribute expresses the same enabled state without a value.
<template>
<input disabled />
<input checked />
<button disabled>Save</button>
</template>
Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.