Skip to content

Instantly share code, notes, and snippets.

@bchiang7
Last active March 20, 2019 16:16
Show Gist options
  • Save bchiang7/dd63be242869e59941c3ed2df04b454a to your computer and use it in GitHub Desktop.
Save bchiang7/dd63be242869e59941c3ed2df04b454a to your computer and use it in GitHub Desktop.
Add Ups Linting Configs
touch .eslintrc prettier.config.js .editorconfig .babelrc

Default

npm install -D @upstatement/eslint-config @upstatement/prettier-config eslint babel-eslint prettier eslint-config-prettier husky pretty-quick lint-staged

With React

npm install -D eslint-plugin-react eslint-plugin-jsx-a11y

.editorconfig

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

prettier.config.js

module.exports = require('@upstatement/prettier-config');

.eslintrc

{
  "extends": "@upstatement",
  "parserOptions": {
    "sourceType": "module"
  },
  "env": {
    "browser": true,
    "node": true,
    "es6": true,
  }
}
{
  "extends": "@upstatement/eslint-config/react"
}

package.json

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