@quentinhsu/biome-config 0.3.2 → 0.3.5

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/build.mjs +388 -0
  2. package/dist/index.jsonc +153 -0
  3. package/dist/index.mjs +358 -0
  4. package/dist/next.jsonc +170 -0
  5. package/dist/nuxt.jsonc +225 -0
  6. package/dist/react.jsonc +168 -0
  7. package/dist/types/scripts/build-presets.d.ts +1 -0
  8. package/dist/types/scripts/generate-biome-types.d.ts +1 -0
  9. package/dist/types/scripts/utils/biome-version.d.ts +12 -0
  10. package/dist/types/src/build.d.ts +1 -0
  11. package/dist/types/src/constants/biome.d.ts +1 -0
  12. package/dist/types/src/generated/biome/index.d.ts +12 -0
  13. package/dist/types/src/generated/biome/linter-configuration.d.ts +181 -0
  14. package/dist/types/src/generated/biome/no-global-object-calls-options.d.ts +321 -0
  15. package/dist/types/src/generated/biome/no-label-var-options.d.ts +1076 -0
  16. package/dist/types/src/generated/biome/no-magic-numbers-options.d.ts +291 -0
  17. package/dist/types/src/generated/biome/rule-with-no-confusing-labels-options.d.ts +1236 -0
  18. package/dist/types/src/generated/biome/rule-with-no-excessive-nested-test-suites-options.d.ts +1440 -0
  19. package/dist/types/src/generated/biome/rule-with-no-unused-expressions-options.d.ts +1337 -0
  20. package/dist/types/src/generated/biome/schema.d.ts +291 -0
  21. package/dist/types/src/generated/biome/use-consistent-object-definitions-configuration.d.ts +1304 -0
  22. package/dist/types/src/generated/biome/use-focusable-interactive-configuration.d.ts +163 -0
  23. package/dist/types/src/generated/biome/use-qwik-classlist-configuration.d.ts +241 -0
  24. package/dist/types/src/generated/biome/use-shorthand-assign-configuration.d.ts +571 -0
  25. package/dist/types/src/index.d.ts +15 -0
  26. package/dist/types/src/presets/next.d.ts +1 -0
  27. package/dist/types/src/presets/nuxt.d.ts +1 -0
  28. package/dist/types/src/presets/react.d.ts +1 -0
  29. package/dist/types/src/presets/vue.d.ts +1 -0
  30. package/dist/types/src/source/index.d.ts +2 -0
  31. package/dist/types/src/types.d.ts +1 -0
  32. package/dist/types/src/utils/merge.d.ts +2 -0
  33. package/dist/vue.jsonc +177 -0
  34. package/package.json +29 -28
package/dist/index.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.5/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 };
@@ -0,0 +1,170 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.5/schema.json",
3
+ "assist": {
4
+ "actions": {
5
+ "source": {
6
+ "organizeImports": {
7
+ "level": "on",
8
+ "options": {
9
+ "groups": [
10
+ [
11
+ ":NODE:",
12
+ ":BUN:",
13
+ ":PACKAGE_WITH_PROTOCOL:",
14
+ ":PACKAGE:"
15
+ ],
16
+ ":BLANK_LINE:",
17
+ ":ALIAS:",
18
+ ":BLANK_LINE:",
19
+ ":PATH:"
20
+ ]
21
+ }
22
+ },
23
+ "useSortedAttributes": {
24
+ "level": "on",
25
+ "options": {
26
+ "sortOrder": "natural"
27
+ }
28
+ },
29
+ "useSortedKeys": "on"
30
+ }
31
+ }
32
+ },
33
+ "files": {
34
+ "ignoreUnknown": true,
35
+ "includes": [
36
+ "**",
37
+ "!**/build",
38
+ "!**/dist",
39
+ "!**/.next",
40
+ "!**/.storybook",
41
+ "!**/.vercel",
42
+ "!**/out"
43
+ ]
44
+ },
45
+ "formatter": {
46
+ "enabled": true,
47
+ "formatWithErrors": true,
48
+ "indentStyle": "space",
49
+ "lineWidth": 140
50
+ },
51
+ "javascript": {
52
+ "formatter": {
53
+ "arrowParentheses": "asNeeded",
54
+ "jsxQuoteStyle": "single",
55
+ "quoteStyle": "single",
56
+ "trailingCommas": "all"
57
+ },
58
+ "jsxRuntime": "transparent"
59
+ },
60
+ "linter": {
61
+ "enabled": true,
62
+ "rules": {
63
+ "complexity": {
64
+ "noUselessStringConcat": "error",
65
+ "noUselessUndefinedInitialization": "error",
66
+ "noVoid": "error",
67
+ "useDateNow": "error"
68
+ },
69
+ "correctness": {
70
+ "noConstantMathMinMaxClamp": "error",
71
+ "noUndeclaredVariables": "error",
72
+ "noUnusedFunctionParameters": "error",
73
+ "noUnusedImports": "error",
74
+ "noUnusedPrivateClassMembers": "error",
75
+ "noUnusedVariables": "error",
76
+ "useExhaustiveDependencies": {
77
+ "level": "error",
78
+ "options": {
79
+ "reportUnnecessaryDependencies": true
80
+ }
81
+ }
82
+ },
83
+ "nursery": {
84
+ "useSortedClasses": {
85
+ "fix": "safe",
86
+ "level": "error",
87
+ "options": {
88
+ "functions": [
89
+ "clsx",
90
+ "cn"
91
+ ]
92
+ }
93
+ }
94
+ },
95
+ "recommended": true,
96
+ "style": {
97
+ "noParameterProperties": "error",
98
+ "noYodaExpression": "error",
99
+ "useArrayLiterals": "error",
100
+ "useConsistentBuiltinInstantiation": "error",
101
+ "useFragmentSyntax": "error",
102
+ "useImportType": {
103
+ "fix": "safe",
104
+ "level": "error",
105
+ "options": {
106
+ "style": "separatedType"
107
+ }
108
+ },
109
+ "useSelfClosingElements": {
110
+ "fix": "safe",
111
+ "level": "error",
112
+ "options": {}
113
+ },
114
+ "useShorthandAssign": "error"
115
+ },
116
+ "suspicious": {
117
+ "noEvolvingTypes": "error",
118
+ "useAwait": "error"
119
+ }
120
+ }
121
+ },
122
+ "overrides": [
123
+ {
124
+ "includes": [
125
+ "**/*.jsx",
126
+ "**/*.tsx"
127
+ ],
128
+ "linter": {
129
+ "rules": {
130
+ "style": {
131
+ "noParameterAssign": "error"
132
+ }
133
+ }
134
+ }
135
+ },
136
+ {
137
+ "includes": [
138
+ "**/*.ts",
139
+ "**/*.tsx"
140
+ ],
141
+ "linter": {
142
+ "rules": {
143
+ "correctness": {
144
+ "noUnusedVariables": "off"
145
+ }
146
+ }
147
+ }
148
+ },
149
+ {
150
+ "includes": [
151
+ "**/__tests__/**",
152
+ "**/*.{test,spec}.{ts,tsx,js,jsx}"
153
+ ],
154
+ "linter": {
155
+ "rules": {
156
+ "correctness": {
157
+ "noUnusedVariables": "off"
158
+ }
159
+ }
160
+ }
161
+ }
162
+ ],
163
+ "root": true,
164
+ "vcs": {
165
+ "clientKind": "git",
166
+ "defaultBranch": "main",
167
+ "enabled": true,
168
+ "useIgnoreFile": true
169
+ }
170
+ }