ESLint is a linter for javascript used for ensuring better smell of code, if we develop our application instead of fixing errors and warings already existed, bad practices will pass on, and one day we find there is an extreme error in our porject but it's already too late to fix.
Collect all the rules which are not passed.
Checkout each rule's documentations.
eslint-plugin-vue
documentation, it indicates how the code be defined as good or bad, and how to ignore the rule by configuration.Checkout scope for change.
Fix or ignore problems.
Repeat iterating steps 2 ~ 4 until your console is neat for debugging.
Focus on errors and warning occurs by eslint-plugin-vue
.
vue/no-mutating-props
Remember one thing for all modern frontend framworks: always keep data flow top down.
Find out the component which executes the invalid mutation.
Replace direct mutation with emitter.
For a deeper prop, a computed variable or vuex state variable is recommended.
Check data flows in both parent and children work normally.
vue/multi-word-component-names
The reason to fix this problem is to prevent conflicted same name with native DOM element name.
For components, I add component name or rename file names to fix it.
For routes, I can't cahnge the route name with restriction of specification, I ignore it by configuration.
vue/attribute-hyphenation
vue/no-lone-template
vue/valid-v-slot
For the usage of bootstrap-vue
table key mapping, I ignore it by configuration.
Errors and warning are reduced by 87.5%.
the terminal is neater. Developers can get feedback by ESLint immediately 🎉.
Before v6.3.0
After v6.7.0
Work
JavaScript
Vue