VSCode ESLint, Prettier & Airbnb Style Guide Setup – Download



In this video we will setup linting with the Airbnb style guide for clean and consitent JavaScript code in VSCode

Commands & Config:

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

Sponsor: Freelancer Bundle (Use “brad25” for 25% off)
https://studywebdevelopment.com/freelancing.html

Become a Patron: Show support & get perks!
http://www.patreon.com/traversymedia

Website & Udemy Courses
http://www.traversymedia.com

Follow Traversy Media:
https://www.facebook.com/traversymedia

https://www.instagram.com/traversymedia

Source

Do you love us?, Please donate to us ,thank you. BTC 38WPVc3xMYmoMp1GcnpDXd1fEzbfgujsCB Etherum 0x6c11844FD079b2490CDd44039e1C2f0940d098dc

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.