import js from "@eslint/js"; import eslintConfigPrettier from "eslint-config-prettier"; import tseslint from "typescript-eslint"; import turboPlugin from "eslint-plugin-turbo"; import boundaries from "eslint-plugin-boundaries"; import globals from "globals"; // export default [ { ignores: ["dist/**", "node_modules/**", ".next/**", ".turbo/**", "storybook-static/**"] }, js.configs.recommended, { files: ["**/*.{mjs,cjs,js}", "**/*.config.{ts,tsx}"], languageOptions: { globals: { ...globals.node }, }, }, ...tseslint.configs.recommended, eslintConfigPrettier, { plugins: { turbo: turboPlugin }, rules: { "turbo/no-undeclared-env-vars": "warn", }, }, { rules: { // Honour the leading-underscore convention for intentionally-unused params/vars. "@typescript-eslint/no-unused-vars": [ "error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_", }, ], }, }, { plugins: { boundaries }, settings: { "boundaries/elements": [ { type: "app", pattern: "apps/*" }, { type: "tooling", pattern: "packages/core-eslint" }, { type: "tooling", pattern: "packages/core-typescript" }, { type: "tooling", pattern: "packages/core-testing" }, { type: "core-composition", pattern: "packages/core-api" }, { type: "core-composition", pattern: "packages/core-cms" }, { type: "core", pattern: "packages/core-*" }, { type: "feature", pattern: "packages/!(core-*)" }, ], }, rules: { "boundaries/element-types": [ 2, { default: "disallow", rules: [ { from: "app", allow: ["app", "core", "core-composition", "feature", "tooling"] }, { from: "feature", allow: ["core", "tooling"] }, { from: "core", allow: ["core", "tooling"] }, { from: "core-composition", allow: ["core", "feature", "tooling"] }, { from: "tooling", allow: ["tooling"] }, ], }, ], }, }, // R40 — block direct @sentry/* imports outside the allowlisted instrumentation paths { files: ["**/*.{ts,tsx,mjs,cjs,js}"], rules: { "no-restricted-imports": [ "error", { patterns: [ { group: ["@sentry/*"], message: "Import from @repo/core-shared/instrumentation instead — feature packages must not depend on Sentry directly (R40).", }, ], }, ], }, }, // R40 allowlist — the only paths permitted to import @sentry/*. // Patterns are double-star prefixed so they match whether eslint runs from // the repo root or from inside a sub-package. { files: [ "**/instrumentation/sentry/**", "**/instrumentation/di/bind-sentry-instrumentation.{ts,js}", "**/instrumentation/di/bind-sentry-instrumentation.test.{ts,js}", "**/setup/no-sentry.{ts,js}", "**/setup/no-sentry.test.{ts,js}", "**/instrumentation.{ts,js,mjs}", "**/instrumentation-client.{ts,js,mjs}", "**/next.config.{mjs,ts,js}", "**/vite.config.{ts,mjs,js}", "**/sentry.*.config.{ts,mjs,js}", ], rules: { "no-restricted-imports": "off", }, }, // E1 — Event handlers must not be re-exported. Wire them only inside the // consumer feature's bind-production / bind-dev-seed (spec § 2.2 Rule E1). // J — Direct `payload.jobs.*` access is forbidden outside the integration // layer. Use IJobQueue (from @repo/core-shared/jobs) instead. // Events + jobs rules are added here when @repo/core-events is scaffolded // via `pnpm turbo gen core-package events`. // // R2 / R1 (ADR-016) — realtime-specific ESLint rules (no-direct-socket-io, // no-realtime-handler-reexport) are added here when @repo/core-realtime is // scaffolded via `pnpm turbo gen core-package realtime`. // ];