import { defineConfig } from "oxlint" const recommendedRules = { "for-direction": "error", "no-async-promise-executor": "error", "no-case-declarations": "error", "no-compare-neg-zero": "error", "no-cond-assign": "error", "no-constant-binary-expression": "error", "no-constant-condition": "error", "no-control-regex": "error", "no-debugger": "error", "no-delete-var": "error", "no-dupe-else-if": "error", "no-duplicate-case": "error", "no-empty": ["error", { allowEmptyCatch: true }], "no-empty-character-class": "error", "no-empty-pattern": "error", "no-empty-static-block": "error", "no-ex-assign": "error", "no-extra-boolean-cast": "error", "no-fallthrough": "error", "no-global-assign": "error", "no-invalid-regexp": "error", "no-irregular-whitespace": "error", "no-loss-of-precision": "error", "no-misleading-character-class": "error", "no-nonoctal-decimal-escape": "error", "no-prototype-builtins": "error", "no-regex-spaces": "error", "no-self-assign": "error", "no-shadow-restricted-names": "error", "no-sparse-arrays": "error", "no-unexpected-multiline": "error", "no-unsafe-finally": "error", "no-unsafe-optional-chaining": "error", "no-unused-labels": "error", "no-unused-private-class-members": "error", "no-useless-backreference": "error", "no-useless-catch": "error", "no-useless-escape": "error", "no-var": "error", "prefer-const": "error", "prefer-rest-params": "error", "prefer-spread": "error", "require-yield": "error", "use-isnan": "error", "valid-typeof": "error", "no-array-constructor": "error", "no-unused-expressions": "error", "no-unused-vars": "error", "typescript/ban-ts-comment": "error", "typescript/no-duplicate-enum-values": "error", "typescript/no-empty-object-type": "error", "typescript/no-explicit-any": "error", "typescript/no-extra-non-null-assertion": "error", "typescript/no-misused-new": "error", "typescript/no-namespace": "error", "typescript/no-non-null-asserted-optional-chain": "error", "typescript/no-require-imports": "error", "typescript/no-this-alias": "error", "typescript/no-unnecessary-type-constraint": "error", "typescript/no-unsafe-declaration-merging": "error", "typescript/no-unsafe-function-type": "error", "typescript/no-wrapper-object-types": "error", "typescript/prefer-as-const": "error", "typescript/prefer-namespace-keyword": "error", "typescript/triple-slash-reference": "error", } const antiSlopRules = { "oxc/no-accumulating-spread": "error", "anti-slop/no-array-filter-map": "error", "anti-slop/no-reduce-accumulator-copy": "error", "anti-slop/no-chained-type-assertions": "error", "anti-slop/no-comments": "error", "anti-slop/no-conditional-empty-object-spread": "error", "anti-slop/no-known-value-widening": "error", "anti-slop/no-module-mocking": "error", "anti-slop/no-object-parameters": "error", "anti-slop/no-reflect-apply": "error", "anti-slop/no-reflect-get": "error", "anti-slop/no-runtime-typeof": "error", "anti-slop/no-shape-in-symbol-names": "error", "anti-slop/no-type-assertions": "error", "anti-slop/no-unknown-parameters": "error", "anti-slop/no-unknown-returns": "error", "anti-slop/no-unknown-type-aliases": "error", "anti-slop/no-unsafe-dictionary-type": "error", "anti-slop/no-widen-then-assert": "error", } const unusedVarsWithUnderscorePattern = [ "error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, ] export default defineConfig({ plugins: ["eslint", "typescript", "react", "oxc"], categories: { correctness: "off" }, jsPlugins: [ { name: "anti-slop", specifier: "./tools/oxlint/anti-slop/index.ts" }, ], ignorePatterns: [ ".agent/**", ".agents/**", ".claude/**", ".codex/**", ".continue/**", ".cursor/**", ".gemini/**", ".opencode/**", ".pi/**", ".roo/**", ".windsurf/**", "tools/oxlint/anti-slop/**", "**/dist/**", "**/coverage/**", "**/node_modules/**", "temp/**", "workspace/**", "data/**", "e2e/.tmp/**", "test-results/**", "playwright-report/**", ], rules: antiSlopRules, overrides: [ { files: ["backend/**/*.ts"], rules: { ...recommendedRules, "no-console": ["warn", { allow: ["warn", "error"] }], "typescript/no-explicit-any": "warn", "no-unused-vars": "error", "no-useless-escape": "warn", }, }, { files: ["backend/test/**/*.ts"], rules: { "typescript/no-explicit-any": "off", }, }, { files: ["backend/src/utils/logger.ts"], rules: { "no-console": "off", }, }, { files: ["frontend/**/*.{ts,tsx}"], rules: { ...recommendedRules, "no-console": ["warn", { allow: ["warn", "error"] }], "react/rules-of-hooks": "error", "react/exhaustive-deps": "warn", "react/only-export-components": ["error", { allowConstantExport: true }], }, }, { files: [ "frontend/src/components/ui/**/*.{ts,tsx}", "frontend/src/components/message/FileToolRender.tsx", "frontend/src/components/message/CodePreview.tsx", "frontend/src/components/message/ToolDetails.tsx", ], rules: { "react/only-export-components": "off", }, }, { files: ["frontend/src/components/message/PromptInput.tsx"], rules: { "no-empty": "off", }, }, { files: ["frontend/src/sw.ts"], env: { serviceworker: true }, rules: { "no-console": "off", }, }, { files: [ "frontend/**/*.test.ts", "frontend/**/*.test.tsx", "frontend/**/*.spec.ts", "frontend/**/*.spec.tsx", "frontend/vitest.config.ts", ], rules: { "typescript/no-explicit-any": "off", "no-empty-function": "off", "no-unused-vars": unusedVarsWithUnderscorePattern, "no-empty": "off", }, }, { files: ["ocm-cli/**/*.{ts,tsx}"], rules: { ...recommendedRules, "no-console": "off", "typescript/no-explicit-any": "warn", "no-unused-vars": "error", "no-useless-escape": "warn", }, }, { files: [ "ocm-cli/test/**/*.ts", "ocm-cli/scripts/**/*.ts", "ocm-cli/vitest.config.ts", ], rules: { "typescript/no-explicit-any": "off", "no-unused-vars": unusedVarsWithUnderscorePattern, "no-control-regex": "off", }, }, ], })