ecosystem/tailwind-enforce-canonical-classes
Enforce Tailwind CSS's canonical spelling of classes.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
None | Yes | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
p-[16px] spells a theme value as an arbitrary value.
<template>
<div class="flex p-[16px]">Tailwind</div>
</template>
Good
p-4 is Tailwind's spelling of the same padding.
<template>
<div class="flex p-4">Tailwind</div>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"ecosystem/tailwind-enforce-canonical-classes": "warn"
},
"tailwind": {
"entry": "./src/app.css"
}
},
});
Then run vp run lint.