Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

.oxlintrc.json

288 lines10.8 KB

1{
2 "$schema": "./node_modules/oxlint/configuration_schema.json",
3 "plugins": [],
4 "jsPlugins": [
5 "eslint-plugin-unused-imports",
6 { "name": "eslint-js", "specifier": "oxlint-plugin-eslint" }
7 ],
8 "categories": {
9 "correctness": "off"
10 },
11 "env": {
12 "builtin": true
13 },
14 "ignorePatterns": [
15 "**/.nx/**",
16 "**/.svelte-kit/**",
17 "**/build/**",
18 "**/coverage/**",
19 "**/dist/**",
20 "**/snap/**",
21 "**/vite.config.*.timestamp-*.*",
22 "**/src/generated/**",
23 "**/src/model3d/generated/**",
24 "**/*.tsrx.d.ts"
25 ],
26 "rules": {
27 "unused-imports/no-unused-imports": "warn"
28 },
29 "overrides": [
30 {
31 "files": ["**/*.{js,ts,tsx}"],
32 "rules": {
33 "for-direction": "error",
34 "no-async-promise-executor": "error",
35 "no-case-declarations": "error",
36 "no-class-assign": "error",
37 "no-compare-neg-zero": "error",
38 "no-cond-assign": "error",
39 "no-constant-binary-expression": "error",
40 "no-constant-condition": "error",
41 "no-control-regex": "error",
42 "no-debugger": "error",
43 "no-delete-var": "error",
44 "no-dupe-else-if": "error",
45 "no-duplicate-case": "error",
46 "no-empty-character-class": "error",
47 "no-empty-pattern": "error",
48 "no-empty-static-block": "error",
49 "no-ex-assign": "error",
50 "no-extra-boolean-cast": "error",
51 "no-fallthrough": "error",
52 "no-global-assign": "error",
53 "no-invalid-regexp": "error",
54 "no-irregular-whitespace": "error",
55 "no-loss-of-precision": "error",
56 "no-misleading-character-class": "error",
57 "no-nonoctal-decimal-escape": "error",
58 "no-regex-spaces": "error",
59 "no-self-assign": "error",
60 "no-shadow": "warn",
61 "no-shadow-restricted-names": "error",
62 "no-sparse-arrays": "error",
63 "no-unsafe-finally": "error",
64 "no-unsafe-optional-chaining": "error",
65 "no-unused-labels": "error",
66 "no-unused-private-class-members": "error",
67 "no-useless-backreference": "error",
68 "no-useless-catch": "error",
69 "no-useless-escape": "error",
70 "no-var": "error",
71 "no-with": "error",
72 "prefer-const": "error",
73 "require-yield": "error",
74 "use-isnan": "error",
75 "valid-typeof": "error",
76 "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
77 "import/first": "error",
78 "import/newline-after-import": "error",
79 "import/no-commonjs": "error",
80 "import/no-duplicates": "error",
81 "@stylistic/spaced-comment": "error",
82 "typescript/array-type": [
83 "error",
84 {
85 "default": "generic",
86 "readonly": "generic"
87 }
88 ],
89 "typescript/ban-ts-comment": [
90 "error",
91 {
92 "ts-expect-error": false,
93 "ts-ignore": "allow-with-description"
94 }
95 ],
96 "typescript/consistent-type-imports": [
97 "error",
98 {
99 "prefer": "type-imports"
100 }
101 ],
102 "typescript/method-signature-style": ["error", "property"],
103 "typescript/no-duplicate-enum-values": "error",
104 "typescript/no-extra-non-null-assertion": "error",
105 "typescript/no-inferrable-types": [
106 "error",
107 {
108 "ignoreParameters": true
109 }
110 ],
111 "typescript/no-misused-new": "error",
112 "typescript/no-namespace": "error",
113 "typescript/no-non-null-asserted-optional-chain": "error",
114 "typescript/no-unsafe-function-type": "error",
115 "typescript/no-wrapper-object-types": "error",
116 "typescript/prefer-as-const": "error",
117 "typescript/prefer-for-of": "warn",
118 "typescript/triple-slash-reference": "error"
119 },
120 "jsPlugins": ["@stylistic/eslint-plugin"],
121 "env": {
122 "es2020": true,
123 "browser": true
124 },
125 "plugins": ["typescript", "import"]
126 },
127 {
128 "files": ["**/*.vue"],
129 "rules": {
130 "for-direction": "error",
131 "no-async-promise-executor": "error",
132 "no-case-declarations": "error",
133 "no-class-assign": "error",
134 "no-compare-neg-zero": "error",
135 "no-cond-assign": "error",
136 "no-constant-binary-expression": "error",
137 "no-constant-condition": "error",
138 "no-control-regex": "error",
139 "no-debugger": "error",
140 "no-delete-var": "error",
141 "no-dupe-else-if": "error",
142 "no-duplicate-case": "error",
143 "no-empty-character-class": "error",
144 "no-empty-pattern": "error",
145 "no-empty-static-block": "error",
146 "no-ex-assign": "error",
147 "no-extra-boolean-cast": "error",
148 "no-fallthrough": "error",
149 "no-global-assign": "error",
150 "no-invalid-regexp": "error",
151 "no-irregular-whitespace": "error",
152 "no-loss-of-precision": "error",
153 "no-misleading-character-class": "error",
154 "no-nonoctal-decimal-escape": "error",
155 "no-regex-spaces": "error",
156 "no-self-assign": "error",
157 "no-shadow": "warn",
158 "no-shadow-restricted-names": "error",
159 "no-sparse-arrays": "error",
160 "no-unsafe-finally": "error",
161 "no-unsafe-optional-chaining": "error",
162 "no-unused-labels": "error",
163 "no-unused-private-class-members": "error",
164 "no-useless-backreference": "error",
165 "no-useless-catch": "error",
166 "no-useless-escape": "error",
167 "no-var": "error",
168 "no-with": "error",
169 "prefer-const": "error",
170 "require-yield": "error",
171 "use-isnan": "error",
172 "valid-typeof": "error",
173 "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
174 "import/first": "error",
175 "import/newline-after-import": "error",
176 "import/no-commonjs": "error",
177 "import/no-duplicates": "error",
178 "@stylistic/spaced-comment": "error",
179 "typescript/array-type": [
180 "error",
181 {
182 "default": "generic",
183 "readonly": "generic"
184 }
185 ],
186 "typescript/ban-ts-comment": [
187 "error",
188 {
189 "ts-expect-error": false,
190 "ts-ignore": "allow-with-description"
191 }
192 ],
193 "typescript/consistent-type-imports": [
194 "error",
195 {
196 "prefer": "type-imports"
197 }
198 ],
199 "typescript/method-signature-style": ["error", "property"],
200 "typescript/no-duplicate-enum-values": "error",
201 "typescript/no-extra-non-null-assertion": "error",
202 "typescript/no-inferrable-types": [
203 "error",
204 {
205 "ignoreParameters": true
206 }
207 ],
208 "typescript/no-misused-new": "error",
209 "typescript/no-namespace": "error",
210 "typescript/no-non-null-asserted-optional-chain": "error",
211 "typescript/no-unsafe-function-type": "error",
212 "typescript/no-wrapper-object-types": "error",
213 "typescript/prefer-as-const": "error",
214 "typescript/prefer-for-of": "warn",
215 "typescript/triple-slash-reference": "error"
216 },
217 "jsPlugins": ["@stylistic/eslint-plugin"],
218 "plugins": ["typescript", "import"],
219 "env": {
220 "browser": true
221 }
222 },
223 {
224 "files": ["packages/*/src/**/*.{ts,tsx}"],
225 "rules": {
226 "typescript/no-non-null-assertion": "error",
227 "typescript/no-explicit-any": "warn",
228 "typescript/no-floating-promises": "error",
229 "typescript/no-misused-promises": "error",
230 "typescript/await-thenable": "error",
231 "typescript/switch-exhaustiveness-check": "error",
232 "typescript/consistent-type-exports": "error",
233 "typescript/prefer-readonly": "error",
234 "typescript/ban-ts-comment": [
235 "error",
236 {
237 "ts-expect-error": "allow-with-description",
238 "ts-ignore": false,
239 "ts-nocheck": true,
240 "ts-check": false
241 }
242 ],
243 "eslint-js/no-restricted-syntax": [
244 "error",
245 {
246 "selector": "TSAsExpression > TSAsExpression[typeAnnotation.type='TSUnknownKeyword']",
247 "message": "Avoid `as unknown as <Type>` — it bypasses TS's structural overlap check. Prefer plain `as <Type>`, fix the root cause, or opt out with `// oxlint-disable-next-line eslint-js/no-restricted-syntax -- <reason>`."
248 }
249 ]
250 },
251 "plugins": ["typescript"]
252 },
253 {
254 "files": [
255 "packages/{openai-base,ai-openai,ai-anthropic,ai-gemini,ai-mistral,ai-openrouter,ai-elevenlabs,ai-fal,ai-bedrock,ai-groq,ai-grok,ai-byteplus,ai-cloudflare,ai-llmgateway,ai-lovable,ai-neon,ai-vercel-gateway,ai-vertex}/src/**/*.{ts,tsx}"
256 ],
257 "rules": {
258 "eslint-js/no-restricted-syntax": [
259 "error",
260 {
261 "selector": "TSAsExpression > TSAsExpression[typeAnnotation.type='TSUnknownKeyword']",
262 "message": "Avoid `as unknown as <Type>` — it bypasses TS's structural overlap check. Prefer plain `as <Type>`, fix the root cause, or opt out with `// oxlint-disable-next-line eslint-js/no-restricted-syntax -- <reason>`."
263 },
264 {
265 "selector": ":matches(ImportDeclaration[importKind!='type'], ExportNamedDeclaration[exportKind!='type'], ExportAllDeclaration[exportKind!='type'])[source.value=/^(openai|openai\\x2Fazure|@anthropic-ai\\x2Fsdk|@google\\x2Fgenai|@mistralai\\x2Fmistralai|@openrouter\\x2Fsdk|@elevenlabs\\x2Felevenlabs-js|@fal-ai\\x2Fclient|@smithy\\x2Fsignature-v4|@aws-crypto\\x2Fsha256-js)$/]",
266 "message": "Do not load a provider SDK at runtime from its root. Use `import type`, an allowed deep path (for example `openai/core/error`), or a dynamic `await import()` on a rare path."
267 }
268 ]
269 }
270 },
271 {
272 "files": ["packages/ai-fal/src/utils/configure.ts"],
273 "rules": {
274 "eslint-js/no-restricted-syntax": [
275 "error",
276 {
277 "selector": "TSAsExpression > TSAsExpression[typeAnnotation.type='TSUnknownKeyword']",
278 "message": "Avoid `as unknown as <Type>` — it bypasses TS's structural overlap check. Prefer plain `as <Type>`, fix the root cause, or opt out with `// oxlint-disable-next-line eslint-js/no-restricted-syntax -- <reason>`."
279 },
280 {
281 "selector": ":matches(ImportDeclaration[importKind!='type'], ExportNamedDeclaration[exportKind!='type'], ExportAllDeclaration[exportKind!='type'])[source.value=/^(openai|openai\\x2Fazure|@anthropic-ai\\x2Fsdk|@google\\x2Fgenai|@mistralai\\x2Fmistralai|@openrouter\\x2Fsdk|@elevenlabs\\x2Felevenlabs-js|@smithy\\x2Fsignature-v4|@aws-crypto\\x2Fsha256-js)$/]",
282 "message": "Do not load a provider SDK at runtime from its root. Use `import type`, an allowed deep path (for example `openai/core/error`), or a dynamic `await import()` on a rare path."
283 }
284 ]
285 }
286 }
287 ]