a11y/aria-props
存在しない ARIA 属性を検出します。
| 既定の重大度 | プリセット | 自動修正 | オプション |
|---|---|---|---|
error |
happy-path, nuxt, ecosystem, opinionated |
なし | なし |
適用範囲:Vue SFC のテンプレートと各ブロック。ルールに必要な script の文脈も例に含めています。
悪い例
aria-lable は綴りが誤っており、有効な ARIA 属性ではありません。
<template>
<button aria-lable="Save changes">Save</button>
</template>
良い例
正しい aria-label に変更してボタンの名前を指定します。
<template>
<button aria-label="Save changes">Save</button>
</template>
設定(Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"a11y/aria-props": "error"
}
},
});
設定したら vp run lint を実行します。