{
  "env": {
    "es6": true,
    "node": true
  },
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2020,
    "sourceType": "module",
    "project": "./tsconfig.json"
  },
  "settings": {
    "node": {
      "tryExtensions": [".js", ".ts"<% if (admin) { %>, ".tsx"<% } %>, ".json"]
    },
    "import/resolver": {
      "typescript": {}
    }<% if (admin) { %>,
    "react": {
      "version": "detect"
    }<% } %>
  },
  "extends": ["airbnb-typescript/base", "plugin:node/recommended"<% if (prettier) { %>, "plugin:prettier/recommended"<% } %>],
  "plugins": ["import", "unused-imports"],
  "rules": {
    // Common
    "arrow-body-style": "off",
    "arrow-parens": ["error", "as-needed"],
    "class-methods-use-this": "off",
    "comma-dangle": ["error", "always-multiline"],
    "implicit-arrow-linebreak": "off",
    "linebreak-style": ["error", "unix"],
    "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
    "newline-before-return": "error",
    "no-process-exit": "off",
    "object-curly-newline": "off",
    "padding-line-between-statements": [
      "error",
      { "blankLine": "always", "prev": "*", "next": "if" },
      { "blankLine": "always", "prev": "*", "next": "for" },
      { "blankLine": "always", "prev": "*", "next": "export" },
      { "blankLine": "any", "prev": "export", "next": "export" },
      { "blankLine": "always", "prev": "*", "next": "cjs-export" }
    ],
    "sort-imports": [
      "error",
      {
        "ignoreCase": true,
        "ignoreDeclarationSort": true
      }
    ],
    "spaced-comment": ["error", "always", { "line": { "markers": ["/"] } }],

    // eslint-plugin-node
    "node/no-unsupported-features/es-syntax": ["error", { "ignores": ["modules"] }],

    // eslint-plugin-import
    "import/no-cycle": "off",
    "import/order": [
      "error",
      {
        "alphabetize": {
          "order": "asc",
          "caseInsensitive": true
        },
        "groups": [["builtin", "external"], "internal", "parent", "sibling", "index"],
        "newlines-between": "never"<% if (admin) { %>,
        "pathGroups": [
          {
            "pattern": "react",
            "group": "external",
            "position": "before"
          }
        ],
        "pathGroupsExcludedImportTypes": ["react"]<% } %>
      }
    ],
    "import/prefer-default-export": "off",

    // eslint-plugin-unused-imports
    "unused-imports/no-unused-imports": "error"
  },
  "overrides": [
    {
      "files": ["**/*.{ts,tsx}"],
      "extends": [
        "plugin:@typescript-eslint/recommended",
        "plugin:@typescript-eslint/recommended-requiring-type-checking"
      ],
      "rules": {
        "@typescript-eslint/ban-ts-comment": "off",
        "@typescript-eslint/ban-types": "off",
        "@typescript-eslint/indent": "off",
        "@typescript-eslint/no-explicit-any": "off",
        "@typescript-eslint/no-misused-promises": "off",
        "@typescript-eslint/no-unsafe-argument": "off",
        "@typescript-eslint/no-unsafe-assignment": "off",
        "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "next" }],
        "@typescript-eslint/restrict-template-expressions": "off"
      }
    }<% if (sequelize) { %>,
    {
      "files": ["**/*.js"],
      "rules": {
        "@typescript-eslint/no-var-requires": "off",
        "@typescript-eslint/no-unused-vars": "off"
      }
    }<% } %><% if (jest) { %>,
    {
      "files": ["test/**", "**/*.spec.ts", "jest*.config.ts"],
      "env": {
        "jest": true
      },
      "rules": {
        "import/no-extraneous-dependencies": "off",
        "node/no-unpublished-import": "off",
        "@typescript-eslint/no-unsafe-member-access": "off"
      },
      "parserOptions": {
        "project": "./tsconfig.spec.json"
      }
    }<% } %><% if (admin) { %>,
    {
      "files": ["**/*.tsx"],
      "extends": ["airbnb-typescript", "plugin:react/recommended"],
      "rules": {
        "node/no-extraneous-import": "off",
        "import/no-extraneous-dependencies": "off"
      }
    }<% } %>
  ]
}
