{
  "extends": [
    "next/core-web-vitals",
    "plugin:import/recommended",
    "plugin:import/typescript"
  ],
  "ignorePatterns": [
    "lib/types/generated/**",
    "**/*.test.ts",
    "**/*.test.tsx",
    "eslint-rules/**"
  ],
  "overrides": [
    {
      "files": [
        "app/**/page.*",
        "app/**/layout.*",
        "app/**/loading.*",
        "app/**/error.*",
        "app/**/not-found.*",
        "app/**/global-error.*",
        "app/**/template.*",
        "app/**/default.*"
      ],
      "rules": {
        "import/no-default-export": "off",
        "no-restricted-syntax": "off"
      }
    },
    {
      "files": [
        "lib/presenters/**/*.ts",
        "lib/presenters/**/*.tsx",
        "lib/view-models/**/*.ts",
        "lib/view-models/**/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/presenter-contract": "error"
      }
    },
    {
      "files": [
        "lib/builders/view-models/*.ts",
        "lib/builders/view-models/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/view-model-builder-contract": "error"
      }
    },
    {
      "files": [
        "lib/builders/view-data/*.ts",
        "lib/builders/view-data/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/filename-matches-export": "off",
        "gridpilot-rules/single-export-per-file": "off",
        "gridpilot-rules/view-data-builder-contract": "off"
      }
    },
    {
      "files": [
        "lib/builders/**/*.ts",
        "lib/builders/**/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/no-page-dtos-directory": "error"
      }
    },
    {
      "files": [
        "lib/mutations/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/clean-error-handling": "off",
        "gridpilot-rules/filename-service-match": "off",
        "gridpilot-rules/mutation-contract": "off",
        "gridpilot-rules/mutation-must-map-errors": "off",
        "gridpilot-rules/mutation-must-use-builders": "off"
      }
    },
    {
      "files": [
        "templates/**/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/component-no-data-manipulation": "off",
        "gridpilot-rules/no-hardcoded-routes": "off",
        "gridpilot-rules/no-raw-html-in-app": "off",
        "gridpilot-rules/template-no-async-render": "off",
        "gridpilot-rules/template-no-direct-mutations": "off",
        "gridpilot-rules/template-no-external-state": "off",
        "gridpilot-rules/template-no-global-objects": "off",
        "gridpilot-rules/template-no-mutation-props": "off",
        "gridpilot-rules/template-no-side-effects": "off",
        "gridpilot-rules/template-no-unsafe-html": "off"
      }
    },
    {
      "files": [
        "components/**/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/component-no-data-manipulation": "off",
        "gridpilot-rules/no-raw-html-in-app": "off"
      }
    },
    {
      "files": [
        "app/**/page.tsx",
        "app/**/layout.tsx"
      ],
      "rules": {
        "@typescript-eslint/no-explicit-any": "off",
        "@typescript-eslint/no-unused-vars": "off",
        "gridpilot-rules/component-classification": "off",
        "gridpilot-rules/no-console": "off",
        "gridpilot-rules/no-direct-process-env": "off",
        "gridpilot-rules/no-hardcoded-routes": "off",
        "gridpilot-rules/no-hardcoded-search-params": "off",
        "gridpilot-rules/no-index-files": "off",
        "gridpilot-rules/no-next-cookies-in-pages": "off",
        "gridpilot-rules/no-raw-html-in-app": "off",
        "gridpilot-rules/rsc-no-container-manager": "off",
        "gridpilot-rules/rsc-no-container-manager-calls": "off",
        "gridpilot-rules/rsc-no-di": "off",
        "gridpilot-rules/rsc-no-display-objects": "off",
        "gridpilot-rules/rsc-no-intl": "off",
        "gridpilot-rules/rsc-no-local-helpers": "off",
        "gridpilot-rules/rsc-no-object-construction": "off",
        "gridpilot-rules/rsc-no-page-data-fetcher": "off",
        "gridpilot-rules/rsc-no-presenters": "off",
        "gridpilot-rules/rsc-no-sorting-filtering": "off",
        "gridpilot-rules/rsc-no-unsafe-services": "off",
        "gridpilot-rules/rsc-no-view-models": "off",
        "import/no-default-export": "off",
        "no-restricted-syntax": "off",
        "react-hooks/exhaustive-deps": "off",
        "react-hooks/rules-of-hooks": "off",
        "react/no-unescaped-entities": "off"
      }
    },
    {
      "files": [
        "lib/services/**/*.ts",
        "lib/page-queries/**/*.ts",
        "lib/mutations/**/*.ts",
        "middleware.ts",
        "lib/mutations/auth/types/*.ts"
      ],
      "rules": {
        "gridpilot-rules/clean-error-handling": "off",
        "gridpilot-rules/no-direct-process-env": "off"
      }
    },
    {
      "files": [
        "lib/display-objects/**/*.ts",
        "lib/display-objects/**/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/display-no-business-logic": "off",
        "gridpilot-rules/display-no-domain-models": "off",
        "gridpilot-rules/filename-display-match": "off",
        "gridpilot-rules/model-no-domain-in-display": "off"
      }
    },
    {
      "files": [
        "lib/page-queries/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/clean-error-handling": "off",
        "gridpilot-rules/filename-matches-export": "off",
        "gridpilot-rules/no-hardcoded-routes": "off",
        "gridpilot-rules/no-hardcoded-search-params": "off",
        "gridpilot-rules/page-query-contract": "off",
        "gridpilot-rules/page-query-execute": "off",
        "gridpilot-rules/page-query-filename": "off",
        "gridpilot-rules/page-query-must-use-builders": "off",
        "gridpilot-rules/page-query-no-null-returns": "off",
        "gridpilot-rules/page-query-return-type": "off",
        "gridpilot-rules/single-export-per-file": "off"
      }
    },
    {
      "files": [
        "templates/**/*.ts",
        "templates/**/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/view-data-location": "error"
      }
    },
    {
      "files": [
        "lib/services/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/filename-service-match": "off",
        "gridpilot-rules/services-implement-contract": "off",
        "gridpilot-rules/services-must-be-pure": "off",
        "gridpilot-rules/services-must-return-result": "off",
        "gridpilot-rules/services-no-external-api": "off"
      }
    },
    {
      "files": [
        "app/**/*.tsx",
        "app/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/client-only-must-have-directive": "off",
        "gridpilot-rules/client-only-no-server-code": "off",
        "gridpilot-rules/no-use-mutation-in-client": "off",
        "gridpilot-rules/server-actions-interface": "off",
        "gridpilot-rules/server-actions-must-use-mutations": "off",
        "gridpilot-rules/server-actions-return-result": "off"
      }
    },
    {
      "files": [
        "lib/write-boundaries/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/write-boundary-must-use-repository": "error",
        "gridpilot-rules/write-boundary-no-direct-mutations": "error"
      }
    },
    {
      "files": [
        "lib/domain/**/*.ts",
        "lib/models/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/model-no-display-in-domain": "error"
      }
    },
    {
      "files": [
        "lib/**/*.ts",
        "lib/**/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/lib-no-next-imports": "error"
      }
    },
    {
      "files": [
        "app/onboarding/**/*.ts",
        "app/onboarding/**/*.tsx",
        "lib/auth/RouteGuard.ts",
        "lib/auth/AuthFlowRouter.ts",
        "middleware.ts"
      ],
      "rules": {
        "gridpilot-rules/no-console": "error"
      }
    },
    {
      "files": [
        "app/**/*.tsx",
        "app/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/component-classification": "off",
        "gridpilot-rules/no-hardcoded-routes": "off",
        "gridpilot-rules/no-nextjs-imports-in-ui": "off",
        "gridpilot-rules/no-raw-html-in-app": "off"
      }
    },
    {
      "files": [
        "app/**/actions.ts",
        "app/**/actions/*.ts"
      ],
      "rules": {
        "gridpilot-rules/no-hardcoded-routes": "error",
        "gridpilot-rules/server-actions-interface": "error",
        "gridpilot-rules/server-actions-return-result": "error"
      }
    },
    {
      "files": [
        "ui/**/*.tsx",
        "ui/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/component-classification": "error",
        "gridpilot-rules/no-nextjs-imports-in-ui": "error",
        "gridpilot-rules/ui-element-purity": "error"
      }
    },
    {
      "files": [
        "components/**/*.tsx",
        "components/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/component-classification": "off",
        "gridpilot-rules/no-hardcoded-routes": "off",
        "gridpilot-rules/no-nextjs-imports-in-ui": "off",
        "gridpilot-rules/no-raw-html-in-app": "error",
        "no-restricted-imports": "off"
      }
    },
    {
      "files": [
        "components/mockups/**/*.tsx"
      ],
      "rules": {
        "gridpilot-rules/no-raw-html-in-app": "off"
      }
    },
    {
      "files": [
        "lib/services/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/no-hardcoded-routes": "off",
        "gridpilot-rules/service-function-format": "off",
        "gridpilot-rules/services-implement-contract": "off",
        "gridpilot-rules/services-must-be-pure": "off",
        "gridpilot-rules/services-no-external-api": "off"
      }
    },
    {
      "files": [
        "lib/mutations/**/*.ts"
      ],
      "rules": {
        "gridpilot-rules/no-hardcoded-routes": "error"
      }
    }
  ],
  "plugins": [
    "boundaries",
    "import",
    "@typescript-eslint",
    "unused-imports",
    "gridpilot-rules"
  ],
  "root": true,
  "rules": {
    "@next/next/no-img-element": "off",
    "@typescript-eslint/no-explicit-any": "off",
    "@typescript-eslint/no-unused-vars": [
      "off",
      {
        "argsIgnorePattern": "^_",
        "caughtErrorsIgnorePattern": "^_",
        "varsIgnorePattern": "^_"
      }
    ],
    "boundaries/element-types": [
      2,
      {
        "default": "disallow",
        "rules": [
          {
            "allow": [
              "website"
            ],
            "from": [
              "website"
            ]
          }
        ]
      }
    ],
    "gridpilot-rules/no-index-files": "off",
    "import/no-default-export": "off",
    "import/no-named-as-default-member": "off",
    "no-restricted-syntax": "off",
    "react-hooks/exhaustive-deps": "off",
    "react-hooks/rules-of-hooks": "off",
    "react/no-unescaped-entities": "off",
    "unused-imports/no-unused-imports": "off",
    "unused-imports/no-unused-vars": "off"
  },
  "settings": {
    "boundaries/elements": [
      {
        "pattern": [
          "**/*"
        ],
        "type": "website"
      }
    ],
    "import/resolver": {
      "typescript": {}
    }
  }
}