import tsParser from "@typescript-eslint/parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import boundaries from "eslint-plugin-boundaries";

export default [
  {
    files: ["src/**/*.{ts,tsx}"],
    languageOptions: {
      parser: tsParser,
      parserOptions: { project: "./tsconfig.json" }
    },
    plugins: {
      "@typescript-eslint": tsPlugin,
      boundaries
    },
    rules: {
      "boundaries/element-types": [
        "error",
        {
          default: "disallow",
          rules: [
            { from: "app", allow: ["app", "pages", "modules", "shared"] },
            { from: "pages", allow: ["pages", "modules", "shared"] },
            { from: "modules", allow: ["modules", "shared"] },
            { from: "shared", allow: ["shared"] }
          ]
        }
      ]
    },
    settings: {
      "boundaries/elements": [
        { type: "app", pattern: "src/app/*" },
        { type: "pages", pattern: "src/pages/*" },
        { type: "modules", pattern: "src/modules/*" },
        { type: "shared", pattern: "src/shared/*" }
      ]
    }
  }
];
