Skip to content

v-on-event-hyphenation

Reports an event of a component that is written in camelCase (@cardOpen). A component is a tag in PascalCase or with a hyphen; HTML and SVG elements are not checked. Only in .vue files.

Event names in a template are read in lowercase by the HTML parser, so kebab-case is the one form that works in every kind of template, and the component emits it in the same style.

To fix, write the event in kebab-case (@card-open).

Reported
...
<a v-if="ok" :href="u" @click="go">x</a>
<input v-bind="props" :id="i" v-model="m">
<MyCard @cardOpen="go" @card-close="go" @click="go" />
</div>
</template>
angular:
lint:
rules:
v-on-event-hyphenation: warn # off, warn (default), error
html:
lint:
rules:
v-on-event-hyphenation: warn # off, warn (default), error
svelte:
lint:
rules:
v-on-event-hyphenation: warn # off, warn (default), error
vue:
lint:
rules:
v-on-event-hyphenation: warn # off, warn (default), error

Enabled by the presets: html/eslint-plugin-vue-recommended.

Suppress one line with sudsy-disable-next-line v-on-event-hyphenation in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
eslint-plugin-vue v-on-event-hyphenation partial always only, no ignore list