Files
WanJieDaoyou/apps/api/.oxlintrc.json
T
2026-10-04 00:00:45 +08:00

286 lines
8.3 KiB
JSON

{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"env": {
"node": true
},
"categories": {
"correctness": "off"
},
"rules": {
"constructor-super": "off",
"for-direction": "error",
"getter-return": "off",
"no-async-promise-executor": "error",
"no-case-declarations": "error",
"no-class-assign": "off",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "off",
"no-constant-binary-expression": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-class-members": "off",
"no-dupe-else-if": "error",
"no-dupe-keys": "off",
"no-duplicate-case": "error",
"no-empty": "error",
"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-func-assign": "off",
"no-global-assign": "error",
"no-import-assign": "off",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "off",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "off",
"no-prototype-builtins": "error",
"no-redeclare": "off",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-setter-return": "off",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "off",
"no-unassigned-vars": "error",
"no-undef": "off",
"no-unexpected-multiline": "error",
"no-unreachable": "off",
"no-unsafe-finally": "error",
"no-unsafe-negation": "off",
"no-unsafe-optional-chaining": "error",
"no-unused-labels": "error",
"no-unused-private-class-members": "error",
"no-unused-vars": "error",
"no-useless-assignment": "error",
"no-useless-backreference": "error",
"no-useless-catch": "error",
"no-useless-escape": "error",
"no-with": "off",
"preserve-caught-error": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"no-var": "error",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"typescript/ban-ts-comment": "error",
"no-array-constructor": "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",
"no-unused-expressions": "error",
"typescript/no-wrapper-object-types": "error",
"typescript/prefer-as-const": "error",
"typescript/prefer-namespace-keyword": "error",
"typescript/triple-slash-reference": "error",
"typescript/no-floating-promises": "error"
},
"ignorePatterns": ["dist/**", "node_modules/**"],
"overrides": [
{
"files": [
"src/main.ts",
"src/http/**/*.ts",
"src/runtime/**/*.ts",
"src/realtime/**/*.ts"
],
"rules": {
"typescript/no-misused-promises": "error"
}
},
{
"files": ["src/**/*.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": ["@app/*", "@daoyou/web*", "**/apps/web/**"]
}
]
}
},
{
"files": ["src/lib/repositories/**/*.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["@app/*", "@daoyou/web*", "**/apps/web/**"]
},
{
"group": [
"@server/*/application/**",
"@server/sects/organization/**"
],
"message": "Repositories must not call application services."
}
]
}
]
}
},
{
"files": ["src/**/*.service.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": ["@app/*", "@daoyou/web*", "**/apps/web/**"],
"paths": [
{
"name": "@server/lib/drizzle/db.js",
"importNames": ["db", "getExecutor"],
"message": "Inject DRIZZLE_DATABASE in Nest services; pass it to repository calls."
}
]
}
]
},
"excludeFiles": [
"src/market/**/*.service.ts",
"src/inventory/**/*.service.ts"
]
},
{
"files": ["src/market/**/*.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["@app/*", "@daoyou/web*", "**/apps/web/**"]
},
{
"group": [
"@server/cultivator/application/**",
"@server/inventory/application/**"
],
"message": "Market uses public character queries and inventory operations/providers."
}
]
}
]
}
},
{
"files": ["src/inventory/**/*.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["@app/*", "@daoyou/web*", "**/apps/web/**"]
},
{
"group": ["@server/market/**", "**/market/application/**"],
"message": "Inventory owns recycling and must not depend on Market."
}
]
}
]
}
},
{
"files": ["src/market/**/*.service.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["@app/*", "@daoyou/web*", "**/apps/web/**"]
},
{
"group": [
"@server/cultivator/application/**",
"@server/inventory/application/**"
],
"message": "Market uses public character queries and inventory operations/providers."
}
],
"paths": [
{
"name": "@server/lib/drizzle/db.js",
"importNames": ["db", "getExecutor"],
"message": "Inject DRIZZLE_DATABASE in Nest services; pass it to repository calls."
}
]
}
]
}
},
{
"files": ["src/inventory/**/*.service.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["@app/*", "@daoyou/web*", "**/apps/web/**"]
},
{
"group": ["@server/market/**", "**/market/application/**"],
"message": "Inventory owns recycling and must not depend on Market."
}
],
"paths": [
{
"name": "@server/lib/drizzle/db.js",
"importNames": ["db", "getExecutor"],
"message": "Inject DRIZZLE_DATABASE in Nest services; pass it to repository calls."
}
]
}
]
}
},
{
"files": ["src/lib/mq/**/*.ts"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["@app/*", "@daoyou/web*", "**/apps/web/**"]
},
{
"group": [
"@server/*/application/**",
"@server/sects/organization/**",
"@server/runtime/**"
],
"message": "Business message registration belongs to Runtime; MQ libraries own transport."
}
]
}
]
}
}
]
}