v-on-event-hyphenation
Angular templatesHTMLVue / SvelteVue / Sveltestyleno fixdefault: warnhtml/eslint-plugin-vue-recommended
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”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).
Example
Section titled “Example”... <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>Configuration
Section titled “Configuration”angular: lint: rules: v-on-event-hyphenation: warn # off, warn (default), errorhtml: lint: rules: v-on-event-hyphenation: warn # off, warn (default), errorsvelte: lint: rules: v-on-event-hyphenation: warn # off, warn (default), errorvue: lint: rules: v-on-event-hyphenation: warn # off, warn (default), errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”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 |