@kasoa/vite-plus-config 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +211 -42
  2. package/dist/compose-XJvIUwAG.d.mts +14 -0
  3. package/dist/compose-XJvIUwAG.d.mts.map +1 -0
  4. package/dist/constants-D2PDomKY.mjs +33 -0
  5. package/dist/constants-D2PDomKY.mjs.map +1 -0
  6. package/dist/src/cloudflare-workers/index.d.mts +6 -10
  7. package/dist/src/cloudflare-workers/index.d.mts.map +1 -1
  8. package/dist/src/cloudflare-workers/index.mjs +11 -9
  9. package/dist/src/cloudflare-workers/index.mjs.map +1 -1
  10. package/dist/src/index.d.mts +47 -0
  11. package/dist/src/index.d.mts.map +1 -0
  12. package/dist/{base-7cyIJaBC.mjs → src/index.mjs} +425 -252
  13. package/dist/src/index.mjs.map +1 -0
  14. package/package.json +6 -25
  15. package/dist/base-7cyIJaBC.mjs.map +0 -1
  16. package/dist/config-Cxe-N0iS.d.mts +0 -16
  17. package/dist/config-Cxe-N0iS.d.mts.map +0 -1
  18. package/dist/src/base/index.d.mts +0 -7
  19. package/dist/src/base/index.d.mts.map +0 -1
  20. package/dist/src/base/index.mjs +0 -2
  21. package/dist/src/library/index.d.mts +0 -7
  22. package/dist/src/library/index.d.mts.map +0 -1
  23. package/dist/src/library/index.mjs +0 -15
  24. package/dist/src/library/index.mjs.map +0 -1
  25. package/dist/src/monorepo/index.d.mts +0 -7
  26. package/dist/src/monorepo/index.d.mts.map +0 -1
  27. package/dist/src/monorepo/index.mjs +0 -16
  28. package/dist/src/monorepo/index.mjs.map +0 -1
  29. package/dist/src/node/index.d.mts +0 -7
  30. package/dist/src/node/index.d.mts.map +0 -1
  31. package/dist/src/node/index.mjs +0 -10
  32. package/dist/src/node/index.mjs.map +0 -1
  33. package/dist/src/react/index.d.mts +0 -7
  34. package/dist/src/react/index.d.mts.map +0 -1
  35. package/dist/src/react/index.mjs +0 -13
  36. package/dist/src/react/index.mjs.map +0 -1
  37. package/dist/src/react-native/index.d.mts +0 -7
  38. package/dist/src/react-native/index.d.mts.map +0 -1
  39. package/dist/src/react-native/index.mjs +0 -13
  40. package/dist/src/react-native/index.mjs.map +0 -1
@@ -1,54 +1,17 @@
1
- import { defineConfig, lazyPlugins, mergeConfig } from "vite-plus";
2
- //#region src/shared/config.ts
3
- function createLazyPluginInputs(factory) {
4
- return lazyPlugins(factory);
5
- }
1
+ import { a as DEFAULT_IGNORE_PATTERNS, d as TEST_FILES, i as CONFIG_FILES, l as REACT_NATIVE_IGNORE_PATTERNS, n as CODE_FILES, o as DEFAULT_STAGED_CHECK_COMMAND, r as COMMONJS_FILES, s as DEFAULT_STAGED_CHECK_GLOB, t as CLOUDFLARE_WORKER_IGNORE_PATTERNS, u as RUNTIME_OVERRIDE_EXCLUDE_FILES } from "../constants-D2PDomKY.mjs";
2
+ import { defineConfig, mergeConfig } from "vite-plus";
3
+ //#region src/compose.ts
6
4
  function toUserConfig(config) {
7
5
  return config;
8
6
  }
