a11y/heading-levels
Disallow skipping heading levels.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
nuxt, opinionated |
No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
The heading sequence jumps directly from h1 to h3, skipping level two.
<template>
<h1>Account</h1>
<h3>Billing</h3>
</template>
Good
Changing the billing heading to h2 preserves a consecutive heading hierarchy.
<template>
<h1>Account</h1>
<h2>Billing</h2>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"a11y/heading-levels": "warn"
}
},
});
Then run vp run lint.