import base from "./base.js";

/**
 * Shared Oxlint config for erp-kit modules.
 * Consumers: `import erpKit from "@tailor-platform/erp-kit/oxlint/module"`.
 */
export default {
  extends: [base],
  // `oxlint-plugin-eslint` powers the `eslint-js/no-restricted-syntax` rule below.
  jsPlugins: ["oxlint-plugin-eslint"],
  overrides: [
    {
      files: ["**/command/**/*.ts"],
      rules: {
        "no-restricted-imports": [
          "error",
          {
            patterns: [
              {
                regex: "^node:",
                message: "Node.js built-in modules are not allowed in command implementations.",
              },
            ],
          },
        ],
        "eslint-js/no-restricted-syntax": [
          "error",
          {
            selector: "ThrowStatement",
            message: "Use Result type (ok/err) instead of throw in command implementations.",
          },
        ],
      },
    },
    {
      files: ["**/command/**/*.test.ts"],
      rules: {
        "eslint-js/no-restricted-syntax": "off",
      },
    },
    {
      files: ["**/command/update*.ts"],
      rules: {
        "typescript/consistent-type-definitions": "off",
      },
    },
  ],
};
