https://eslint.org/

외부 모듈

 

globals

 

nuxt.config.js에서 전역으로 script를 선언하고 페이지나 컴포넌트에서 사용하려고 하면 no-def 오류가 발생한다. 

이럴경우 eslint의 설정을 바꿔주는 것으로 해결 할 수 있다.

 

.eslintrc.js

  ...
  "globals": {
    'daum': true
  }

 

또한 외부 모듈파일인 js 파일도 eslint를 적용시키는데 .eslintignore 파일을 통해 무시할 수 있다.

 

.eslintignore

static/vendor/brython/brython-runner.bundle.js

 

console.log

https://eslint.org/docs/rules/no-console

 

eslint에서 console.log를 사용하면 경고를 표시한다.

{
    "rules": {
        "no-console": "off",
        "no-restricted-syntax": [
            "error",
            {
                "selector": "CallExpression[callee.object.name='console'][callee.property.name!=/^(log|warn|error|info|trace)$/]",
                "message": "Unexpected property on console object was called"
            }
        ]
    }
}

을 통해 console.log에 대한 경고 표시를 종료할 수 있다.

'Front-End > Vue & Nuxt' 카테고리의 다른 글

Nuxt.js Auth (Naver)  (0) 2022.03.01
Nuxt.js Lottie 사용하기  (0) 2022.02.27
Nuxt.js Buefy Pagination  (0) 2022.02.26
Nuxt.js 유용한 모듈 정리  (0) 2022.02.26
Nuxt.js SCSS 사용  (0) 2022.02.26

+ Recent posts