Vize

a11y/no-redundant-roles

要素本来の意味と重複する ARIA role を検出します。

悪い例 · 良い例

既定の重大度: warning
プリセット: happy-path, nuxt, ecosystem, opinionated
自動修正: 対応する検出で利用可能
適用範囲: Vue SFC のテンプレート・ブロック。必要な script の文脈も例に含めています。
オプション: ルール固有のオプションはありません。重大度とプリセットは設定できます。

設定(Vite+)

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

export default defineConfig({
  lint: {
    vize: {
      "preset": "incremental",
      "rules": {
        "a11y/no-redundant-roles": "warn"
      }
    },
  },
});
vp run lint

悪い

button は元から button の役割を持つため、同じ role を重複して指定しています。

<template>
  <button role="button">Save</button>
</template>

良い

重複する role を取り除き、HTML の標準の役割を使います。

<template>
  <button>Save</button>
</template>

良い例は上記の設定でこのルールの検出を避ける例です。他のルールでは検出される場合があります。

実装 · 全ルール