attribute-hyphenation
Angular templatesHTMLVue / SvelteVue / Sveltestyleno fixdefault: warnhtml/eslint-plugin-vue-recommended
What it does
Section titled “What it does”Reports a prop of a component that is written in camelCase (:cardTitle). A component is a tag in PascalCase or with a hyphen; HTML and SVG elements are not checked. Only in .vue files.
Why it matters
Section titled “Why it matters”In a template the HTML parser lowercases attribute names, so only kebab-case reads the same in every kind of template, and one style keeps the props easy to search for.
To fix, write the prop in kebab-case (:card-title).
Example
Section titled “Example”<template> <MyCard v-bind:title="t" v-on:click="go" :cardTitle="c" cardSub="s" my-prop="p" :ok="1" :cardOther="o">... <template v-slot="p">d</template> </MyCard>...<template> <MyCard :title="t" @click="go" :cardTitle="c" cardSub="s" my-prop="p" :ok="1" :cardOther="o">... <template v-slot="p">d</template> </MyCard>...Configuration
Section titled “Configuration”angular: lint: rules: attribute-hyphenation: warn # off, warn (default), errorhtml: lint: rules: attribute-hyphenation: warn # off, warn (default), errorsvelte: lint: rules: attribute-hyphenation: warn # off, warn (default), errorvue: lint: rules: attribute-hyphenation: warn # off, warn (default), errorEnabled by the presets: html/eslint-plugin-vue-recommended.
Suppress one line with sudsy-disable-next-line attribute-hyphenation in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint-plugin-vue | attribute-hyphenation |
full |