Vize

ecosystem/tailwind-no-unknown-classes

Tailwind CSS が生成しないクラスを検出します。

既定の重大度 プリセット 自動修正 オプション
warning なし なし ルールのオプション

適用範囲:Vue SFC のテンプレートと各ブロック。ルールに必要な script の文脈も例に含めています。

悪い例

rounded-wer は Tailwind が CSS を生成しない書き間違いです。

<template>
  <div class="flex rounded-wer">Tailwind</div>
</template>

良い例

rounded-lg は Tailwind のデザインシステムが生成するクラスです。

<template>
  <div class="flex rounded-lg">Tailwind</div>
</template>

設定(Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "ecosystem/tailwind-no-unknown-classes": "warn"
    },
    "tailwind": {
      "entry": "./src/app.css"
    }
  },
});

設定したら vp run lint を実行します。

関連ページ