Vue3 를 한 번 써보고 있는데, VSCode 에서 lint on save 가 안되는 것이었다.
ESlint 플러그인 깔고, settings 설정도 다 해봤는데 저장할 때 lint 가 먹히지 않는 것.
찾아보니 .eslintrc.js 의 설정 중에 extends 부분이 있는데, 여기서 eslint 에 어떤 규칙을 적용할지 설정할 수 있다.
문서 참조
최초 설정이 아래 처럼 되어있었다.
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended'
],
문서 내용을 보면 recommended 옵션을 적용해야 일관성을 강제할 수 있다고 한다.
[영어] Configurations for using Vue.js 3.x:
"plugin:vue/base" ... Settings and rules to enable correct ESLint parsing.
Configurations for using Vue.js 3.x:
"plugin:vue/vue3-essential" ... base, plus rules to prevent errors or unintended behavior.
"plugin:vue/vue3-strongly-recommended" ... Above, plus rules to considerably improve code readability and/or dev experience.
"plugin:vue/vue3-recommended" ... Above, plus rules to enforce subjective community defaults to ensure consistency.
[한글] Vue.js 3.x 사용을 위한 구성:
"plugin:vue/vue3-essential"... base, 오류나 의도하지 않은 동작을 방지하기 위한 규칙.
"plugin:vue/vue3-strongly-recommended"... 위에 코드 가독성 및/또는 개발 경험을 크게 향상시키는 규칙이 추가되었습니다.
"plugin:vue/vue3-recommended"... 위에, 일관성을 보장하기 위해 주관적인 커뮤니티 기본값을 적용하는 규칙이 추가되었습니다.
문서에 따라 아래처럼 설정을 바꾸면 이제 lint 가 저장할 때 적용된다.
'extends': [
'plugin:vue/vue3-recommended',
'eslint:recommended'
],