musea/valid-variant
Require name attribute in <variant> blocks
Default severity: error
Presets: none
Automatic fix: None; review the suggested change
Applies to: Musea .art.vue art, variant, and style blocks
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": {
"musea/valid-variant": "error"
}
},
},
});
vp run lint
Bad
The variant omits the name needed to identify the preview.
<art title="Button" component="./Button.vue">
<variant />
</art>
Good
The primary name identifies that variant.
<art title="Button" component="./Button.vue">
<variant name="primary" />
</art>
Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.