일기장/오류일기

[Vue.js] EsLint 오류 잡아보기

살찐만두 2022. 6. 24. 11:24
728x90

 vue.js 를 처음 시작했다.

 

얼레벌레 따라하는데 

알 수 없는 오류들이 와장창 났다.

mixed spaces and tabs,

"OO" is defined but never used 

component name "OO" should always be multi-word 

 

알아보니까 EsLint가 오류를 걸러줄 때 저런 아이들 까지 모두 걸리기 때문에

원치 않으면 따로 설정을 해줘야 한다고 한다.

 

처음 찾아본거는 vue.config.js 파일에

module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave : false
})

lintOnSave:false 를 해주면 된다고 해서 했는데

오류가 나진 않는다.

 

그런데 왠지 모든 오류를 다 무시해버리는 느낌이라서 저렇게 안하고 싶은 마음이 들었다.

 

다른방법은

 

package.json 파일에서 "eslintConfig" 부분을 찾고 rules에 추가해준다.

    "rules": {
      "no-unused-vars": "off",
      "no-mixed-spaces-and-tabs": 0,
      "vue/multi-word-component-names": 0
    }

eslint 의 no-unused-vars, no-mixed-spaces-and-tabs, vue/multi-word-component-names 의 오류를 무시하는 코드를 

추가해주면 저부분만 무시하고 지나갈 수 있는 것 같다.

 

오류 고치기 성공.

728x90