@quentinhsu/biome-config 0.3.5 → 0.5.0

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 (34) hide show
  1. package/dist/131.mjs +387 -0
  2. package/dist/build.mjs +108 -360
  3. package/dist/index.jsonc +1 -1
  4. package/dist/index.mjs +1 -358
  5. package/dist/next.jsonc +1 -1
  6. package/dist/nuxt.jsonc +31 -2
  7. package/dist/react.jsonc +1 -1
  8. package/dist/rslib-runtime.mjs +38 -0
  9. package/dist/types/scripts/tag-release.d.ts +1 -0
  10. package/dist/types/scripts/validate-config-properties.d.ts +1 -0
  11. package/dist/types/src/constants/biome.d.ts +1 -1
  12. package/dist/types/src/generated/biome/index.d.ts +12 -10
  13. package/dist/types/src/generated/biome/{no-label-var-options.d.ts → no-comment-text-options.d.ts} +217 -532
  14. package/dist/types/src/generated/biome/no-global-object-calls-options.d.ts +74 -75
  15. package/dist/types/src/generated/biome/{use-qwik-classlist-configuration.d.ts → no-sync-scripts-configuration.d.ts} +56 -112
  16. package/dist/types/src/generated/biome/{use-focusable-interactive-configuration.d.ts → no-useless-constructor-configuration.d.ts} +33 -51
  17. package/dist/types/src/generated/biome/nursery.d.ts +822 -0
  18. package/dist/types/src/generated/biome/pattern-options.d.ts +1075 -0
  19. package/dist/types/src/generated/biome/rule-with-no-access-key-options.d.ts +555 -0
  20. package/dist/types/src/generated/biome/rule-with-no-blank-target-options.d.ts +530 -0
  21. package/dist/types/src/generated/biome/rule-with-no-fallthrough-switch-clause-options.d.ts +469 -0
  22. package/dist/types/src/generated/biome/rule-with-no-unknown-unit-options.d.ts +564 -0
  23. package/dist/types/src/generated/biome/schema.d.ts +24 -6
  24. package/dist/types/src/generated/biome/style.d.ts +614 -0
  25. package/dist/types/src/generated/biome/use-for-of-configuration.d.ts +144 -0
  26. package/dist/types/src/generated/biome/{no-magic-numbers-options.d.ts → use-unique-variable-names-options.d.ts} +127 -105
  27. package/dist/vue.jsonc +1 -1
  28. package/package.json +11 -7
  29. package/dist/types/src/generated/biome/linter-configuration.d.ts +0 -181
  30. package/dist/types/src/generated/biome/rule-with-no-confusing-labels-options.d.ts +0 -1236
  31. package/dist/types/src/generated/biome/rule-with-no-excessive-nested-test-suites-options.d.ts +0 -1440
  32. package/dist/types/src/generated/biome/rule-with-no-unused-expressions-options.d.ts +0 -1337
  33. package/dist/types/src/generated/biome/use-consistent-object-definitions-configuration.d.ts +0 -1304
  34. package/dist/types/src/generated/biome/use-shorthand-assign-configuration.d.ts +0 -571
