Programming/JavaScript & TypeScript

[Vue, ESLint airbnb, Prettier] Vue 프로젝트에 eslint airbnb 확장 추가하기 + eslint-prettier 연동하기

Bonita SY 2022. 3. 4. 22:10
728x90
반응형

 1. Vue 프로젝트 ESLint 설정에 airbnb 확장 추가하기 

npm v5 이상

 npx install-peerdeps --dev eslint-config-airbnb



https://www.npmjs.com/package/eslint-config-airbnb

 

eslint-config-airbnb

Airbnb's ESLint config, following our styleguide. Latest version: 19.0.4, last published: 2 months ago. Start using eslint-config-airbnb in your project by running `npm i eslint-config-airbnb`. There are 3988 other projects in the npm registry using eslint

www.npmjs.com

 

.eslintrc

{
  "extends": [
    "airbnb",
    ...
  ],
  ...
}

 

 

 2. eslint에 prettier 설정 추가하기 

npm i --save-dev eslint-plugin-prettier eslint-config-prettier

 

 

https://www.npmjs.com/package/eslint-plugin-prettier

 

eslint-plugin-prettier

Runs prettier as an eslint rule. Latest version: 4.0.0, last published: 6 months ago. Start using eslint-plugin-prettier in your project by running `npm i eslint-plugin-prettier`. There are 4874 other projects in the npm registry using eslint-plugin-pretti

www.npmjs.com

 

.eslintrc

{
  "extends": [
    "airbnb",
    "prettier",
    ...
  ],
  ...
  "rules" : {
    "prettier/prettier": "error",
    ...
  },
  ...
}

 

728x90
반응형