vue/prefer-separate-static-class
eslint-plugin-vue
Safe autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/prefer-separate-static-class": "error",
},
},
];Require static class names in template to be in a separate class attribute
<div :class="'static-class'" />
<div :class="{ 'static-class': true, 'dynamic-class': foo }" />
<div :class="['static-class', dynamicClass]" /> <div class="static-class" />
<div class="static-class" :class="{ 'dynamic-class': foo }" />
<div class="static-class" :class="[dynamicClass]" />
</template>Examples from the ESLint documentation.
vue/prefer-separate-static-class
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/prefer-separate-static-class": "error",
},
},
];Oxlint does not have this rule.
nursery/useVueSeparateStaticClass
nursery · since 2.6.5
{
"linter": {
"rules": {
"nursery": {
"useVueSeparateStaticClass": "error"
}
}
}
}Require component names to be always multi-word
Enforce Promise or callback style in nextTick
Disallow importing Vue compiler macros
Enforce or forbid the use of the scoped and module attributes in SFC top level style tags