package/dist/131.mjs ADDED
@@ -0,0 +1,387 @@
1
+ const isPlainObject = (value)=>null !== value && 'object' == typeof value && !Array.isArray(value);
2
+ const mergeArrays = (a, b)=>{
3
+ const result = [
4
+ ...a
5
+ ];
6
+ for (const item of b)if (!result.some((existing)=>deepEqual(existing, item))) result.push(item);
7
+ return result;
8
+ };
9
+ const deepEqual = (a, b)=>{
10
+ if (a === b) return true;
11
+ if (Array.isArray(a) && Array.isArray(b)) return a.length === b.length && a.every((item, index)=>deepEqual(item, b[index]));
12
+ if (isPlainObject(a) && isPlainObject(b)) {
13
+ const keysA = Object.keys(a);
14
+ const keysB = Object.keys(b);
15
+ return keysA.length === keysB.length && keysA.every((key)=>deepEqual(a[key], b[key]));
16
+ }
17
+ return false;
18
+ };
19
+ const deepMerge = (target, source)=>{
20
+ for (const [key, value] of Object.entries(source)){
21
+ const current = target[key];
22
+ if (Array.isArray(value)) {
23
+ if (Array.isArray(current)) target[key] = mergeArrays(current, value);
24
+ else target[key] = [
25
+ ...value
26
+ ];
27
+ continue;
28
+ }
29
+ if (isPlainObject(value)) {
30
+ const nextTarget = isPlainObject(current) ? {
31
+ ...current
32
+ } : {};
33
+ target[key] = deepMerge(nextTarget, value);
34
+ continue;
35
+ }
36
+ target[key] = value;
37
+ }
38
+ return target;
39
+ };
40
+ const mergeConfigs = (...configs)=>{
41
+ const merged = configs.reduce((accumulator, config)=>deepMerge(accumulator, config), {});
42
+ return merged;
43
+ };
44
+ const BIOME_SCHEMA_URL = 'https://biomejs.dev/schemas/2.3.11/schema.json';
45
+ const indexConfig = {
46
+ $schema: BIOME_SCHEMA_URL,
47
+ assist: {
48
+ actions: {
49
+ source: {
50
+ organizeImports: {
51
+ level: 'on',
52
+ options: {
53
+ groups: [
54
+ [
55
+ ':NODE:',
56
+ ':BUN:',
57
+ ':PACKAGE_WITH_PROTOCOL:',
58
+ ':PACKAGE:'
59
+ ],
60
+ ':BLANK_LINE:',
61
+ ':ALIAS:',
62
+ ':BLANK_LINE:',
63
+ ':PATH:'
64
+ ]
65
+ }
66
+ },
67
+ useSortedAttributes: {
68
+ level: 'on',
69
+ options: {
70
+ sortOrder: 'natural'
71
+ }
72
+ },
73
+ useSortedKeys: 'on'
74
+ }
75
+ }
76
+ },
77
+ files: {
78
+ ignoreUnknown: true,
79
+ includes: [
80
+ '**',
81
+ '!**/build',
82
+ '!**/dist',
83
+ '!**/.next'
84
+ ]
85
+ },
86
+ formatter: {
87
+ enabled: true,
88
+ formatWithErrors: true,
89
+ indentStyle: 'space',
90
+ lineWidth: 140
91
+ },
92
+ javascript: {
93
+ formatter: {
94
+ arrowParentheses: 'asNeeded',
95
+ jsxQuoteStyle: 'single',
96
+ quoteStyle: 'single',
97
+ trailingCommas: 'all'
98
+ }
99
+ },
100
+ linter: {
101
+ enabled: true,
102
+ rules: {
103
+ complexity: {
104
+ noUselessStringConcat: 'error',
105
+ noUselessUndefinedInitialization: 'error',
106
+ noVoid: 'error',
107
+ useDateNow: 'error'
108
+ },
109
+ correctness: {
110
+ noConstantMathMinMaxClamp: 'error',
111
+ noUndeclaredVariables: 'error',
112
+ noUnusedFunctionParameters: 'error',
113
+ noUnusedImports: 'error',
114
+ noUnusedPrivateClassMembers: 'error',
115
+ noUnusedVariables: 'error',
116
+ useExhaustiveDependencies: {
117
+ level: 'error',
118
+ options: {
119
+ reportUnnecessaryDependencies: false
120
+ }
121
+ }
122
+ },
123
+ nursery: {
124
+ useSortedClasses: {
125
+ fix: 'safe',
126
+ level: 'error',
127
+ options: {
128
+ functions: [
129
+ 'clsx',
130
+ 'cn'
131
+ ]
132
+ }
133
+ }
134
+ },
135
+ recommended: true,
136
+ style: {
137
+ noParameterProperties: 'error',
138
+ noYodaExpression: 'error',
139
+ useArrayLiterals: 'error',
140
+ useConsistentBuiltinInstantiation: 'error',
141
+ useFragmentSyntax: 'error',
142
+ useImportType: {
143
+ fix: 'safe',
144
+ level: 'error',
145
+ options: {
146
+ style: 'separatedType'
147
+ }
148
+ },
149
+ useSelfClosingElements: {
150
+ fix: 'safe',
151
+ level: 'error',
152
+ options: {}
153
+ },
154
+ useShorthandAssign: 'error'
155
+ },
156
+ suspicious: {
157
+ noEvolvingTypes: 'error',
158
+ useAwait: 'error'
159
+ }
160
+ }
161
+ },
162
+ overrides: [
163
+ {
164
+ includes: [
165
+ '**/*.jsx',
166
+ '**/*.tsx'
167
+ ],
168
+ linter: {
169
+ rules: {
170
+ style: {
171
+ noParameterAssign: 'error'
172
+ }
173
+ }
174
+ }
175
+ },
176
+ {
177
+ includes: [
178
+ '**/*.ts',
179
+ '**/*.tsx'
180
+ ],
181
+ linter: {
182
+ rules: {
183
+ correctness: {
184
+ noUnusedVariables: 'off'
185
+ }
186
+ }
187
+ }
188
+ }
189
+ ],
190
+ root: true,
191
+ vcs: {
192
+ clientKind: 'git',
193
+ defaultBranch: 'main',
194
+ enabled: true,
195
+ useIgnoreFile: true
196
+ }
197
+ };
198
+ const reactOverlay = {
199
+ files: {
200
+ includes: [
201
+ '!**/.storybook'
202
+ ]
203
+ },
204
+ javascript: {
205
+ jsxRuntime: 'reactClassic'
206
+ },
207
+ linter: {
208
+ rules: {
209
+ style: {
210
+ useFragmentSyntax: 'error'
211
+ }
212
+ }
213
+ },
214
+ overrides: [
215
+ {
216
+ includes: [
217
+ '**/__tests__/**',
218
+ '**/*.{test,spec}.{ts,tsx,js,jsx}'
219
+ ],
220
+ linter: {
221
+ rules: {
222
+ correctness: {
223
+ noUnusedVariables: 'off'
224
+ }
225
+ }
226
+ }
227
+ }
228
+ ]
229
+ };
230
+ const reactConfig = mergeConfigs(indexConfig, reactOverlay);
231
+ const nextOverlay = {
232
+ files: {
233
+ includes: [
234
+ '!**/.next',
235
+ '!**/.vercel',
236
+ '!**/out'
237
+ ]
238
+ },
239
+ javascript: {
240
+ jsxRuntime: 'transparent'
241
+ },
242
+ linter: {
243
+ rules: {
244
+ correctness: {
245
+ useExhaustiveDependencies: {
246
+ level: 'error',
247
+ options: {
248
+ reportUnnecessaryDependencies: true
249
+ }
250
+ }
251
+ }
252
+ }
253
+ }
254
+ };
255
+ const nextConfig = mergeConfigs(reactConfig, nextOverlay);
256
+ const vueOverlay = {
257
+ files: {
258
+ includes: [
259
+ '!**/.vitepress',
260
+ '!**/.output'
261
+ ]
262
+ },
263
+ javascript: {
264
+ parser: {
265
+ jsxEverywhere: false
266
+ }
267
+ },
268
+ html: {
269
+ formatter: {
270
+ indentScriptAndStyle: true,
271
+ selfCloseVoidElements: 'always'
272
+ }
273
+ },
274
+ overrides: [
275
+ {
276
+ includes: [
277
+ '**/*.vue'
278
+ ],
279
+ formatter: {
280
+ lineWidth: 120
281
+ },
282
+ javascript: {
283
+ formatter: {
284
+ quoteStyle: 'single'
285
+ }
286
+ }
287
+ }
288
+ ]
289
+ };
290
+ const vueConfig = mergeConfigs(indexConfig, vueOverlay);
291
+ const nuxtOverlay = {
292
+ css: {
293
+ parser: {
294
+ cssModules: true,
295
+ tailwindDirectives: true
296
+ }
297
+ },
298
+ files: {
299
+ includes: [
300
+ '!**/.nuxt',
301
+ '!**/.nitro',
302
+ '!**/.output'
303
+ ]
304
+ },
305
+ javascript: {
306
+ globals: [
307
+ 'defineNuxtConfig',
308
+ 'defineAppConfig',
309
+ 'defineNuxtPlugin',
310
+ 'defineNuxtRouteMiddleware',
311
+ 'defineNuxtServerPlugin',
312
+ 'defineNitroPlugin',
313
+ 'defineEventHandler',
314
+ 'defineLazyEventHandler',
315
+ 'definePayloadPlugin',
316
+ 'defineRouteRules',
317
+ 'definePageMeta',
318
+ 'useRuntimeConfig',
319
+ 'useNuxtApp',
320
+ 'useAsyncData',
321
+ 'useLazyAsyncData',
322
+ 'useFetch',
323
+ 'useLazyFetch',
324
+ 'useState',
325
+ 'useCookie',
326
+ 'useHead',
327
+ 'useSeoMeta',
328
+ 'useError',
329
+ 'clearError',
330
+ 'showError',
331
+ 'navigateTo',
332
+ 'abortNavigation',
333
+ 'refreshNuxtData',
334
+ 'onNuxtReady',
335
+ 'useRouter',
336
+ 'useRoute',
337
+ 'useRequestEvent',
338
+ 'useRequestHeaders',
339
+ 'computed',
340
+ 'ref',
341
+ 'watch',
342
+ 'onMounted',
343
+ 'onUnmounted',
344
+ 'defineProps',
345
+ 'defineEmits',
346
+ 'useColorMode',
347
+ 'useUserSession',
348
+ '$fetch',
349
+ 'readBody',
350
+ 'getQuery',
351
+ 'readFormData',
352
+ 'createError',
353
+ 'getRequestURL',
354
+ 'getUserSession',
355
+ 'getHeader',
356
+ 'getRouterParam',
357
+ 'defineOAuthGitHubEventHandler',
358
+ 'sendRedirect',
359
+ 'setHeader',
360
+ 'setUserSession',
361
+ 'clearUserSession'
362
+ ]
363
+ },
364
+ overrides: [
365
+ {
366
+ includes: [
367
+ '**/*.ts'
368
+ ],
369
+ linter: {
370
+ rules: {
371
+ correctness: {
372
+ noUndeclaredVariables: 'error'
373
+ }
374
+ }
375
+ }
376
+ }
377
+ ]
378
+ };
379
+ const nuxtConfig = mergeConfigs(vueConfig, nuxtOverlay);
380
+ const allPresets = Object.freeze({
381
+ index: indexConfig,
382
+ next: nextConfig,
383
+ nuxt: nuxtConfig,
384
+ react: reactConfig,
385
+ vue: vueConfig
386
+ });
387
+ export { BIOME_SCHEMA_URL, allPresets, indexConfig, nextConfig, nuxtConfig, reactConfig, vueConfig };