Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
Created July 19, 2019 17:54
Show Gist options
  • Save bradtraversy/aab26d1e8983d9f8d79be1a9ca894ab4 to your computer and use it in GitHub Desktop.
Save bradtraversy/aab26d1e8983d9f8d79be1a9ca894ab4 to your computer and use it in GitHub Desktop.
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
npx install-peerdeps --dev eslint-config-airbnb

3. Create .prettierrc for any prettier rules (semicolons, quotes, etc)

4. Create .eslintrc.json file (You can generate with eslint --init if you install eslint globally)

{
  "extends": ["airbnb", "prettier", "plugin:node/recommended"],
  "plugins": ["prettier"],
  "rules": {
    "prettier/prettier": "error",
    "no-unused-vars": "warn",
    "no-console": "off",
    "func-names": "off",
    "no-process-exit": "off",
    "object-shorthand": "off",
    "class-methods-use-this": "off"
  }
}

Reference

@carloswm85
Copy link

Your video: VSCode ESLint, Prettier & Airbnb Style Guide Setup - https://youtu.be/SydnKbGc7W8

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