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
vuenuxt- Uczy jej skill
fe-vueVue components- Od wersji
- 0.1.0
Przeczytaj w terminalu
npx github:dawidolko/frontend-skills explain vue/multi-word-names