sailfork / t3code-github / .repos/ alchemy-effect/ oxlint.config.ts

import { defineConfig, type OxlintConfig } from "oxlint";

export default defineConfig({
  options: {
    reportUnusedDisableDirectives: "error",
    typeAware: true,
    typeCheck: false,
  },
  plugins: ["import", "effecttsgo", "typescript", "node", "unicorn", "oxc"],
  ignorePatterns: [
    "submodules/**",
    "packages/alchemy/test/**",
    "packages/integration-tests/test/**",
    "packages/alchemy-test/**",
    "examples/**",
    "demos/**",
    "**/fixtures/**",
    "**/*.test.ts",
  ],
  rules: {
    "no-irregular-whitespace": "off",
    "no-unused-vars": [
      "error",
      { argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
    ],
    "no-useless-escape": "error",
    "require-yield": "off",

    "effecttsgo/abort-controller-in-effect": "error",
    "effecttsgo/acquire-release-disposable": "error",
    "effecttsgo/all-of-map-to-for-each": "error",
    "effecttsgo/any-unknown-in-error-context": "off",
    "effecttsgo/catch-all-tag-dispatch-to-catch-tag": "error",
    "effecttsgo/catch-all-to-map-error": "error",
    "effecttsgo/catch-chain-to-first-success-of": "error",
    "effecttsgo/catch-conditional-refail-to-catch-if": "error",
    "effecttsgo/catch-die-to-or-die": "error",
    "effecttsgo/catch-if-tag-to-catch-tag": "error",
    "effecttsgo/catch-refail-to-tap-error": "error",
    "effecttsgo/catch-tag-to-catch-reason": "error",
    "effecttsgo/catch-to-ignore": "error",
    "effecttsgo/catch-to-or-else-succeed": "error",
    "effecttsgo/catch-unfailable-effect": "error",
    "effecttsgo/class-self-mismatch": "error",
    "effecttsgo/duplicate-package": "error",
    "effecttsgo/effect-do-notation": "error",
    "effecttsgo/effect-fn-iife": "error",
    "effecttsgo/effect-fn-implicit-any": "error",
    "effecttsgo/effect-fn-opportunity": "error",
    "effecttsgo/effect-gen-uses-adapter": "error",
    "effecttsgo/effect-in-failure": "error",
    "effecttsgo/effect-in-void-success": "error",
    "effecttsgo/effect-map-flatten": "error",
    "effecttsgo/effect-map-void": "error",
    "effecttsgo/effect-sleep-zero-to-yield-now": "error",
    "effecttsgo/effect-succeed-with-void": "error",
    "effecttsgo/error-payload-shadows-name": "error",
    "effecttsgo/experimental-api-usage": "error",
    "effecttsgo/extends-native-error": "error",
    "effecttsgo/flat-map-conditional-to-filter-or-fail": "off",
    "effecttsgo/flat-map-ignored-param-to-and-then": "error",
    "effecttsgo/flat-map-to-map": "error",
    "effecttsgo/flat-map-to-tap": "error",
    "effecttsgo/floating-effect": "error",
    "effecttsgo/floating-effect-in-vitest": "error",
    "effecttsgo/generic-effect-services": "error",
    "effecttsgo/global-error-in-effect-catch": "error",
    "effecttsgo/global-error-in-effect-failure": "error",
    "effecttsgo/instance-of-schema": "error",
    "effecttsgo/layer-merge-all-with-dependencies": "off",
    // `XProvider()`, `providers()` and other Layer factories stay functions: they
    // are public API, return a fresh Layer per call, and avoid import-time builds.
    "effecttsgo/lazy-effect": "off",
    "effecttsgo/lazy-promise-in-effect-sync": "error",
    "effecttsgo/leaking-requirements": "off",
    "effecttsgo/map-some-to-as-some": "error",
    "effecttsgo/match-effect-to-map-both": "error",
    "effecttsgo/match-effect-to-match": "error",
    "effecttsgo/missed-pipeable-opportunity": "error",
    "effecttsgo/missing-effect-context": "error",
    "effecttsgo/missing-effect-error": "error",
    "effecttsgo/missing-effect-service-dependency": "error",
    "effecttsgo/missing-layer-context": "error",
    "effecttsgo/missing-return-yield-star": "error",
    "effecttsgo/missing-star-in-yield-effect-gen": "error",
    "effecttsgo/multiple-catch-tag": "error",
    "effecttsgo/multiple-effect-provide": "error",
    "effecttsgo/nested-effect-gen-yield": "error",
    "effecttsgo/new-schema-class": "error",
    "effecttsgo/non-object-effect-service-type": "error",
    "effecttsgo/obsolete-match-import": "error",
    "effecttsgo/obsolete-schema-import": "error",
    "effecttsgo/option-match-to-from-option": "error",
    "effecttsgo/outdated-api": "error",
    "effecttsgo/overridden-schema-constructor": "error",
    "effecttsgo/prefer-schema-type-property": "error",
    "effecttsgo/prefer-succeed-some-or-none": "error",
    "effecttsgo/prefer-typed-schema-decoder": "error",
    "effecttsgo/prefer-unsafe-constructor": "error",
    "effecttsgo/promise-in-effect-success": "error",
    "effecttsgo/provide-layer-succeed-to-provide-service": "error",
    "effecttsgo/race-first-with-sleep-to-timeout": "error",
    "effecttsgo/redundant-map-error": "error",
    "effecttsgo/redundant-or-die": "error",
    "effecttsgo/redundant-schema-tag-identifier": "error",
    "effecttsgo/return-effect-in-gen": "off",
    "effecttsgo/run-effect-inside-effect": "error",
    "effecttsgo/run-of-exit-to-run-exit": "error",
    "effecttsgo/schema-class-missing-brand": "off",
    "effecttsgo/schema-class-object-literal": "error",
    "effecttsgo/schema-literal-non-finite": "error",
    "effecttsgo/schema-number": "off",
    "effecttsgo/schema-opaque-instance-member": "error",
    "effecttsgo/schema-struct-with-tag": "error",
    "effecttsgo/schema-sync": "error",
    "effecttsgo/schema-sync-in-effect": "error",
    "effecttsgo/schema-union-of-literals": "error",
    "effecttsgo/scope-in-layer-effect": "error",
    "effecttsgo/service-not-as-class": "error",
    "effecttsgo/sync-to-succeed": "error",
    "effecttsgo/timeout-catch-tag-to-timeout-or-else": "error",
    "effecttsgo/try-catch-in-effect-gen": "error",
    "effecttsgo/unknown-in-effect-catch": "error",
    "effecttsgo/unnecessary-arrow-block": "error",
    "effecttsgo/unnecessary-effect-gen": "error",
    "effecttsgo/unnecessary-fail-yieldable-error": "error",
    "effecttsgo/unnecessary-pipe": "error",
    "effecttsgo/unnecessary-pipe-chain": "error",
    "effecttsgo/unnecessary-typeof-type": "error",
    "effecttsgo/unsafe-effect-type-assertion": "error",
    "effecttsgo/unstable-api-usage": "off",

    "typescript/await-thenable": "error",
    "typescript/no-array-delete": "error",
    "typescript/no-base-to-string": "error",
    "typescript/no-duplicate-enum-values": "error",
    "typescript/no-duplicate-type-constituents": "error",
    "typescript/no-extra-non-null-assertion": "error",
    "typescript/no-floating-promises": "error",
    "typescript/no-for-in-array": "error",
    "typescript/no-implied-eval": "error",
    "typescript/no-meaningless-void-operator": "error",
    "typescript/no-misused-new": "off",
    "typescript/no-misused-spread": "error",
    // TODO: fix all violations of this
    "typescript/no-non-null-asserted-optional-chain": "off",
    "typescript/no-redundant-type-constituents": "error",
    "typescript/no-this-alias": "error",
    "typescript/no-unnecessary-parameter-property-assignment": "error",
    "typescript/no-unsafe-declaration-merging": "error",
    "typescript/no-unsafe-unary-minus": "error",
    // Resources may be declared without props, so lifecycle `news`/`olds`
    // can be undefined at runtime even though their types say otherwise.
    "typescript/no-useless-default-assignment": "off",
    "typescript/no-useless-empty-export": "error",
    "typescript/no-wrapper-object-types": "error",
    "typescript/prefer-as-const": "error",
    "typescript/prefer-namespace-keyword": "error",
    "typescript/require-array-sort-compare": "error",
    "typescript/restrict-template-expressions": "error",
    "typescript/triple-slash-reference": "error",
    "typescript/unbound-method": "error",

    "unicorn/no-new-array": "error",
    "unicorn/no-useless-fallback-in-spread": "error",
    "unicorn/no-useless-length-check": "error",
    "unicorn/no-useless-spread": "error",
    "unicorn/prefer-string-starts-ends-with": "error",
  },
  overrides: [
    {
      // CLI tooling, not library code: a plain Error is fine here.
      files: ["scripts/**", "benchmark/**", "stacks/**"],
      rules: { "effecttsgo/global-error-in-effect-failure": "off" },
    },
  ],
} satisfies OxlintConfig);