9
- function mergeConfigFragment(current, fragment) {
10
- const merged = toUserConfig(mergeConfig(current, toUserConfig(fragment)));
11
- const rules = fragment.lint?.rules;
12
- if (rules === void 0) return merged;
13
- return {
14
- ...merged,
15
- lint: {
16
- ...merged.lint,
17
- rules: {
18
- ...current.lint?.rules,
19
- ...rules
20
- }
21
- }
22
- };
23
- }
24
- function mergeConfigFragments(base, ...overrides) {
25
- let result = mergeConfigFragment({}, base);
26
- for (const override of overrides) result = mergeConfigFragment(result, override);
27
- return result;
7
+ function composeConfig(...fragments) {
8
+ let config = {};
9
+ for (const fragment of fragments) config = mergeConfig(config, toUserConfig(fragment));
10
+ return defineConfig(config);
28
11
  }
29
- function createDefinedConfig(base, ...overrides) {
30
- return defineConfig(mergeConfigFragments(base, ...overrides));
31
- }
32
- //#endregion
33
- //#region src/shared/constants.ts
34
- const DEFAULT_TEST_INCLUDE = ["**/*.{test,spec}.{ts,tsx,mts,cts}"];
35
- const DEFAULT_IGNORE_PATTERNS = [
36
- "node_modules/**",
37
- "dist/**",
38
- "dist-ssr/**",
39
- "**/.wrangler/**",
40
- "**/worker-configuration.d.ts",
41
- "**/migrations/**",
42
- "**/drizzle/migrations.js",
43
- "**/drizzle/meta/*.json"
44
- ];
45
- const REACT_NATIVE_IGNORE_PATTERNS = ["**/.expo/**"];
46
- const DEFAULT_STAGED_CHECK_GLOB = "*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}";
47
- const DEFAULT_STAGED_CHECK_COMMAND = "vp check --fix";
48
- const DEFAULT_WRANGLER_CONFIG_PATH = "./wrangler.jsonc";
49
12
  //#endregion
50
- //#region src/shared/fmt.ts
51
- const baseFmt = {
13
+ //#region src/format.ts
14
+ const baseFormatConfig = {
52
15
  ignorePatterns: [...DEFAULT_IGNORE_PATTERNS],
53
16
  sortImports: {
54
17
  internalPattern: ["#", "@/"],
@@ -72,17 +35,327 @@ const baseFmt = {
72
35
  ]
73
36
  }
74
37
  };
75
- const reactFmt = { sortTailwindcss: {
38
+ const reactFormatConfig = { sortTailwindcss: {
76
39
  attributes: ["/.*ClassName/"],
77
40
  functions: ["tv"]
78
41
  } };
79
- const reactNativeFmt = {
80
- ...reactFmt,
81
- ignorePatterns: [...REACT_NATIVE_IGNORE_PATTERNS]
42
+ const reactNativeFormatConfig = { ignorePatterns: [...REACT_NATIVE_IGNORE_PATTERNS] };
43
+ const cloudflareWorkerFormatConfig = { ignorePatterns: [...CLOUDFLARE_WORKER_IGNORE_PATTERNS] };
44
+ //#endregion
45
+ //#region src/lint/rules/browser.ts
46
+ const browserRules = {
47
+ "no-alert": "error",
48
+ "unicorn/prefer-classlist-toggle": "error",
49
+ "unicorn/prefer-dom-node-append": "error",
50
+ "unicorn/prefer-dom-node-dataset": "error",
51
+ "unicorn/prefer-dom-node-remove": "error",
52
+ "unicorn/prefer-dom-node-text-content": "error",
53
+ "unicorn/prefer-keyboard-event-key": "error",
54
+ "unicorn/prefer-modern-dom-apis": "error"
55
+ };
56
+ //#endregion
57
+ //#region src/lint/rules/node.ts
58
+ const nodeRules = {
59
+ "node/exports-style": "error",
60
+ "node/global-require": "error",
61
+ "node/no-exports-assign": "error",
62
+ "node/no-mixed-requires": "error"
63
+ };
64
+ //#endregion
65
+ //#region src/lint/rules/react-core.ts
66
+ const reactCoreRules = {
67
+ "react/display-name": "error",
68
+ "react/function-component-definition": ["error", {
69
+ namedComponents: "function-declaration",
70
+ unnamedComponents: ["arrow-function", "function-expression"]
71
+ }],
72
+ "react/hook-use-state": "error",
73
+ "react/jsx-boolean-value": "error",
74
+ "react/jsx-curly-brace-presence": "error",
75
+ "react/jsx-fragments": "error",
76
+ "react/jsx-max-depth": ["error", { max: 6 }],
77
+ "react/jsx-no-constructed-context-values": "error",
78
+ "react/jsx-no-useless-fragment": "error",
79
+ "react/jsx-pascal-case": "error",
80
+ "react/no-array-index-key": "error",
81
+ "react/no-object-type-as-default-prop": "error",
82
+ "react/no-redundant-should-component-update": "error",
83
+ "react/no-set-state": "error",
84
+ "react/prefer-es6-class": "error",
85
+ "react/rules-of-hooks": "error",
86
+ "react/self-closing-comp": "error",
87
+ "react/state-in-constructor": "error",
88
+ "react/exhaustive-deps": "error",
89
+ "react/react-compiler": "error",
90
+ "react/react-in-jsx-scope": "off",
91
+ "react/jsx-key": "error",
92
+ "react/jsx-no-duplicate-props": "error",
93
+ "react/jsx-no-undef": "error",
94
+ "react/no-children-prop": "error",
95
+ "react/no-clone-element": "error",
96
+ "react/no-direct-mutation-state": "error",
97
+ "react/no-react-children": "error",
98
+ "react/no-string-refs": "error",
99
+ "react/no-unsafe": "error",
100
+ "react/style-prop-object": "off"
82
101
  };
83
102
  //#endregion
84
- //#region src/shared/rule-policy.ts
85
- const reviewedBaseRules = {
103
+ //#region src/lint/rules/react-dom.ts
104
+ const reactDomRules = {
105
+ "react/checked-requires-onchange-or-readonly": "error",
106
+ "react/jsx-no-target-blank": "error",
107
+ "react/no-unescaped-entities": "error",
108
+ "react/no-danger": "error",
109
+ "react/no-danger-with-children": "error",
110
+ "react/no-find-dom-node": "error",
111
+ "react/no-unknown-property": "error",
112
+ "react/void-dom-elements-no-children": "error"
113
+ };
114
+ //#endregion
115
+ //#region src/lint/rules/react-native.ts
116
+ const reactNativeRules = {
117
+ "react/iframe-missing-sandbox": "off",
118
+ "react/jsx-no-script-url": "off",
119
+ "react/no-unknown-property": "off",
120
+ "react/no-unescaped-entities": "off",
121
+ "react/no-unstable-nested-components": ["error", { allowAsProps: true }],
122
+ "react/void-dom-elements-no-children": "off"
123
+ };
124
+ //#endregion
125
+ //#region src/lint/rules/vitest.ts
126
+ const vitestRules = {
127
+ "vitest/consistent-each-for": "error",
128
+ "vitest/consistent-test-it": ["error", {
129
+ fn: "test",
130
+ withinDescribe: "it"
131
+ }],
132
+ "vitest/consistent-vitest-vi": "error",
133
+ "vitest/max-nested-describe": ["error", { max: 3 }],
134
+ "vitest/no-alias-methods": "error",
135
+ "vitest/no-duplicate-hooks": "error",
136
+ "vitest/no-identical-title": "error",
137
+ "vitest/no-import-node-test": "error",
138
+ "vitest/no-interpolation-in-snapshots": "error",
139
+ "vitest/no-large-snapshots": "error",
140
+ "vitest/no-mocks-import": "error",
141
+ "vitest/no-test-prefixes": "error",
142
+ "vitest/no-test-return-statement": "error",
143
+ "vitest/no-unneeded-async-expect-function": "error",
144
+ "vitest/padding-around-after-all-blocks": "error",
145
+ "vitest/padding-around-test-blocks": "error",
146
+ "vitest/prefer-called-exactly-once-with": "error",
147
+ "vitest/prefer-called-once": "error",
148
+ "vitest/prefer-called-with": "error",
149
+ "vitest/prefer-comparison-matcher": "error",
150
+ "vitest/prefer-each": "error",
151
+ "vitest/prefer-equality-matcher": "error",
152
+ "vitest/prefer-expect-resolves": "error",
153
+ "vitest/prefer-expect-type-of": "error",
154
+ "vitest/prefer-hooks-in-order": "error",
155
+ "vitest/prefer-hooks-on-top": "error",
156
+ "vitest/prefer-import-in-mock": "error",
157
+ "vitest/prefer-importing-vitest-globals": "error",
158
+ "vitest/prefer-mock-promise-shorthand": "error",
159
+ "vitest/prefer-mock-return-shorthand": "error",
160
+ "vitest/prefer-spy-on": "error",
161
+ "vitest/prefer-strict-boolean-matchers": "error",
162
+ "vitest/prefer-strict-equal": "error",
163
+ "vitest/prefer-to-be": "error",
164
+ "vitest/prefer-to-be-object": "error",
165
+ "vitest/prefer-to-contain": "error",
166
+ "vitest/prefer-to-have-been-called-times": "error",
167
+ "vitest/prefer-to-have-length": "error",
168
+ "vitest/prefer-todo": "error"
169
+ };
170
+ //#endregion
171
+ //#region src/lint/profiles.ts
172
+ const BASE_LINT_PLUGINS = [
173
+ "typescript",
174
+ "unicorn",
175
+ "oxc",
176
+ "import",
177
+ "promise"
178
+ ];
179
+ const neutralEnvironment = {
180
+ browser: false,
181
+ node: false,
182
+ serviceworker: false,
183
+ worker: false
184
+ };
185
+ const nodeEnvironment = {
186
+ ...neutralEnvironment,
187
+ node: true
188
+ };
189
+ const browserEnvironment = {
190
+ ...neutralEnvironment,
191
+ browser: true
192
+ };
193
+ const reactNativeEnvironment = { ...neutralEnvironment };
194
+ const cloudflareWorkerEnvironment = {
195
+ ...neutralEnvironment,
196
+ serviceworker: true,
197
+ worker: true
198
+ };
199
+ const platformGlobalsOff = {
200
+ __DEV__: "off",
201
+ Cloudflare: "off",
202
+ DigestStream: "off",
203
+ FixedLengthStream: "off",
204
+ HTMLRewriter: "off",
205
+ IdentityTransformStream: "off",
206
+ process: "off",
207
+ WebSocketPair: "off",
208
+ WebSocketRequestResponsePair: "off"
209
+ };
210
+ const nodeGlobals = {
211
+ ...platformGlobalsOff,
212
+ console: "readonly",
213
+ process: "readonly"
214
+ };
215
+ const cloudflareWorkerGlobals = {
216
+ ...platformGlobalsOff,
217
+ Cloudflare: "readonly",
218
+ DigestStream: "readonly",
219
+ FixedLengthStream: "readonly",
220
+ HTMLRewriter: "readonly",
221
+ IdentityTransformStream: "readonly",
222
+ WebSocketPair: "readonly",
223
+ WebSocketRequestResponsePair: "readonly"
224
+ };
225
+ const neutralLint = {
226
+ env: neutralEnvironment,
227
+ globals: platformGlobalsOff,
228
+ plugins: [...BASE_LINT_PLUGINS]
229
+ };
230
+ const nodeLint = {
231
+ env: nodeEnvironment,
232
+ globals: nodeGlobals,
233
+ plugins: [...BASE_LINT_PLUGINS, "node"],
234
+ rules: nodeRules
235
+ };
236
+ const browserLint = {
237
+ env: browserEnvironment,
238
+ globals: platformGlobalsOff,
239
+ plugins: [...BASE_LINT_PLUGINS],
240
+ rules: browserRules
241
+ };
242
+ const reactCoreLint = {
243
+ plugins: [...BASE_LINT_PLUGINS, "react"],
244
+ rules: reactCoreRules
245
+ };
246
+ const reactDomLint = {
247
+ plugins: [
248
+ ...BASE_LINT_PLUGINS,
249
+ "react",
250
+ "jsx-a11y"
251
+ ],
252
+ rules: reactDomRules
253
+ };
254
+ const reactNativeGlobals = {
255
+ ...platformGlobalsOff,
256
+ __BUNDLE_START_TIME__: "readonly",
257
+ __DEV__: "readonly",
258
+ AbortController: "readonly",
259
+ AbortSignal: "readonly",
260
+ alert: "readonly",
261
+ Blob: "readonly",
262
+ cancelAnimationFrame: "readonly",
263
+ clearImmediate: "readonly",
264
+ clearInterval: "readonly",
265
+ clearTimeout: "readonly",
266
+ console: "readonly",
267
+ crypto: "readonly",
268
+ DOMRect: "readonly",
269
+ ErrorUtils: "readonly",
270
+ Event: "readonly",
271
+ EventTarget: "readonly",
272
+ fetch: "readonly",
273
+ fetchBundle: "readonly",
274
+ File: "readonly",
275
+ FileReader: "readonly",
276
+ FormData: "readonly",
277
+ Headers: "readonly",
278
+ HermesInternal: "readonly",
279
+ navigator: "readonly",
280
+ originalXMLHttpRequest: "readonly",
281
+ performance: "readonly",
282
+ process: "readonly",
283
+ queueMicrotask: "readonly",
284
+ requestAnimationFrame: "readonly",
285
+ Request: "readonly",
286
+ require: "readonly",
287
+ Response: "readonly",
288
+ setImmediate: "readonly",
289
+ setInterval: "readonly",
290
+ setTimeout: "readonly",
291
+ URL: "readonly",
292
+ URLSearchParams: "readonly",
293
+ WebSocket: "readonly",
294
+ XMLHttpRequest: "readonly",
295
+ XMLHttpRequestUpload: "readonly"
296
+ };
297
+ const reactNativeRuntimeLint = {
298
+ env: reactNativeEnvironment,
299
+ globals: reactNativeGlobals,
300
+ plugins: [...BASE_LINT_PLUGINS, "react"],
301
+ rules: reactNativeRules
302
+ };
303
+ const reactWebLint = {
304
+ env: browserEnvironment,
305
+ globals: platformGlobalsOff,
306
+ plugins: [
307
+ ...BASE_LINT_PLUGINS,
308
+ "react",
309
+ "jsx-a11y"
310
+ ],
311
+ rules: {
312
+ ...browserRules,
313
+ ...reactCoreRules,
314
+ ...reactDomRules
315
+ }
316
+ };
317
+ const reactNativeLint = {
318
+ env: reactNativeEnvironment,
319
+ globals: reactNativeGlobals,
320
+ plugins: [...BASE_LINT_PLUGINS, "react"],
321
+ rules: {
322
+ ...reactCoreRules,
323
+ ...reactNativeRules
324
+ }
325
+ };
326
+ const cloudflareWorkerLint = {
327
+ env: cloudflareWorkerEnvironment,
328
+ globals: cloudflareWorkerGlobals,
329
+ plugins: [...BASE_LINT_PLUGINS]
330
+ };
331
+ const nodeTestLint = {
332
+ ...nodeLint,
333
+ plugins: [
334
+ ...BASE_LINT_PLUGINS,
335
+ "node",
336
+ "vitest"
337
+ ],
338
+ rules: {
339
+ ...nodeRules,
340
+ ...vitestRules
341
+ }
342
+ };
343
+ const browserTestLint = {
344
+ ...browserLint,
345
+ plugins: [...BASE_LINT_PLUGINS, "vitest"],
346
+ rules: {
347
+ ...browserRules,
348
+ ...vitestRules
349
+ }
350
+ };
351
+ const cloudflareWorkerTestLint = {
352
+ ...cloudflareWorkerLint,
353
+ plugins: [...BASE_LINT_PLUGINS, "vitest"],
354
+ rules: vitestRules
355
+ };
356
+ //#endregion
357
+ //#region src/lint/rules/universal.ts
358
+ const universalRules = {
86
359
  "accessor-pairs": "error",
87
360
  "array-callback-return": "error",
88
361
  "arrow-body-style": "error",
@@ -264,23 +537,16 @@ const reviewedBaseRules = {
264
537
  "unicorn/prefer-bigint-literals": "error",
265
538
  "unicorn/prefer-blob-reading-methods": "error",
266
539
  "unicorn/prefer-class-fields": "error",
267
- "unicorn/prefer-classlist-toggle": "error",
268
540
  "unicorn/prefer-code-point": "error",
269
541
  "unicorn/prefer-date-now": "error",
270
542
  "unicorn/prefer-default-parameters": "error",
271
- "unicorn/prefer-dom-node-append": "error",
272
- "unicorn/prefer-dom-node-dataset": "error",
273
- "unicorn/prefer-dom-node-remove": "error",
274
- "unicorn/prefer-dom-node-text-content": "error",
275
543
  "unicorn/prefer-export-from": "error",
276
544
  "unicorn/prefer-global-this": "error",
277
545
  "unicorn/prefer-import-meta-properties": "error",
278
546
  "unicorn/prefer-includes": "error",
279
- "unicorn/prefer-keyboard-event-key": "error",
280
547
  "unicorn/prefer-logical-operator-over-ternary": "error",
281
548
  "unicorn/prefer-math-min-max": "error",
282
549
  "unicorn/prefer-math-trunc": "error",
283
- "unicorn/prefer-modern-dom-apis": "error",
284
550
  "unicorn/prefer-native-coercion-functions": "error",
285
551
  "unicorn/prefer-negative-index": "error",
286
552
  "unicorn/prefer-number-coercion": "error",
@@ -308,99 +574,9 @@ const reviewedBaseRules = {
308
574
  "unicorn/switch-case-break-position": "error",
309
575
  "unicorn/text-encoding-identifier-case": "error",
310
576
  "unicorn/throw-new-error": "error",
311
- yoda: "error"
312
- };
313
- const reviewedReactRules = {
314
- "react/checked-requires-onchange-or-readonly": "error",
315
- "react/display-name": "error",
316
- "react/function-component-definition": ["error", {
317
- namedComponents: "function-declaration",
318
- unnamedComponents: ["arrow-function", "function-expression"]
319
- }],
320
- "react/hook-use-state": "error",
321
- "react/jsx-boolean-value": "error",
322
- "react/jsx-curly-brace-presence": "error",
323
- "react/jsx-fragments": "error",
324
- "react/jsx-max-depth": ["error", { max: 6 }],
325
- "react/jsx-no-constructed-context-values": "error",
326
- "react/jsx-no-target-blank": "error",
327
- "react/jsx-no-useless-fragment": "error",
328
- "react/jsx-pascal-case": "error",
329
- "react/no-array-index-key": "error",
330
- "react/no-object-type-as-default-prop": "error",
331
- "react/no-redundant-should-component-update": "error",
332
- "react/no-set-state": "error",
333
- "react/no-unescaped-entities": "error",
334
- "react/prefer-es6-class": "error",
335
- "react/rules-of-hooks": "error",
336
- "react/self-closing-comp": "error",
337
- "react/state-in-constructor": "error"
338
- };
339
- const reviewedNodeRules = {
340
- "node/callback-return": "error",
341
- "node/exports-style": "error",
342
- "node/global-require": "error",
343
- "node/no-exports-assign": "error",
344
- "node/no-mixed-requires": "error"
345
- };
346
- const reviewedVitestRules = {
347
- "vitest/consistent-each-for": "error",
348
- "vitest/consistent-test-it": ["error", {
349
- fn: "test",
350
- withinDescribe: "it"
351
- }],
352
- "vitest/consistent-vitest-vi": "error",
353
- "vitest/max-nested-describe": ["error", { max: 3 }],
354
- "vitest/no-alias-methods": "error",
355
- "vitest/no-duplicate-hooks": "error",
356
- "vitest/no-identical-title": "error",
357
- "vitest/no-import-node-test": "error",
358
- "vitest/no-interpolation-in-snapshots": "error",
359
- "vitest/no-large-snapshots": "error",
360
- "vitest/no-mocks-import": "error",
361
- "vitest/no-test-prefixes": "error",
362
- "vitest/no-test-return-statement": "error",
363
- "vitest/no-unneeded-async-expect-function": "error",
364
- "vitest/padding-around-after-all-blocks": "error",
365
- "vitest/padding-around-test-blocks": "error",
366
- "vitest/prefer-called-exactly-once-with": "error",
367
- "vitest/prefer-called-once": "error",
368
- "vitest/prefer-called-with": "error",
369
- "vitest/prefer-comparison-matcher": "error",
370
- "vitest/prefer-each": "error",
371
- "vitest/prefer-equality-matcher": "error",
372
- "vitest/prefer-expect-resolves": "error",
373
- "vitest/prefer-expect-type-of": "error",
374
- "vitest/prefer-hooks-in-order": "error",
375
- "vitest/prefer-hooks-on-top": "error",
376
- "vitest/prefer-import-in-mock": "error",
377
- "vitest/prefer-importing-vitest-globals": "error",
378
- "vitest/prefer-mock-promise-shorthand": "error",
379
- "vitest/prefer-mock-return-shorthand": "error",
380
- "vitest/prefer-spy-on": "error",
381
- "vitest/prefer-strict-boolean-matchers": "error",
382
- "vitest/prefer-strict-equal": "error",
383
- "vitest/prefer-to-be": "error",
384
- "vitest/prefer-to-be-object": "error",
385
- "vitest/prefer-to-contain": "error",
386
- "vitest/prefer-to-have-been-called-times": "error",
387
- "vitest/prefer-to-have-length": "error",
388
- "vitest/prefer-todo": "error"
389
- };
390
- //#endregion
391
- //#region src/shared/lint.ts
392
- const BASE_LINT_PLUGINS = [
393
- "typescript",
394
- "unicorn",
395
- "oxc",
396
- "import",
397
- "promise"
398
- ];
399
- const baseRules = {
400
- ...reviewedBaseRules,
577
+ yoda: "error",
401
578
  complexity: ["error", { max: 20 }],
402
579
  "getter-return": "error",
403
- "no-alert": "error",
404
580
  "no-bitwise": "error",
405
581
  "no-console": ["error", { allow: [
406
582
  "info",
@@ -412,63 +588,37 @@ const baseRules = {
412
588
  "no-undef": "error",
413
589
  "no-unneeded-ternary": "error",
414
590
  "no-unreachable": "error",
415
- "no-useless-return": "error",
416
- "prefer-template": "error",
417
591
  "import/no-cycle": "error",
418
592
  "import/no-unassigned-import": "off",
419
593
  "oxc/bad-match-all-arg": "error",
420
594
  "typescript/consistent-return": "error",
421
- "typescript/consistent-type-exports": "error",
422
- "typescript/consistent-type-imports": ["error", {
423
- prefer: "type-imports",
424
- fixStyle: "separate-type-imports"
425
- }],
426
- "typescript/dot-notation": "error",
427
595
  "typescript/explicit-module-boundary-types": "error",
428
- "typescript/no-confusing-void-expression": "error",
429
596
  "typescript/no-dynamic-delete": "error",
430
597
  "typescript/no-explicit-any": "error",
431
598
  "typescript/no-floating-promises": "error",
432
- "typescript/no-misused-promises": "error",
433
599
  "typescript/no-misused-spread": "error",
434
600
  "typescript/no-non-null-assertion": "error",
435
601
  "typescript/no-require-imports": "error",
436
602
  "typescript/no-unnecessary-condition": "error",
437
- "typescript/no-unnecessary-qualifier": "error",
438
603
  "typescript/no-unnecessary-type-arguments": "error",
439
604
  "typescript/no-unnecessary-type-assertion": "error",
440
605
  "typescript/no-unnecessary-type-parameters": "error",
441
- "typescript/no-unsafe-argument": "error",
442
- "typescript/no-unsafe-assignment": "error",
443
- "typescript/no-unsafe-call": "error",
444
- "typescript/no-unsafe-member-access": "error",
445
- "typescript/no-unsafe-return": "error",
446
606
  "typescript/no-useless-default-assignment": "error",
447
607
  "typescript/non-nullable-type-assertion-style": "error",
448
- "typescript/only-throw-error": "error",
449
- "typescript/prefer-find": "error",
450
- "typescript/prefer-nullish-coalescing": "error",
451
608
  "typescript/prefer-optional-chain": "error",
452
- "typescript/prefer-readonly": "error",
453
- "typescript/prefer-regexp-exec": "error",
454
609
  "typescript/require-array-sort-compare": "error",
455
- "typescript/restrict-plus-operands": "error",
456
610
  "typescript/restrict-template-expressions": "error",
457
- "typescript/return-await": "error",
458
- "typescript/strict-boolean-expressions": "error",
459
- "typescript/strict-void-return": "error",
460
- "typescript/switch-exhaustiveness-check": "error",
461
611
  "typescript/unbound-method": "error",
462
612
  "typescript/use-unknown-in-catch-callback-variable": "error",
463
613
  "unicorn/no-abusive-eslint-disable": "error"
464
614
  };
465
- const baseLint = {
615
+ //#endregion
616
+ //#region src/lint/configs.ts
617
+ const baseLintConfig = {
466
618
  plugins: [...BASE_LINT_PLUGINS],
467
619
  ignorePatterns: [...DEFAULT_IGNORE_PATTERNS],
468
- env: {
469
- serviceworker: true,
470
- worker: true
471
- },
620
+ env: neutralEnvironment,
621
+ globals: neutralLint.globals,
472
622
  options: {
473
623
  reportUnusedDisableDirectives: "error",
474
624
  typeAware: true,
@@ -478,95 +628,118 @@ const baseLint = {
478
628
  correctness: "error",
479
629
  suspicious: "error"
480
630
  },
481
- rules: baseRules,
631
+ extends: [{ rules: universalRules }],
482
632
  overrides: [
483
633
  {
484
- files: ["**/*.{cjs,cts}"],
485
- env: { node: true },
486
- rules: { "typescript/no-require-imports": "off" }
634
+ files: [...COMMONJS_FILES],
635
+ ...nodeLint,
636
+ rules: {
637
+ ...nodeRules,
638
+ "typescript/no-require-imports": "off"
639
+ }
487
640
  },
488
641
  {
489
- files: ["**/*.config.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"],
490
- env: { node: true },
491
- rules: { "func-names": "off" }
642
+ files: [...CONFIG_FILES],
643
+ ...nodeLint,
644
+ rules: {
645
+ ...nodeRules,
646
+ "func-names": "off"
647
+ }
492
648
  },
493
649
  {
494
650
  files: ["**/*.d.ts"],
495
651
  rules: { "typescript/no-empty-interface": "off" }
496
- },
497
- {
498
- files: [
499
- "**/test/**",
500
- "**/tests/**",
501
- "**/__tests__/**",
502
- "**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"
503
- ],
504
- plugins: [...BASE_LINT_PLUGINS, "vitest"],
505
- env: { vitest: true },
506
- rules: reviewedVitestRules
507
652
  }
508
653
  ]
509
654
  };
510
- const reactRules = {
511
- ...reviewedReactRules,
512
- "react/exhaustive-deps": "error",
513
- "react/react-compiler": "error",
514
- "react/react-in-jsx-scope": "off",
515
- "react/jsx-key": "error",
516
- "react/jsx-no-constructed-context-values": "error",
517
- "react/jsx-no-duplicate-props": "error",
518
- "react/jsx-no-undef": "error",
519
- "react/no-array-index-key": "error",
520
- "react/no-children-prop": "error",
521
- "react/no-clone-element": "error",
522
- "react/no-danger": "error",
523
- "react/no-danger-with-children": "error",
524
- "react/no-direct-mutation-state": "error",
525
- "react/no-find-dom-node": "error",
526
- "react/no-react-children": "error",
527
- "react/no-string-refs": "error",
528
- "react/no-unsafe": "error",
529
- "react/no-unknown-property": "error",
530
- "react/style-prop-object": "off",
531
- "react/void-dom-elements-no-children": "error"
655
+ const nodeRuntimeLintConfig = {
656
+ env: nodeEnvironment,
657
+ globals: nodeLint.globals,
658
+ plugins: ["node"],
659
+ extends: [{ rules: nodeRules }]
532
660
  };
533
- const reactLint = {
534
- plugins: ["react", "jsx-a11y"],
535
- env: { browser: true },
536
- rules: reactRules
661
+ const browserRuntimeLintConfig = {
662
+ env: browserEnvironment,
663
+ globals: neutralLint.globals,
664
+ overrides: [{
665
+ files: [...CODE_FILES],
666
+ excludeFiles: [...RUNTIME_OVERRIDE_EXCLUDE_FILES],
667
+ rules: browserRules
668
+ }]
537
669
  };
538
- const reactNativeLint = {
670
+ const reactCoreLintConfig = {
539
671
  plugins: ["react"],
540
- ignorePatterns: [...REACT_NATIVE_IGNORE_PATTERNS],
541
- env: { browser: false },
542
- globals: {
543
- __DEV__: "readonly",
544
- process: "readonly"
545
- },
546
- rules: {
547
- ...reactRules,
548
- "react/no-unknown-property": "off",
549
- "react/no-unescaped-entities": "off",
550
- "react/no-unstable-nested-components": ["error", { allowAsProps: true }]
551
- }
672
+ extends: [{ rules: reactCoreRules }]
552
673
  };
553
- const serverLint = {
554
- plugins: ["node"],
555
- globals: { WebSocketPair: "readonly" },
556
- rules: reviewedNodeRules
674
+ const reactDomLintConfig = {
675
+ plugins: ["jsx-a11y"],
676
+ extends: [{ rules: reactDomRules }]
557
677
  };
678
+ const reactNativeRuntimeLintConfig = {
679
+ env: reactNativeRuntimeLint.env,
680
+ globals: reactNativeRuntimeLint.globals,
681
+ extends: [{ rules: reactNativeRules }]
682
+ };
683
+ const cloudflareWorkerRuntimeLintConfig = {
684
+ env: cloudflareWorkerEnvironment,
685
+ globals: cloudflareWorkerLint.globals
686
+ };
687
+ const reactNativeGeneratedLintConfig = { ignorePatterns: [...REACT_NATIVE_IGNORE_PATTERNS] };
688
+ const cloudflareWorkerGeneratedLintConfig = { ignorePatterns: [...CLOUDFLARE_WORKER_IGNORE_PATTERNS] };
689
+ const nodeTestLintConfig$1 = { overrides: [{
690
+ files: [...TEST_FILES],
691
+ ...nodeTestLint
692
+ }] };
693
+ const browserTestLintConfig$1 = { overrides: [{
694
+ files: [...TEST_FILES],
695
+ ...browserTestLint
696
+ }] };
697
+ const cloudflareWorkerTestLintConfig$1 = { overrides: [{
698
+ files: [...TEST_FILES],
699
+ ...cloudflareWorkerTestLint
700
+ }] };
558
701
  //#endregion
559
- //#region src/base/index.ts
560
- const baseConfig = {
561
- fmt: baseFmt,
562
- lint: baseLint,
563
- test: { include: [...DEFAULT_TEST_INCLUDE] },
702
+ //#region src/fragments.ts
703
+ const baseToolingConfig = {
704
+ fmt: baseFormatConfig,
705
+ lint: baseLintConfig,
564
706
  staged: { [DEFAULT_STAGED_CHECK_GLOB]: DEFAULT_STAGED_CHECK_COMMAND }
565
707
  };
566
- function createBaseConfig(overrides = {}) {
567
- return createDefinedConfig(baseConfig, overrides);
568
- }
708
+ const nodeRuntimeConfig = { lint: nodeRuntimeLintConfig };
709
+ const browserRuntimeConfig = { lint: browserRuntimeLintConfig };
710
+ const reactCoreConfig = {
711
+ fmt: reactFormatConfig,
712
+ lint: reactCoreLintConfig
713
+ };
714
+ const reactDomConfig = { lint: reactDomLintConfig };
715
+ const reactNativeRuntimeConfig = { lint: reactNativeRuntimeLintConfig };
716
+ const reactNativeGeneratedConfig = {
717
+ fmt: reactNativeFormatConfig,
718
+ lint: reactNativeGeneratedLintConfig
719
+ };
720
+ const cloudflareWorkerRuntimeConfig = { lint: cloudflareWorkerRuntimeLintConfig };
721
+ const cloudflareWorkerGeneratedConfig = {
722
+ fmt: cloudflareWorkerFormatConfig,
723
+ lint: cloudflareWorkerGeneratedLintConfig
724
+ };
725
+ const nodeTestLintConfig = { lint: nodeTestLintConfig$1 };
726
+ const browserTestLintConfig = { lint: browserTestLintConfig$1 };
727
+ const cloudflareWorkerTestLintConfig = { lint: cloudflareWorkerTestLintConfig$1 };
728
+ const libraryPackDefaults = {
729
+ clean: true,
730
+ dts: true,
731
+ format: ["esm"],
732
+ sourcemap: true
733
+ };
734
+ const libraryPackConfig = { pack: libraryPackDefaults };
735
+ const workspaceRunConfig = { run: {
736
+ cache: {
737
+ scripts: true,
738
+ tasks: true
739
+ },
740
+ enablePrePostScripts: true
741
+ } };
569
742
  //#endregion
570
- export { reactFmt as a, createDefinedConfig as c, serverLint as i, createLazyPluginInputs as l, reactLint as n, reactNativeFmt as o, reactNativeLint as r, DEFAULT_WRANGLER_CONFIG_PATH as s, createBaseConfig as t, mergeConfigFragments as u };
743
+ export { CODE_FILES, COMMONJS_FILES, CONFIG_FILES, RUNTIME_OVERRIDE_EXCLUDE_FILES, TEST_FILES, baseToolingConfig, browserLint, browserRuntimeConfig, browserTestLint, browserTestLintConfig, cloudflareWorkerGeneratedConfig, cloudflareWorkerLint, cloudflareWorkerRuntimeConfig, cloudflareWorkerTestLint, cloudflareWorkerTestLintConfig, composeConfig, libraryPackConfig, libraryPackDefaults, nodeLint, nodeRuntimeConfig, nodeTestLint, nodeTestLintConfig, reactCoreConfig, reactCoreLint, reactDomConfig, reactDomLint, reactNativeGeneratedConfig, reactNativeLint, reactNativeRuntimeConfig, reactNativeRuntimeLint, reactWebLint, workspaceRunConfig };
571
744
 
572
- //# sourceMappingURL=base-7cyIJaBC.mjs.map
745
+ //# sourceMappingURL=index.mjs.map