Skip to content

Instantly share code, notes, and snippets.

@sorenlouv
Last active April 16, 2018 00:46
Show Gist options
  • Save sorenlouv/206d54102a801d893942df85db049c8f to your computer and use it in GitHub Desktop.
Save sorenlouv/206d54102a801d893942df85db049c8f to your computer and use it in GitHub Desktop.
ESLint + prettier setup

Install packages

yarn add eslint prettier eslint-{config,plugin}-prettier eslint-plugin-react  --dev --exact

package.json

{
  "scripts": {
    "lint": "prettier \"./src/**\" && eslint ./src"
  }
}

.eslintrc.json

{
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 8,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "env": {
    "browser": true,
    "node": true,
    "jest": true
  },
  "rules": {
    "no-console": "off",
    "react/prop-types": "off",
    "prettier/prettier": [
      "error",
      {
        "singleQuote": true,
        "semi": true
      }
    ],
    "no-unused-vars": ["error", { "ignoreRestSiblings": true }]
  },
  "plugins": ["react", "prettier"],
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended",
    "prettier",
    "prettier/react"
  ]
}
@lipis
Copy link

lipis commented Nov 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment