npm install eslint --save-dev
$ npx eslint --init
$ npx eslint yourfile.js
Ctrl + C
를 눌러 과정을 중지할 수 있습니다.It is also possible to install ESLint globally rather than locally (using npm install eslint --global). However, this is not recommended, and any plugins or shareable configs that you use must be installed locally in either case.
ESLint를 global로 설치하는 것을 추천하지 않는 이유는 무엇인가요?
global로 dependency를 설치하는 것과 특정 프로젝트에만 국한되게(locally) 설치하는 것의 차이는 무엇인가요?
After running eslint --init, you'll have a
.eslintrc.{js,yml,json}
file in your directory. In it, you'll see some rules configured like this:
{
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "double"]
}
}
npm run lint
를 실행한 결과에서, lint 에러를 잡아낼 수 있다면 성공적으로 설정한 것입니다.no-unused-vars
라는 에러를 내게 됩니다.