Vize

ecosystem/tailwind-enforce-consistent-line-wrapping

長い Tailwind CSS のクラスリストを一貫した方法で折り返します。

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

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

悪い例

クラスリストのせいで行が 80 文字を超えています。

<template>
  <div class="flex items-center justify-between gap-4 rounded-lg border border-slate-200 bg-white p-4 shadow-sm">Card</div>
</template>

良い例

クラスを字下げした行に折り返し、80 文字以内に収めます。

<template>
  <div class="
    flex items-center justify-between gap-4 rounded-lg border border-slate-200
    bg-white p-4 shadow-sm
  ">Card</div>
</template>

設定(Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "ecosystem/tailwind-enforce-consistent-line-wrapping": "warn"
    }
  },
});

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

関連ページ