Skip to content

attribute-hyphenation

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.

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).

Reported
<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>
...
After the fix
<template>
<MyCard :title="t" @click="go" :cardTitle="c" cardSub="s" my-prop="p"
:ok="1"
:cardOther="o">
...
<template v-slot="p">d</template>
</MyCard>
...
angular:
lint:
rules:
attribute-hyphenation: warn # off, warn (default), error
html:
lint:
rules:
attribute-hyphenation: warn # off, warn (default), error
svelte:
lint:
rules:
attribute-hyphenation: warn # off, warn (default), error
vue:
lint:
rules:
attribute-hyphenation: warn # off, warn (default), error

Enabled 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.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint-plugin-vue attribute-hyphenation full