@quentinhsu/biome-config 0.3.1 → 0.3.3

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 (33) 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 +11 -0
  13. package/dist/types/src/generated/biome/no-assign-in-expressions-configuration.d.ts +1002 -0
  14. package/dist/types/src/generated/biome/no-empty-source-configuration.d.ts +241 -0
  15. package/dist/types/src/generated/biome/no-global-object-calls-options.d.ts +320 -0
  16. package/dist/types/src/generated/biome/no-misrefactored-shorthand-assign-options.d.ts +1116 -0
  17. package/dist/types/src/generated/biome/no-non-null-assertion-options.d.ts +291 -0
  18. package/dist/types/src/generated/biome/nursery.d.ts +1023 -0
  19. package/dist/types/src/generated/biome/rule-with-no-document-import-in-page-options.d.ts +1148 -0
  20. package/dist/types/src/generated/biome/rule-with-no-implicit-coercions-options.d.ts +1440 -0
  21. package/dist/types/src/generated/biome/schema.d.ts +291 -0
  22. package/dist/types/src/generated/biome/use-consistent-arrow-return-options.d.ts +1341 -0
  23. package/dist/types/src/generated/biome/use-semantic-elements-configuration.d.ts +163 -0
  24. package/dist/types/src/index.d.ts +15 -0
  25. package/dist/types/src/presets/next.d.ts +1 -0
  26. package/dist/types/src/presets/nuxt.d.ts +1 -0
  27. package/dist/types/src/presets/react.d.ts +1 -0
  28. package/dist/types/src/presets/vue.d.ts +1 -0
  29. package/dist/types/src/source/index.d.ts +2 -0
  30. package/dist/types/src/types.d.ts +1 -0
  31. package/dist/types/src/utils/merge.d.ts +2 -0
  32. package/dist/vue.jsonc +177 -0
  33. package/package.json +12 -11
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.2/schema.json';
45
+ const indexConfig = {
46
+ $schema: BIOME_SCHEMA_URL,
47
+ root: true,
48
+ vcs: {
49
+ enabled: true,
50
+ clientKind: 'git',
51
+ useIgnoreFile: true,
52
+ defaultBranch: 'main'
53
+ },
54
+ files: {
55
+ ignoreUnknown: true,
56
+ includes: [
57
+ '**',
58
+ '!**/build',
59
+ '!**/dist',
60
+ '!**/.next'
61
+ ]
62
+ },
63
+ formatter: {
64
+ enabled: true,
65
+ indentStyle: 'space',
66
+ lineWidth: 140,
67
+ formatWithErrors: true
68
+ },
69
+ assist: {
70
+ actions: {
71
+ source: {
72
+ organizeImports: {
73
+ level: 'on',
74
+ options: {
75
+ groups: [
76
+ [
77
+ ':NODE:',
78
+ ':BUN:',
79
+ ':PACKAGE_WITH_PROTOCOL:',
80
+ ':PACKAGE:'
81
+ ],
82
+ ':BLANK_LINE:',
83
+ ':ALIAS:',
84
+ ':BLANK_LINE:',
85
+ ':PATH:'
86
+ ]
87
+ }
88
+ },
89
+ useSortedKeys: 'on',
90
+ useSortedAttributes: {
91
+ level: 'on',
92
+ options: {
93
+ sortOrder: 'natural'
94
+ }
95
+ }
96
+ }
97
+ }
98
+ },
99
+ linter: {
100
+ enabled: true,
101
+ rules: {
102
+ recommended: true,
103
+ complexity: {
104
+ noUselessStringConcat: 'error',
105
+ noUselessUndefinedInitialization: 'error',
106
+ noVoid: 'error',
107
+ useDateNow: 'error'
108
+ },
109
+ correctness: {
110
+ noConstantMathMinMaxClamp: 'error',
111
+ noUndeclaredVariables: 'error',
112
+ noUnusedImports: 'error',
113
+ noUnusedFunctionParameters: 'error',
114
+ noUnusedPrivateClassMembers: 'error',
115
+ useExhaustiveDependencies: {
116
+ level: 'error',
117
+ options: {
118
+ reportUnnecessaryDependencies: false
119
+ }
120
+ },
121
+ noUnusedVariables: 'error'
122
+ },
123
+ style: {
124
+ noParameterProperties: 'error',
125
+ noYodaExpression: 'error',
126
+ useConsistentBuiltinInstantiation: 'error',
127
+ useFragmentSyntax: 'error',
128
+ useImportType: {
129
+ level: 'error',
130
+ fix: 'safe',
131
+ options: {
132
+ style: 'separatedType'
133
+ }
134
+ },
135
+ useSelfClosingElements: {
136
+ level: 'error',
137
+ fix: 'safe',
138
+ options: {}
139
+ },
140
+ useShorthandAssign: 'error',
141
+ useArrayLiterals: 'error'
142
+ },
143
+ nursery: {
144
+ useSortedClasses: {
145
+ level: 'error',
146
+ fix: 'safe',
147
+ options: {
148
+ functions: [
149
+ 'clsx',
150
+ 'cn'
151
+ ]
152
+ }
153
+ }
154
+ },
155
+ suspicious: {
156
+ useAwait: 'error',
157
+ noEvolvingTypes: 'error'
158
+ }
159
+ }
160
+ },
161
+ javascript: {
162
+ formatter: {
163
+ quoteStyle: 'single',
164
+ jsxQuoteStyle: 'single',
165
+ arrowParentheses: 'asNeeded',
166
+ trailingCommas: 'all'
167
+ }
168
+ },
169
+ overrides: [
170
+ {
171
+ includes: [
172
+ '**/*.jsx',
173
+ '**/*.tsx'
174
+ ],
175
+ linter: {
176
+ rules: {
177
+ style: {
178
+ noParameterAssign: 'error'
179
+ }
180
+ }
181
+ }
182
+ },
183
+ {
184
+ includes: [
185
+ '**/*.ts',
186
+ '**/*.tsx'
187
+ ],
188
+ linter: {
189
+ rules: {
190
+ correctness: {
191
+ noUnusedVariables: 'off'
192
+ }
193
+ }
194
+ }
195
+ }
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
+ react: reactConfig,
354
+ next: nextConfig,
355
+ vue: vueConfig,
356
+ nuxt: nuxtConfig
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.2/schema.json",
3
+ "root": true,
4
+ "vcs": {
5
+ "enabled": true,
6
+ "clientKind": "git",
7
+ "useIgnoreFile": true,
8
+ "defaultBranch": "main"
9
+ },
10
+ "files": {
11
+ "ignoreUnknown": true,
12
+ "includes": [
13
+ "**",
14
+ "!**/build",
15
+ "!**/dist",
16
+ "!**/.next",
17
+ "!**/.storybook",
18
+ "!**/.vercel",
19
+ "!**/out"
20
+ ]
21
+ },
22
+ "formatter": {
23
+ "enabled": true,
24
+ "indentStyle": "space",
25
+ "lineWidth": 140,
26
+ "formatWithErrors": true
27
+ },
28
+ "assist": {
29
+ "actions": {
30
+ "source": {
31
+ "organizeImports": {
32
+ "level": "on",
33
+ "options": {
34
+ "groups": [
35
+ [
36
+ ":NODE:",
37
+ ":BUN:",
38
+ ":PACKAGE_WITH_PROTOCOL:",
39
+ ":PACKAGE:"
40
+ ],
41
+ ":BLANK_LINE:",
42
+ ":ALIAS:",
43
+ ":BLANK_LINE:",
44
+ ":PATH:"
45
+ ]
46
+ }
47
+ },
48
+ "useSortedKeys": "on",
49
+ "useSortedAttributes": {
50
+ "level": "on",
51
+ "options": {
52
+ "sortOrder": "natural"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ },
58
+ "linter": {
59
+ "enabled": true,
60
+ "rules": {
61
+ "recommended": true,
62
+ "complexity": {
63
+ "noUselessStringConcat": "error",
64
+ "noUselessUndefinedInitialization": "error",
65
+ "noVoid": "error",
66
+ "useDateNow": "error"
67
+ },
68
+ "correctness": {
69
+ "noConstantMathMinMaxClamp": "error",
70
+ "noUndeclaredVariables": "error",
71
+ "noUnusedImports": "error",
72
+ "noUnusedFunctionParameters": "error",
73
+ "noUnusedPrivateClassMembers": "error",
74
+ "useExhaustiveDependencies": {
75
+ "level": "error",
76
+ "options": {
77
+ "reportUnnecessaryDependencies": true
78
+ }
79
+ },
80
+ "noUnusedVariables": "error"
81
+ },
82
+ "style": {
83
+ "noParameterProperties": "error",
84
+ "noYodaExpression": "error",
85
+ "useConsistentBuiltinInstantiation": "error",
86
+ "useFragmentSyntax": "error",
87
+ "useImportType": {
88
+ "level": "error",
89
+ "fix": "safe",
90
+ "options": {
91
+ "style": "separatedType"
92
+ }
93
+ },
94
+ "useSelfClosingElements": {
95
+ "level": "error",
96
+ "fix": "safe",
97
+ "options": {}
98
+ },
99
+ "useShorthandAssign": "error",
100
+ "useArrayLiterals": "error"
101
+ },
102
+ "nursery": {
103
+ "useSortedClasses": {
104
+ "level": "error",
105
+ "fix": "safe",
106
+ "options": {
107
+ "functions": [
108
+ "clsx",
109
+ "cn"
110
+ ]
111
+ }
112
+ }
113
+ },
114
+ "suspicious": {
115
+ "useAwait": "error",
116
+ "noEvolvingTypes": "error"
117
+ }
118
+ }
119
+ },
120
+ "javascript": {
121
+ "formatter": {
122
+ "quoteStyle": "single",
123
+ "jsxQuoteStyle": "single",
124
+ "arrowParentheses": "asNeeded",
125
+ "trailingCommas": "all"
126
+ },
127
+ "jsxRuntime": "transparent"
128
+ },
129
+ "overrides": [
130
+ {
131
+ "includes": [
132
+ "**/*.jsx",
133
+ "**/*.tsx"
134
+ ],
135
+ "linter": {
136
+ "rules": {
137
+ "style": {
138
+ "noParameterAssign": "error"
139
+ }
140
+ }
141
+ }
142
+ },
143
+ {
144
+ "includes": [
145
+ "**/*.ts",
146
+ "**/*.tsx"
147
+ ],
148
+ "linter": {
149
+ "rules": {
150
+ "correctness": {
151
+ "noUnusedVariables": "off"
152
+ }
153
+ }
154
+ }
155
+ },
156
+ {
157
+ "includes": [
158
+ "**/__tests__/**",
159
+ "**/*.{test,spec}.{ts,tsx,js,jsx}"
160
+ ],
161
+ "linter": {
162
+ "rules": {
163
+ "correctness": {
164
+ "noUnusedVariables": "off"
165
+ }
166
+ }
167
+ }
168
+ }
169
+ ]
170
+ }