@quentinhsu/biome-config 0.3.3 → 0.4.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 +358 -0
  2. package/dist/build.mjs +108 -360
  3. package/dist/index.jsonc +56 -56
  4. package/dist/index.mjs +1 -358
  5. package/dist/next.jsonc +60 -60
  6. package/dist/nuxt.jsonc +91 -91
  7. package/dist/react.jsonc +58 -58
  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 +11 -8
  13. package/dist/types/src/generated/biome/no-comment-text-options.d.ts +761 -0
  14. package/dist/types/src/generated/biome/no-global-object-calls-options.d.ts +97 -97
  15. package/dist/types/src/generated/biome/no-sync-scripts-configuration.d.ts +185 -0
  16. package/dist/types/src/generated/biome/{use-semantic-elements-configuration.d.ts → no-useless-constructor-configuration.d.ts} +31 -49
  17. package/dist/types/src/generated/biome/nursery.d.ts +393 -594
  18. package/dist/types/src/generated/biome/{no-assign-in-expressions-configuration.d.ts → pattern-options.d.ts} +252 -179
  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 +35 -17
  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-non-null-assertion-options.d.ts → use-unique-variable-names-options.d.ts} +141 -119
  27. package/dist/types/src/index.d.ts +2 -2
  28. package/dist/vue.jsonc +60 -60
  29. package/package.json +38 -34
  30. package/dist/types/src/generated/biome/no-empty-source-configuration.d.ts +0 -241
  31. package/dist/types/src/generated/biome/no-misrefactored-shorthand-assign-options.d.ts +0 -1116
  32. package/dist/types/src/generated/biome/rule-with-no-document-import-in-page-options.d.ts +0 -1148
  33. package/dist/types/src/generated/biome/rule-with-no-implicit-coercions-options.d.ts +0 -1440
  34. package/dist/types/src/generated/biome/use-consistent-arrow-return-options.d.ts +0 -1341
package/dist/131.mjs ADDED
@@ -0,0 +1,358 @@
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
+ files: {
293
+ includes: [
294
+ '!**/.nuxt',
295
+ '!**/.nitro',
296
+ '!**/.output'
297
+ ]
298
+ },
299
+ javascript: {
300
+ globals: [
301
+ 'defineNuxtConfig',
302
+ 'defineAppConfig',
303
+ 'defineNuxtPlugin',
304
+ 'defineNuxtRouteMiddleware',
305
+ 'defineNuxtServerPlugin',
306
+ 'defineNitroPlugin',
307
+ 'defineEventHandler',
308
+ 'defineLazyEventHandler',
309
+ 'definePayloadPlugin',
310
+ 'defineRouteRules',
311
+ 'definePageMeta',
312
+ 'useRuntimeConfig',
313
+ 'useNuxtApp',
314
+ 'useAsyncData',
315
+ 'useLazyAsyncData',
316
+ 'useFetch',
317
+ 'useLazyFetch',
318
+ 'useState',
319
+ 'useCookie',
320
+ 'useHead',
321
+ 'useSeoMeta',
322
+ 'useError',
323
+ 'clearError',
324
+ 'showError',
325
+ 'navigateTo',
326
+ 'abortNavigation',
327
+ 'refreshNuxtData',
328
+ 'onNuxtReady',
329
+ 'useRouter',
330
+ 'useRoute',
331
+ 'useRequestEvent',
332
+ 'useRequestHeaders'
333
+ ]
334
+ },
335
+ overrides: [
336
+ {
337
+ includes: [
338
+ '**/*.ts'
339
+ ],
340
+ linter: {
341
+ rules: {
342
+ correctness: {
343
+ noUndeclaredVariables: 'error'
344
+ }
345
+ }
346
+ }
347
+ }
348
+ ]
349
+ };
350
+ const nuxtConfig = mergeConfigs(vueConfig, nuxtOverlay);
351
+ const allPresets = Object.freeze({
352
+ index: indexConfig,
353
+ next: nextConfig,
354
+ nuxt: nuxtConfig,
355
+ react: reactConfig,
356
+ vue: vueConfig
357
+ });
358
+ export { BIOME_SCHEMA_URL, allPresets, indexConfig, nextConfig, nuxtConfig, reactConfig, vueConfig };