rjhilgefort
11/18/2017 - 2:18 AM

Prettier, Esling, Airbnb Setup

Why do I need a gist to get my language to a tolerable state. #ThanksObama

{
  "engines": {
    "node": ">=4"
  },
  "devDependencies": {
    "eslint": "^4.11.0",
    "eslint-config-airbnb-base": "^12.1.0",
    "eslint-config-prettier": "^2.7.0",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-prettier": "^2.3.1",
    "eslint-watch": "^3.1.3",
    "husky": "^0.14.3",
    "lint-staged": "^5.0.0",
    "prettier": "^1.8.2"
  },
  "scripts": {
    "lint": "esw *.js src test",
    "lint:fix": "esw --fix *.js src test",
    "lint:watch": "esw --watch *.js src test",
    "lint:staged": "lint-staged",
    "precommit": "lint-staged"
  },
  "lint-staged": {
    "*.js": "esw"
  },
  "eslintConfig": {
    "extends": [
      "airbnb-base",
      "prettier",
    ],
    "plugins": [
      "prettier"
    ],
    "parserOptions": {
      "sourceType": "module",
      "ecmaFeatures": {
        "jsx": true
      }
    },
    "env": {
      "es6": true,
      "node": true,
      "browser": true,
      "jest": true,
    },
    "rules": {
      "prettier/prettier": [
        "error", 
        { 
          "semi": false,
          "singleQuote": true,
          "trailingComma": "all"
        }
      ]
    }
  }
}
# !/bin/bash

# eslint
yarn add eslint--dev
./node_modules/.bin/eslint --init
rm .eslintrc #or whatever

# prettier
yarn add prettier eslint-plugin-prettier eslint-config-prettier --dev

# eslint watch
yarn add eslint-watch --dev

# husky, lint-staged
yarn add husky lint-staged --dev