$schema: "@gobing-ai/spur/schemas/rule-file.schema.json"
# Local override of the global structure/test-location.yaml — same relative path,
# so it shadows the global copy (local wins in the layered merge) and the
# `require-corresponding-test` rule is defined exactly once. Keeps `no-tests-dir`
# from the global file and adds project-specific excludes (declaration-only files,
# schema/migration/db modules) to `require-corresponding-test`.
rules:
  - id: no-tests-dir
    description: "Tests must live in tests/ directories at the same level as src/, not in __tests__."
    severity: error
    evaluator:
      type: test-location
      config:
        expected: "**/*.test.*"
        forbid:
          - "**/__tests__/**"
          - "**/src/**/*.test.ts"
          - "**/src/**/*.test.tsx"
        requireCorrespondingTest: false
    include:
      - "packages/**/tests/**/*.test.ts"
      - "apps/**/tests/**/*.test.ts"
      - "packages/**/tests/**/*.test.tsx"
      - "apps/**/tests/**/*.test.tsx"

  - id: require-corresponding-test
    description: "Every source file must have a corresponding test in tests/, excluding declaration-only files."
    severity: warning
    evaluator:
      type: test-location
      config:
        expected: "**/*.test.*"
        requireCorrespondingTest: true
    include:
      - "packages/**/src/**/*.ts"
      - "apps/**/src/**/*.ts"

    exclude:
      - "**/index.ts"
      - "**/*.d.ts"
      - "**/types.ts"
      - "**/schema/**"
      - "**/schema.ts"
      - "**/migrations.ts"
      - "**/db.ts"
      ## Entity declarations — contracts are transport DTOs tested by the single contract.test.ts
      - "packages/contracts/src/**"
      ## pure re-export for UI components
      - "apps/web/src/ui.ts"
      - "apps/web/src/modules/config.ts"
