Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save christopherafbjur/984837ba16dd8f0f7c6a918dcc0ee575 to your computer and use it in GitHub Desktop.
Save christopherafbjur/984837ba16dd8f0f7c6a918dcc0ee575 to your computer and use it in GitHub Desktop.
  1. Install airbnb-base npx install-peerdeps --dev eslint-config-airbnb-base

  2. 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

  3. 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"]
  }
}
  1. Add .prettierrc.json with the following code:
{
  "printWidth": 120,
  "tslintintegration": true,
  "trailingComma": "all",
  "tabWidth": 2,
  "semi": false,
  "singleQuote": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment