{
  "root": true,
  "env": {
    "browser": true,
    "node": true
  },
  "overrides": [
    {
      "files": ["*.ts", "*.js"],
      "plugins": ["@typescript-eslint", "rxjs", "rxjs-angular", "import"],
      "parser": "@typescript-eslint/parser",
      "parserOptions": {
        "project": ["./tsconfig.eslint.json"],
        "sourceType": "module",
        "ecmaVersion": 2020
      },
      "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/recommended",
        "plugin:import/recommended",
        "plugin:import/typescript",
        "prettier",
        "plugin:rxjs/recommended"
      ],
      "settings": {
        "import/parsers": {
          "@typescript-eslint/parser": [".ts"]
        },
        "import/resolver": {
          "typescript": {
            "alwaysTryTypes": true
          }
        }
      },
      "rules": {
        "@typescript-eslint/explicit-member-accessibility": [
          "error",
          { "accessibility": "no-public" }
        ],
        "@typescript-eslint/no-explicit-any": "off", // TODO: This should be re-enabled
        "@typescript-eslint/no-misused-promises": ["error", { "checksVoidReturn": false }],
        "@typescript-eslint/no-this-alias": ["error", { "allowedNames": ["self"] }],
        "@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
        "no-console": "error",
        "import/no-unresolved": "off", // TODO: Look into turning off once each package is an actual package.
        "import/order": [
          "error",
          {
            "alphabetize": {
              "order": "asc"
            },
            "newlines-between": "always",
            "pathGroups": [
              {
                "pattern": "@/jslib/**/*",
                "group": "external",
                "position": "after"
              },
              {
                "pattern": "@/src/**/*",
                "group": "parent",
                "position": "before"
              }
            ],
            "pathGroupsExcludedImportTypes": ["builtin"]
          }
        ],
        "rxjs-angular/prefer-takeuntil": "error",
        "rxjs/no-exposed-subjects": ["error", { "allowProtected": true }],
        "no-restricted-syntax": [
          "error",
          {
            "message": "Calling `svgIcon` directly is not allowed",
            "selector": "CallExpression[callee.name='svgIcon']"
          },
          {
            "message": "Accessing FormGroup using `get` is not allowed, use `.value` instead",
            "selector": "ChainExpression[expression.object.callee.property.name='get'][expression.property.name='value']"
          }
        ],
        "curly": ["error", "all"],
        "import/namespace": ["off"], // This doesn't resolve namespace imports correctly, but TS will throw for this anyway
        "no-restricted-imports": ["error", { "patterns": ["src/**/*"] }]
      }
    },
    {
      "files": ["*.html"],
      "parser": "@angular-eslint/template-parser",
      "plugins": ["@angular-eslint/template"],
      "rules": {
        "@angular-eslint/template/button-has-type": "error"
      }
    }
  ]
}
