Vue

vue/multi-word-names

Name components with two or more words (TodoItem, not Item); App, pages and layouts are exempt.

drobnastatycznefe-vue

Dlaczego

HTML element names are single words, and new ones keep being added (<search> arrived in 2023). A component called Header, Button or Dialog is written <header>, <button> or <dialog> in in-DOM templates and kebab-case, where it is the native element, and a name like Item says nothing about what it is.

Poprawka

Rename the file and its uses to two or more words: AppHeader.vue, BaseButton.vue, TodoItem.vue. A common prefix (App, Base, The) groups app-wide components. Route views (pages/, views/), layouts and the root App.vue are not used as tags and need no change.

Przykłady

bad:  components/Header.vue   components/Item.vue
good: components/AppHeader.vue   components/TodoItem.vue

Źródła

Fakty

Identyfikator
vue/multi-word-names
Waga
drobna
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
project
Tylko w projektach z
vue nuxt
Uczy jej skill
fe-vue Vue components
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain vue/multi-word-names