html/no-dupe-style-properties
Disallow duplicate properties in inline style attributes
Default severity: warning
Presets: nuxt, opinionated
Automatic fix: None; review the suggested change
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": {
"html/no-dupe-style-properties": "warn"
}
},
},
});
vp run lint
Bad
Each static style repeats one property; margin and MARGIN also count as the same property.
<template>
<div style="color: red; color: blue">text</div>
<div style="margin: 0; MARGIN: 1px">text</div>
</template>
Good
The static style uses distinct color and background properties. Dynamic style bindings are outside this static-attribute check.
<template>
<div style="color: red; background: blue">text</div>
<div :style="{ color: a, color: b }">text</div>
</template>
Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.