Skip to content

Instantly share code, notes, and snippets.

@agneym
Created February 24, 2020 17:27
Show Gist options
  • Save agneym/e86dd0832fe5482c4a75b055a6c1bdbf to your computer and use it in GitHub Desktop.
Save agneym/e86dd0832fe5482c4a75b055a6c1bdbf to your computer and use it in GitHub Desktop.
Prettier with AirBnB ESLint Config

Install:

npm i prettier --save-exact
npm i husky lint-staged eslint-config-prettier

On eslintrc.js:

extends: [
  'airbnb',
  'airbnb/hooks',
  'prettier',
  'prettier/react',
]

In package.json:

{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.js": [
      "eslint --fix",
      "prettier --write",
      "git add"
    ]
  },
  "prettier": {
    "trailingComma": "es5",
    "singleQuote": true
  },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment