vue/enforce-style-attribute
Enforce allowed style-block attributes.
| 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.
Bad
The module style mode is outside the configured allow list.
<template><div /></template>
<style module>.card { color: red }</style>
Good
The scoped style mode is allowed by the project policy.
<template><div /></template>
<style scoped>.card { color: red }</style>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/enforce-style-attribute": "warn"
},
"ruleOptions": {
"vue/enforce-style-attribute": {
"allow": [
"scoped"
]
}
}
},
});
Then run vp run lint.