Repository navigation
Expand file tree
/
Copy path.oxlintrc.json
More file actions
198 lines (198 loc) · 9.84 KB
/
Copy path.oxlintrc.json
File metadata and controls
198 lines (198 loc) · 9.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"jsPlugins": [
{ "name": "anti-slop", "specifier": "./tools/oxlint/anti-slop/index.ts" }
],
"plugins": ["eslint", "unicorn", "oxc", "typescript", "import"],
"options": {
"typeAware": true,
"denyWarnings": true,
"reportUnusedDisableDirectives": "error"
},
"rules": {
"import/no-cycle": "error",
"no-restricted-imports": ["error", {
"patterns": [{
"group": ["**/node_modules/**"],
"message": "A dependency is used through its export map. If the package exports no subpath for what you need, patch its package.json under patches/ (bun patchedDependencies) and say so there; never reach through the installed tree."
}]
}],
"typescript/no-explicit-any": "error",
"typescript/ban-ts-comment": ["error", {
"ts-expect-error": true,
"ts-ignore": true,
"ts-nocheck": true
}],
"typescript/await-thenable": "off",
"typescript/no-array-delete": "error",
"typescript/no-base-to-string": "error",
"typescript/no-duplicate-type-constituents": "error",
"typescript/no-floating-promises": ["error", { "ignoreVoid": false }],
"typescript/no-for-in-array": "error",
"typescript/no-implied-eval": "off",
"typescript/no-meaningless-void-operator": "error",
"typescript/no-misused-promises": ["error", { "checksVoidReturn": true, "checksConditionals": false, "checksSpreads": false }],
"typescript/no-misused-spread": "error",
"typescript/no-redundant-type-constituents": "error",
"typescript/no-unsafe-unary-minus": "error",
"typescript/no-useless-default-assignment": "error",
"typescript/require-array-sort-compare": "error",
"typescript/restrict-template-expressions": "error",
"typescript/unbound-method": "error",
"typescript/return-await": ["error", "error-handling-correctness-only"],
"typescript/use-unknown-in-catch-callback-variable": "error",
"typescript/no-unnecessary-type-assertion": "error",
"typescript/no-unnecessary-type-parameters": "error",
"typescript/prefer-nullish-coalescing": "error",
"typescript/prefer-readonly": "error",
"typescript/switch-exhaustiveness-check": "error",
"typescript/consistent-type-assertions": ["error", { "assertionStyle": "never" }],
"typescript/no-inferrable-types": "error",
"typescript/no-non-null-assertion": "error",
"max-depth": ["error", { "max": 4 }],
"max-params": ["error", { "max": 4 }],
"no-else-return": "error",
"no-implicit-coercion": "error",
"no-nested-ternary": "error",
"no-param-reassign": "error",
"no-shadow": "error",
"unicorn/no-array-for-each": "error",
"unicorn/no-lonely-if": "error",
"oxc/no-accumulating-spread": "error",
"anti-slop/effect-restricted-api": "error",
"anti-slop/effect-run-in-adapter": "error",
"anti-slop/no-chained-type-assertions": "error",
"anti-slop/no-conditional-empty-object-spread": "error",
"anti-slop/no-copy-rpc-stub": "error",
"anti-slop/no-bare-error-in-durable-object": "error",
"anti-slop/no-ddl-in-catch": "error",
"anti-slop/no-effect-swallow": "error",
"anti-slop/no-empty-catch": "error",
"anti-slop/no-elapsed-work-deadline": "error",
"anti-slop/no-known-value-widening": "error",
"anti-slop/no-manufactured-sql-column": "error",
"anti-slop/no-ambient-git-in-tests": "error",
"anti-slop/no-ambient-bun-in-tests": "error",
"anti-slop/no-module-mocking": "error",
"anti-slop/no-near-duplicate-functions": "error",
"anti-slop/no-object-parameters": "error",
"anti-slop/no-output-token-cap": "error",
"anti-slop/require-rpc-seal": "error",
"anti-slop/require-super-alarm": "error",
"anti-slop/no-tui-colour-literal": "error",
"anti-slop/no-dynamic-model-import": "error",
"anti-slop/no-unmeasured-dynamic-import": "error",
"anti-slop/model-method-boundary": "error",
"anti-slop/no-storage-restore-outside-ops": "error",
"anti-slop/require-variant-utility": "error",
"anti-slop/no-cli-credential-flag": "error",
"anti-slop/no-unaccounted-catch": "error",
"anti-slop/no-reduce-accumulator-copy": "error",
"anti-slop/no-reflect-apply": "error",
"anti-slop/no-reflect-get": "error",
"anti-slop/no-runtime-typeof": "off",
"anti-slop/no-sentinel-catch": "error",
"anti-slop/no-shape-in-symbol-names": "error",
"anti-slop/no-module-scope-flight": "error",
"anti-slop/no-unknown-parameters": "error",
"anti-slop/no-unknown-returns": "error",
"anti-slop/no-unknown-type-aliases": "error",
"anti-slop/no-untyped-console": "error",
"anti-slop/no-unsafe-dictionary-type": "error",
"anti-slop/no-vacuous-type-predicate": "error",
"anti-slop/no-wait-until-in-durable-object": "error",
"anti-slop/no-widen-then-assert": "error",
"anti-slop/require-cause-on-rethrow": "error",
"anti-slop/require-readable-spacing": "error",
"anti-slop/require-runtime-import-extension": "error",
"anti-slop/require-safety-comment-for-type-assertion": "error"
},
"overrides": [
{
"files": ["**/tests/**", "**/test/**", "**/__tests__/**", "**/*.test.*", "**/*.eval.*", "**/*.spec.*"],
"rules": {
"typescript/consistent-type-assertions": "off"
}
},
{
"files": ["packages/*/src/**"],
"rules": {
"no-restricted-imports": ["error", {
"paths": [{
"name": "@cloudflare/sandbox",
"importNames": ["getSandbox"],
"message": "Reach a sandbox through `openSandbox` (packages/cf-backend/src/sandbox-exec-lane.ts). It fixes the transport, which the SDK persists per sandbox; a client naming another loses its in-flight requests."
}, {
"name": "ai",
"importNames": ["generateText", "streamText", "generateObject", "streamObject", "embed", "embedMany", "rerank", "generateImage", "experimental_generateImage", "experimental_transcribe", "experimental_generateSpeech"],
"allowTypeImports": true,
"message": "Invoke a model through packages/core/src/providers/model-invocation.ts (generateReported, streamTextReported): each takes the spend it reports, so the call reaches the workspace total. Exempt, each for a property of its code: core/src/chat.ts is the turn loop, whose steps reach the total as step_finish, so a model_call row would count them twice; core/src/mcts/rollout.ts hands its usage back to the MCTS engine, which reports it on both backends because the CLI's branch worker has no sink, only IPC; cli/src/agent-create.ts names a workspace before it exists, so no workspace ledger exists to report to."
}],
"patterns": [{
"group": ["**/node_modules/**"],
"message": "A dependency is used through its export map. If the package exports no subpath for what you need, patch its package.json under patches/ (bun patchedDependencies) and say so there; never reach through the installed tree."
}]
}],
"no-restricted-properties": ["error", {
"property": "AI",
"message": "Read the Workers AI binding in packages/core/src/providers/model-invocation.ts, where each utility call (an embedding, an HTML conversion) is counted as `platform` spend. Exempt: core/src/providers/ai-gateway.ts, cf-backend/src/providers/agent-registry.ts and cf-backend/src/user/ai-proxy.ts hand the binding to an AI SDK transport, and the model call made over it reports the spend."
}]
}
},
{
"files": ["packages/cf-backend/src/sandbox-exec-lane.ts"],
"rules": {
"no-restricted-imports": ["error", {
"paths": [{
"name": "ai",
"importNames": ["generateText", "streamText", "generateObject", "streamObject", "embed", "embedMany", "rerank", "generateImage", "experimental_generateImage", "experimental_transcribe", "experimental_generateSpeech"],
"allowTypeImports": true,
"message": "Invoke a model through packages/core/src/providers/model-invocation.ts (generateReported, streamTextReported): each takes the spend it reports, so the call reaches the workspace total."
}],
"patterns": [{
"group": ["**/node_modules/**"],
"message": "A dependency is used through its export map. If the package exports no subpath for what you need, patch its package.json under patches/ (bun patchedDependencies) and say so there; never reach through the installed tree."
}]
}]
}
},
{
"files": [
"packages/core/src/providers/model-invocation.ts",
"packages/core/src/chat.ts",
"packages/cli/src/agent-create.ts"
],
"rules": {
"no-restricted-imports": ["error", {
"paths": [{
"name": "@cloudflare/sandbox",
"importNames": ["getSandbox"],
"message": "Reach a sandbox through `openSandbox` (packages/cf-backend/src/sandbox-exec-lane.ts). It fixes the transport, which the SDK persists per sandbox; a client naming another loses its in-flight requests."
}],
"patterns": [{
"group": ["**/node_modules/**"],
"message": "A dependency is used through its export map. If the package exports no subpath for what you need, patch its package.json under patches/ (bun patchedDependencies) and say so there; never reach through the installed tree."
}]
}]
}
},
{
"files": [
"packages/core/src/providers/model-invocation.ts",
"packages/core/src/providers/ai-gateway.ts",
"packages/cf-backend/src/providers/agent-registry.ts",
"packages/cf-backend/src/user/ai-proxy.ts"
],
"rules": {
"no-restricted-properties": ["error"]
}
}
],
"ignorePatterns": [
"node_modules",
"dist",
"tools/oxlint/anti-slop",
"third_party/mossaic",
"scripts/security-scanner.bundle.js", "packages/cf-backend/public/kasmvnc"
]
}