Vize

a11y/heading-levels

見出しの階層を飛ばした指定を検出します。

悪い例 · 良い例

既定の重大度: warning
プリセット: nuxt, opinionated
自動修正: なし。修正内容を確認してください
適用範囲: Vue SFC のテンプレート・ブロック。必要な script の文脈も例に含めています。
オプション: ルール固有のオプションはありません。重大度とプリセットは設定できます。

設定(Vite+)

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

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

悪い

見出しが h1 から h3 に飛び、レベル 2 を省略しています。

<template>
  <h1>Account</h1>
  <h3>Billing</h3>
</template>

良い

請求設定の見出しを h2 にし、階層を順に並べます。

<template>
  <h1>Account</h1>
  <h2>Billing</h2>
</template>

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

実装 · 全ルール