vue/no-restricted-class
eslint-plugin-vue
No autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-restricted-class": "error",
},
},
];<div class="forbidden" />
<div :class="{ forbidden: someBoolean }" />
<div :class="`forbidden ${someString}`" />
<div :class="'forbidden'" />
<div :class="'forbidden ' + someString" />
<div :class="[someString, 'forbidden']" /> <div class="allowed-class" />
</template>
<script>
export default {
props: {
someBoolean: Boolean,
someString: String,
}
}
</script>Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vue/no-restricted-class
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-restricted-class": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow a potential typo in your component property