-
Install airbnb-base
npx install-peerdeps --dev eslint-config-airbnb-base
-
Install required dependencies
npm i -D typescript eslint prettier prettier-eslint-cli eslint-config-prettier eslint-plugin-prettier eslint-config-node eslint-plugin-node @typescript-eslint/eslint-plugin @typescript-eslint/parser
-
Add .eslintrc.json with the following code:
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": [
"airbnb-base",
"plugin:node/recommended",
"prettier",
"plugin:@typescript-eslint/recommended"
],
"plugins": [
"@typescript-eslint", "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",
"node/no-unsupported-features/es-syntax": [
"error",
{ "ignores": ["modules"] }
],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"mjs": "never",
"ts": "never"
}
]
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".json"]
}
},
"import/extensions": [".js", ".ts", ".mjs"]
}
}
- Add .prettierrc.json with the following code:
{
"printWidth": 120,
"tslintintegration": true,
"trailingComma": "all",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}