{
  "$schema": "../node_modules/oxlint/configuration_schema.json",

  "plugins": [
    "vitest"
  ],

  "overrides": [
    {
      "files": [
        "**/*.test.ts",
        "**/__tests__/**/*.ts"
      ],

      "rules": {

        /**
         * Correctness rules
         */

        "vitest/consistent-each-for": ["error", {
          "test": "each",
          "describe": "each",
          "suite": "each",
          "it": "each"
        }],

        "vitest/expect-expect": "error",
        "vitest/hoisted-apis-on-top": "error",
        "vitest/no-conditional-expect": "error",
        "vitest/no-conditional-tests": "error",
        "vitest/no-disabled-tests": "error",
        "vitest/no-focused-tests": "error",
        "vitest/no-standalone-expect": "error",
        "vitest/no-test-return-statement": "error",
        "vitest/require-awaited-expect-poll": "error",
        "vitest/require-hook": "error",
        "vitest/require-local-test-context-for-concurrent-snapshots": "error",
        "vitest/require-mock-type-parameters": "off", // It seems to be too strict and not very useful
        "vitest/require-to-throw-message": "error",
        "vitest/valid-describe-callback": "error",
        "vitest/valid-expect": "error",
        "vitest/valid-expect-in-promise": "error",

        /*
         * TODO: Drop these options when valid-title accepts Vitest function titles.
         * Vitest uses function.name as the test title when the title argument is a function.
         */
        "vitest/valid-title": ["error", {
          "ignoreTypeOfDescribeName": true,
          "ignoreTypeOfTestName": true
        }],

        "vitest/warn-todo": "warn",

        /**
         * Perf rules
         */

        "vitest/no-restricted-matchers": "off", // Needs an explicit restricted matcher policy first
        "vitest/no-restricted-vi-methods": "off", // Needs an explicit restricted vi method policy first

        /**
         * Restriction rules
         */

        "vitest/require-test-timeout": "off", // It sounds annoying to set timeout for every test

        /**
         * Suspicious rules
         */

        "vitest/no-commented-out-tests": "error",

        /**
         * Style rules
         */

        "vitest/no-conditional-in-test": "error",

        "vitest/consistent-test-filename": ["error", {
          "allTestPattern": "__tests__",
          "pattern": ".*\\.test\\.ts"
        }],

        "vitest/consistent-test-it": "error",
        "vitest/consistent-vitest-vi": "error",
        "vitest/max-expects": "off",
        "vitest/max-nested-describe": "error",
        "vitest/no-alias-methods": "error",
        "vitest/no-duplicate-hooks": "error",
        "vitest/no-hooks": "off",
        "vitest/no-identical-title": "error",
        "vitest/no-import-node-test": "error",
        "vitest/no-importing-vitest-globals": "off", // Only useful when vitest globals mode is enabled; projects that import from vitest explicitly should keep it off
        "vitest/no-interpolation-in-snapshots": "error",
        "vitest/no-large-snapshots": "error",
        "vitest/no-mocks-import": "error",
        "vitest/no-test-prefixes": "error",
        "vitest/no-unneeded-async-expect-function": "error",
        "vitest/padding-around-after-all-blocks": "error",
        "vitest/padding-around-test-blocks": "error",
        "vitest/prefer-called-exactly-once-with": "error",
        "vitest/prefer-called-once": "off", // Conflicts with prefer-called-times
        "vitest/prefer-called-times": "error",
        "vitest/prefer-called-with": "error",
        "vitest/prefer-comparison-matcher": "error",
        "vitest/prefer-describe-function-title": "error",
        "vitest/prefer-each": "error",
        "vitest/prefer-equality-matcher": "error",
        "vitest/prefer-expect-assertions": "off",
        "vitest/prefer-expect-resolves": "error",
        "vitest/prefer-expect-type-of": "off", // It works weirdly: https://vitest.dev/guide/testing-types.html#reading-errors
        "vitest/prefer-hooks-in-order": "error",
        "vitest/prefer-hooks-on-top": "error",
        "vitest/prefer-import-in-mock": "error",
        "vitest/prefer-importing-vitest-globals": "error",
        "vitest/prefer-lowercase-title": "error",
        "vitest/prefer-mock-promise-shorthand": "error",
        "vitest/prefer-mock-return-shorthand": "error",
        "vitest/prefer-snapshot-hint": "error",
        "vitest/prefer-spy-on": "error",
        "vitest/prefer-strict-boolean-matchers": "error",
        "vitest/prefer-strict-equal": "error",
        "vitest/prefer-to-be": "error",
        "vitest/prefer-to-be-falsy": "off", // less type safe that toBe(false)
        "vitest/prefer-to-be-object": "error",
        "vitest/prefer-to-be-truthy": "off", // less type safe that toBe(true)
        "vitest/prefer-to-have-been-called-times": "error",
        "vitest/prefer-to-have-length": "error",
        "vitest/prefer-to-contain": "error",
        "vitest/prefer-todo": "error",
        "vitest/require-top-level-describe": "error"
      }
    }
  ]
}
