Skip to content

Instantly share code, notes, and snippets.

@yogeshmishra667
Last active July 22, 2021 16:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yogeshmishra667/0a624173f7978fffed94ed7223cab725 to your computer and use it in GitHub Desktop.
Save yogeshmishra667/0a624173f7978fffed94ed7223cab725 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

2. Install Packages

npm i eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react --save-dev

3. Create .prettierrc for any prettier rules.

{
  "tabWidth": 2,
  "useTabs": false,
  "config": true,
  "singleQuote": true
}

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",
    "spaced-comment": "off",
    "no-console": "warn",
    "func-names": "off",
    "no-process-exit": "off",
    "no-param-reassign": "off",
    "no-return-await": "off",
    "consistent-return": "off",
    "no-unused-vars": ["error", { "argsIgnorePattern": "req|res|next|val" }],
    "object-shorthand": "off",
    "no-underscore-dangle": "off",
    "class-methods-use-this": "off",
    "prefer-destructuring": ["error", { "object": true, "array": false }]
    "eslint.options": { "configFile": "YOUR PROJECT PATH (URL)" }
  }
}

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