자바스크립트

eslint 특정 대상 경고 끄기

마리오64 2020. 3. 8. 01:34

저번에 만든 vue 게시판의 npm 패키지 의존성 업데이트를 하면서 lint 규칙을 표준으로 바꿨더니

eslint 가 .env 파일에 있는 VUE_APP_ 상수를 경고하기 시작했습니다.

error: 'VUE_APP_BASE_URL' is not defined (no-undef) at src\components\member\SignUp.vue:82:14:
  80 |       this.axios({
  81 |         methods: 'post',
> 82 |         url: VUE_APP_BASE_URL + '/member/sigunup'
     |              ^
  83 |       })
  84 |     }
  85 |   },

저 경고때문에 빌드가 안되는 상황..

eslint 공식문서를보면

globals : {
	끄고싶은대상: false
}

 

parserOptions: {
    parser: 'babel-eslint'
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
  },
  globals: {
      VUE_APP_BASE_URL: false
    },