Skip to content

Prettier Eslint Airbnb style

Yun Hwan, Kim edited this page Nov 11, 2019 · 3 revisions

Eslint

.eslintrc

{
    "parser": "babel-eslint",
    "env": {
        "browser": true,
        "node": true
    },
    "plugins": ["prettier"],
    // airbnb๊ฐ€ ๋จผ์ € ์™€์•ผํ•œ๋‹ค. ๊ทธ๋ž˜์•ผ prettier์™€ ๋ฌธ์ œ๊ฐ€ ๋˜๋Š” ์„ธํŒ…์„ ์ทจ์†Œํ•˜๋„๋ก ๋ฎ์„ ์ˆ˜ ์žˆ๋‹ค.
    "extends": ["airbnb", "prettier"],
    "rules": {
         "prettier/prettier": "error"
    }
}

Prettier

.prettierrc

{
  "trailingComma": "es5",
  "semi": true,
  "singleQuote": false,
  "tabWidth": 2
}

Package.json

"devDependencies": {
    "babel-eslint": "^10.0.3",
    "eslint": "^6.6.0",
    // airbnb style
    "eslint-config-airbnb": "^18.0.1",
    // prettier์™€ eslint๊ฐ„์— ์ถฉ๋Œ๋‚˜๋Š” ์„ค์ •์„ ๊บผ์ฃผ๋Š” ํŒจํ‚ค์ง€
    "eslint-config-prettier": "^6.5.0",
    // eslint, airbnb์— ์˜์กด์„ฑ์ด ๊ฑธ๋ฆฐ ํŒจํ‚ค์ง€๋“ค
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-react": "^7.16.0",
    // eslint์—์„œ prettier๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ํŒจํ‚ค์ง€
    "eslint-plugin-prettier": "^3.1.1",
    "prettier": "^1.19.0"
}