Vize

vue/html-quotes

HTML 属性値の引用符を揃えます。

既定の重大度 プリセット 自動修正 オプション
warning happy-path, nuxt, ecosystem, opinionated あり ルールのオプション

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

悪い例

属性の値にシングルクォートを使うか、クォートを省略しています。

<template>
  <div class='foo'></div>
  <div class=foo></div>
  <div v-if='ready'></div>
</template>

良い例

通常の属性とディレクティブの式をダブルクォートで囲みます。

<template>
  <div class="foo"></div>
  <div v-if="ready"></div>
</template>

設定(Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "vue/html-quotes": "warn"
    }
  },
});

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

関連ページ