Skip to content

Add config/rules that comply with our Vue.js style guide

Our Vue.js style guide contains many dos and don'ts about writing Vue code. Rather than document these, and rely on reviewers to catch/discuss these, we should just automatically lint against them.

I'd even be in favour of removing the documentation that we implement lint rules for.

The styles we document that we could lint for include:

Name Lintable? Do we lint it?
Reference Naming: Use PascalCase for component definitions Link 🔶 Soon!
Props Naming: Avoid using DOM attribute prop names. Rule is missing
Props Naming: Use kebab-case instead of camelCase to provide props in templates. Link
Always use double quotes " inside templates Link
Props should be declared as an object Link
Required key should always be provided when declaring a prop Link
Default key should be provided if the prop is not required Link
data method should always be a function Link
Shorthand @ is preferable over v-on Link
Shorthand : is preferable over v-bind Link
Shorthand # is preferable over v-slot Link
Prefer self-closing component tags Link
Tag order in .vue file Link Link
Absolute vs relative paths for modules (don't import from more than two levels up) Rule is missing
Use kebab-case for components in templates Link 🔶 Soon!
Edited by Mark Florian