VSCode - ESLint, Prettier & Airbnb Setup
1. Install ESLint & Prettier extensions for VSCode
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)" }
}
}