Skip to content

Instantly share code, notes, and snippets.

@infernalmaster
Created November 22, 2018 21:57
Show Gist options
  • Save infernalmaster/d51e06b9ad2272b98c3b36e5fa1f20e8 to your computer and use it in GitHub Desktop.
Save infernalmaster/d51e06b9ad2272b98c3b36e5fa1f20e8 to your computer and use it in GitHub Desktop.
create-react-app + ESLint + prettier + VSCode
  1. Install packages
npm i -D prettier eslint-config-prettier eslint-plugin-prettier
  1. Add file .eslintrc with this content:
{
  "extends": ["react-app", "prettier"],
  "plugins": ["prettier"],
  "rules": {
    "prettier/prettier": "error"
  }
}
  1. Add this to package.json inside scripts section:
    "format": "eslint --fix src/**/*.js"
  1. Create folder .vscode and file settings.json inside this folder wiht content:
{
  "javascript.format.enable": false,
  "editor.formatOnType": true,
  "editor.formatOnSave": true,
  "editor.formatOnPaste": true,
  "eslint.autoFixOnSave": true,
  "files.autoSave": "onFocusChange"
}
  1. Install eslint extentions for VSCode https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment