Vize

vue/require-macro-variable-name

コンパイラーマクロの変数名を既定の名前に揃えます。

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

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

悪い例

defineProps の結果を p に束縛しています。

<script setup>
const p = defineProps({ value: String })
</script>
<template />

良い例

規定の props という名前でマクロの結果を示します。

<script setup>
const props = defineProps({ value: String })
</script>
<template />

設定(Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "vue/require-macro-variable-name": "warn"
    }
  },
});

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

関連ページ