.oxlintrc.json 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. {
  2. "$schema": "./node_modules/oxlint/configuration_schema.json",
  3. "plugins": [],
  4. "categories": {
  5. "correctness": "off"
  6. },
  7. "options": {
  8. "reportUnusedDisableDirectives": "warn",
  9. "typeAware": true
  10. },
  11. "env": {
  12. "builtin": true
  13. },
  14. "ignorePatterns": [
  15. "**/lib/**",
  16. "**/node_modules/**",
  17. "**/.sessions/**",
  18. ".claude/**", // Harness-local state belongs to other checkouts, not this checkout's sources.
  19. "**/.doc-typecheck-*/**",
  20. "**/.node-next-types-*/**",
  21. "**/.oxlint-contract-*/**", // Scratch files created by the executable lint-contract tests.
  22. "**/oxlint-contract-*", // Flat probes use real TypeScript project include paths.
  23. "packages/typert/generator/tests/fixtures/type-model/**", // tsgolint rejects this fixture's preserved project shapes before rules run.
  24. "website/.generated/**",
  25. "vendor/**", // Vendored source keeps upstream style and idioms.
  26. "native/**", // The imported landlock-run subtree has its own gates; see native/README.md.
  27. "**/*.js",
  28. "**/*.mjs",
  29. "**/*.config.ts", // Tool and app configs are outside the repository TypeScript programs.
  30. "packages/client/tsdown.client.ts" // Shared client build preset, also outside a TypeScript program.
  31. ],
  32. "overrides": [
  33. {
  34. // Shared strict type-aware rules. Source/test differences stay in the short overrides below.
  35. "files": [
  36. "packages/*/*/src/**/*.{ts,tsx}",
  37. "packages/*/*/tests/**/*.{ts,tsx}",
  38. "apps/*/src/**/*.{ts,tsx}",
  39. "apps/*/tests/**/*.{ts,tsx}",
  40. "examples/**/*.{ts,tsx}",
  41. "scripts/**/*.{ts,tsx}",
  42. "website/**/*.{ts,tsx}"
  43. ],
  44. "rules": {
  45. "no-var": "error",
  46. "prefer-const": "error",
  47. "prefer-rest-params": "error",
  48. "prefer-spread": "error",
  49. "no-array-constructor": "error",
  50. "no-unused-expressions": "error",
  51. "no-unused-vars": [
  52. "error",
  53. {
  54. "argsIgnorePattern": "^_",
  55. "varsIgnorePattern": "^_",
  56. "caughtErrorsIgnorePattern": "^_"
  57. }
  58. ],
  59. "no-useless-constructor": "error",
  60. "no-restricted-properties": [
  61. "error",
  62. {
  63. "object": "crypto",
  64. "property": "randomUUID",
  65. "message": "browsers withhold crypto.randomUUID outside secure contexts (plain-HTTP LAN pages); mint through @deepseek-ai/dsh-util-crypto instead"
  66. }
  67. ],
  68. "typescript/await-thenable": "error",
  69. "typescript/ban-ts-comment": [
  70. "error",
  71. {
  72. "minimumDescriptionLength": 10
  73. }
  74. ],
  75. "typescript/no-array-delete": "error",
  76. "typescript/no-base-to-string": "error",
  77. "typescript/no-confusing-void-expression": "error",
  78. "typescript/no-deprecated": "error",
  79. "typescript/no-duplicate-enum-values": "error",
  80. "typescript/no-duplicate-type-constituents": "error",
  81. "typescript/no-dynamic-delete": "error",
  82. "typescript/no-empty-object-type": "off", // Merge-extensible maps intentionally use empty object types.
  83. "typescript/no-explicit-any": "error", // Every intentional any needs a narrow suppression with rationale.
  84. "typescript/no-extra-non-null-assertion": "error",
  85. "typescript/no-extraneous-class": "error",
  86. // Lost promises in the agent loop are the repository's highest-value linted bug class.
  87. "typescript/no-floating-promises": "error",
  88. "typescript/no-for-in-array": "error",
  89. "typescript/no-implied-eval": "error",
  90. "typescript/no-invalid-void-type": "off", // Event signatures intentionally use void in source.
  91. "typescript/no-meaningless-void-operator": "error",
  92. "typescript/no-misused-new": "error",
  93. "typescript/no-misused-promises": "error",
  94. "typescript/no-misused-spread": "error",
  95. "typescript/no-mixed-enums": "error",
  96. "typescript/no-namespace": "off", // Cordis Config namespaces are the repository idiom.
  97. "typescript/no-non-null-asserted-nullish-coalescing": "error",
  98. "typescript/no-non-null-asserted-optional-chain": "error",
  99. "typescript/no-redundant-type-constituents": "error",
  100. "typescript/no-require-imports": "error",
  101. "typescript/no-this-alias": "error",
  102. "typescript/no-unnecessary-boolean-literal-compare": "error",
  103. "typescript/no-unnecessary-template-expression": "error",
  104. "typescript/no-unnecessary-type-arguments": "error",
  105. "typescript/no-unnecessary-type-assertion": "error",
  106. "typescript/no-unnecessary-type-constraint": "error",
  107. "typescript/no-unnecessary-type-conversion": "error",
  108. "typescript/no-unnecessary-type-parameters": "error",
  109. "typescript/no-unsafe-argument": "error",
  110. "typescript/no-unsafe-assignment": "error",
  111. "typescript/no-unsafe-call": "error",
  112. "typescript/no-unsafe-declaration-merging": "error",
  113. "typescript/no-unsafe-enum-comparison": "error",
  114. "typescript/no-unsafe-function-type": "error",
  115. "typescript/no-unsafe-member-access": "error",
  116. "typescript/no-unsafe-return": "error",
  117. "typescript/no-unsafe-unary-minus": "error",
  118. "typescript/no-useless-default-assignment": "error",
  119. "typescript/no-wrapper-object-types": "error",
  120. "typescript/prefer-as-const": "error",
  121. "typescript/prefer-literal-enum-member": "error",
  122. "typescript/prefer-namespace-keyword": "error",
  123. "typescript/prefer-promise-reject-errors": "error",
  124. "typescript/prefer-reduce-type-parameter": "error",
  125. "typescript/prefer-return-this-type": "error",
  126. "typescript/related-getter-setter-pairs": "error",
  127. "typescript/restrict-plus-operands": [
  128. "error",
  129. {
  130. "allowAny": false,
  131. "allowBoolean": false,
  132. "allowNullish": false,
  133. "allowNumberAndString": false,
  134. "allowRegExp": false
  135. }
  136. ],
  137. "typescript/return-await": [
  138. "error",
  139. "error-handling-correctness-only"
  140. ],
  141. "typescript/triple-slash-reference": "error",
  142. "typescript/unbound-method": "error",
  143. "typescript/unified-signatures": "error",
  144. "typescript/use-unknown-in-catch-callback-variable": "error",
  145. "no-void": "off" // void foo() marks deliberate fire-and-forget arrow listeners.
  146. },
  147. "plugins": [
  148. "typescript"
  149. ]
  150. },
  151. {
  152. "files": [
  153. "packages/*/*/src/**/*.{ts,tsx}",
  154. "apps/*/src/**/*.{ts,tsx}",
  155. "examples/**/*.{ts,tsx}",
  156. "scripts/**/*.{ts,tsx}",
  157. "website/**/*.{ts,tsx}"
  158. ],
  159. "rules": {
  160. "typescript/no-non-null-assertion": "error",
  161. "typescript/no-unnecessary-condition": [
  162. "error",
  163. {
  164. "allowConstantLoopConditions": true
  165. }
  166. ],
  167. "typescript/only-throw-error": "error",
  168. "typescript/require-await": "error",
  169. "typescript/restrict-template-expressions": [
  170. "error",
  171. {
  172. "allowNumber": true,
  173. "allowBoolean": true
  174. }
  175. ],
  176. "typescript/switch-exhaustiveness-check": [
  177. "error",
  178. {
  179. "considerDefaultExhaustiveForUnions": true
  180. }
  181. ]
  182. },
  183. "plugins": [
  184. "typescript"
  185. ]
  186. },
  187. {
  188. "files": [
  189. "examples/**/*.ts"
  190. ],
  191. "rules": {
  192. "typescript/require-await": "off" // Demo callbacks conform to async interfaces without awaiting.
  193. },
  194. "plugins": [
  195. "typescript"
  196. ]
  197. },
  198. {
  199. "files": [
  200. "packages/*/*/tests/**/*.{ts,tsx}",
  201. "apps/*/tests/**/*.{ts,tsx}",
  202. "examples/*/tests/**/*.{ts,tsx}",
  203. "scripts/**/*.spec.{ts,tsx}"
  204. ],
  205. "rules": {
  206. "typescript/no-invalid-void-type": "error",
  207. "typescript/no-non-null-assertion": "off", // Assertions commonly follow an expect() that proves presence.
  208. "typescript/no-unnecessary-condition": "off",
  209. "typescript/only-throw-error": "off", // Tests deliberately exercise non-Error throws.
  210. "typescript/require-await": "off", // Mock execute() implementations must retain async signatures.
  211. "typescript/restrict-template-expressions": "off"
  212. },
  213. "plugins": [
  214. "typescript"
  215. ]
  216. },
  217. {
  218. "files": [
  219. "packages/**/*.{ts,tsx}",
  220. "apps/**/*.{ts,tsx}",
  221. "examples/**/*.{ts,tsx}",
  222. "scripts/**/*.{ts,tsx}",
  223. "website/**/*.{ts,tsx}"
  224. ],
  225. "rules": {
  226. "sonarjs/duplicates-in-character-class": "error",
  227. "sonarjs/no-all-duplicated-branches": "error",
  228. "sonarjs/no-duplicate-in-composite": "error",
  229. "sonarjs/no-duplicate-test-title": "error",
  230. "sonarjs/no-identical-conditions": "error",
  231. "sonarjs/no-identical-expressions": "error",
  232. "sonarjs/no-identical-functions": "error",
  233. "sonarjs/no-duplicated-branches": "error"
  234. },
  235. "jsPlugins": [
  236. "eslint-plugin-sonarjs"
  237. ]
  238. },
  239. {
  240. "files": [
  241. "packages/**/*.{ts,tsx}",
  242. "apps/**/*.{ts,tsx}",
  243. "examples/**/*.{ts,tsx}",
  244. "scripts/**/*.{ts,tsx}",
  245. "website/**/*.{ts,tsx}"
  246. ],
  247. "rules": {
  248. "@stylistic/indent": [
  249. "error",
  250. 2
  251. ],
  252. "@stylistic/semi": [
  253. "error",
  254. "never"
  255. ],
  256. "@stylistic/quotes": [
  257. "error",
  258. "single",
  259. {
  260. "avoidEscape": true
  261. }
  262. ],
  263. "@stylistic/comma-dangle": [
  264. "error",
  265. "always-multiline"
  266. ],
  267. "@stylistic/eol-last": [
  268. "error",
  269. "always"
  270. ],
  271. "@stylistic/no-trailing-spaces": "error",
  272. "@stylistic/object-curly-spacing": [
  273. "error",
  274. "always"
  275. ],
  276. "@stylistic/arrow-parens": [
  277. "error",
  278. "as-needed",
  279. {
  280. "requireForBlockBody": true
  281. }
  282. ],
  283. "@stylistic/member-delimiter-style": [
  284. "error",
  285. {
  286. "multiline": {
  287. "delimiter": "none"
  288. },
  289. "singleline": {
  290. "delimiter": "semi",
  291. "requireLast": false
  292. }
  293. }
  294. ],
  295. // Validation-only: line length has no safe formatter fix.
  296. "@stylistic/max-len": [
  297. "error",
  298. {
  299. "code": 140,
  300. "ignoreUrls": true,
  301. "ignoreStrings": true,
  302. "ignoreTemplateLiterals": true
  303. }
  304. ]
  305. },
  306. "jsPlugins": [
  307. "@stylistic/eslint-plugin"
  308. ]
  309. },
  310. {
  311. // The project-free staged profile re-includes this syntax-coverage fixture.
  312. "files": [
  313. "packages/typert/generator/tests/fixtures/type-model/**/*.{ts,tsx}"
  314. ],
  315. "rules": {
  316. "typescript/no-explicit-any": "off"
  317. }
  318. },
  319. {
  320. // TypeGraph coverage must retain source-authored syntax that the normal quote rule forbids.
  321. "files": [
  322. "packages/typert/generator/tests/fixtures/type-model/packages/host/src/models.ts"
  323. ],
  324. "rules": {
  325. "@stylistic/quotes": "off"
  326. }
  327. },
  328. {
  329. "files": [
  330. "packages/experimental/webworker-runtime/src/node/**/*.ts",
  331. "packages/experimental/webworker-runtime/src/storage/memory.ts",
  332. "packages/experimental/webworker-runtime/src/module-system/module-loader.ts",
  333. "packages/experimental/webworker-runtime/src/transport/synthetic-http.ts"
  334. ],
  335. "rules": {
  336. "typescript/require-await": "off", // Async faces Node and Cordis define (fs promises, the module seam) reject rather than throw; the VFS beneath them never awaits.
  337. "typescript/no-extraneous-class": "off" // Node constructs these (`new Script()`, `new Worker()`), so a stub that refuses must still be a class.
  338. },
  339. "plugins": [
  340. "typescript"
  341. ]
  342. }
  343. ]
  344. }