@biomejs/backend-jsonrpc 1.3.3 → 1.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.
package/src/workspace.ts DELETED
@@ -1,1860 +0,0 @@
1
- // Generated file, do not edit by hand, see `xtask/codegen`
2
- import type { Transport } from "./transport";
3
- export interface SupportsFeatureParams {
4
- feature: FeatureName[];
5
- path: RomePath;
6
- }
7
- export type FeatureName = "Format" | "Lint" | "OrganizeImports";
8
- export interface RomePath {
9
- path: string;
10
- }
11
- export interface SupportsFeatureResult {
12
- reason?: SupportKind;
13
- }
14
- export type SupportKind =
15
- | "Supported"
16
- | "Ignored"
17
- | "FeatureNotEnabled"
18
- | "FileNotSupported";
19
- export interface UpdateSettingsParams {
20
- configuration: Configuration;
21
- }
22
- /**
23
- * The configuration that is contained inside the file `biome.json`
24
- */
25
- export interface Configuration {
26
- /**
27
- * A field for the [JSON schema](https://json-schema.org/) specification
28
- */
29
- $schema?: string;
30
- /**
31
- * A list of paths to other JSON files, used to extends the current configuration.
32
- */
33
- extends?: StringSet;
34
- /**
35
- * The configuration of the filesystem
36
- */
37
- files?: FilesConfiguration;
38
- /**
39
- * The configuration of the formatter
40
- */
41
- formatter?: FormatterConfiguration;
42
- /**
43
- * Specific configuration for the JavaScript language
44
- */
45
- javascript?: JavascriptConfiguration;
46
- /**
47
- * Specific configuration for the Json language
48
- */
49
- json?: JsonConfiguration;
50
- /**
51
- * The configuration for the linter
52
- */
53
- linter?: LinterConfiguration;
54
- /**
55
- * The configuration of the import sorting
56
- */
57
- organizeImports?: OrganizeImports;
58
- /**
59
- * A list of granular patterns that should be applied only to a sub set of files
60
- */
61
- overrides?: Overrides;
62
- /**
63
- * The configuration of the VCS integration
64
- */
65
- vcs?: VcsConfiguration;
66
- }
67
- export type StringSet = string[];
68
- /**
69
- * The configuration of the filesystem
70
- */
71
- export interface FilesConfiguration {
72
- /**
73
- * A list of Unix shell style patterns. Biome will ignore files/folders that will match these patterns.
74
- */
75
- ignore?: StringSet;
76
- /**
77
- * Tells Biome to not emit diagnostics when handling files that doesn't know
78
- */
79
- ignoreUnknown?: boolean;
80
- /**
81
- * A list of Unix shell style patterns. Biome will handle only those files/folders that will match these patterns.
82
- */
83
- include?: StringSet;
84
- /**
85
- * The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reasons. Defaults to 1 MiB
86
- */
87
- maxSize?: number;
88
- }
89
- /**
90
- * Generic options applied to all files
91
- */
92
- export interface FormatterConfiguration {
93
- enabled?: boolean;
94
- /**
95
- * Stores whether formatting should be allowed to proceed if a given file has syntax errors
96
- */
97
- formatWithErrors?: boolean;
98
- /**
99
- * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.
100
- */
101
- ignore?: StringSet;
102
- /**
103
- * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.
104
- */
105
- include?: StringSet;
106
- /**
107
- * The size of the indentation, 2 by default (deprecated, use `indent-width`)
108
- */
109
- indentSize?: number;
110
- /**
111
- * The indent style.
112
- */
113
- indentStyle?: PlainIndentStyle;
114
- /**
115
- * The size of the indentation, 2 by default
116
- */
117
- indentWidth?: number;
118
- /**
119
- * What's the max width of a line. Defaults to 80.
120
- */
121
- lineWidth?: LineWidth;
122
- }
123
- /**
124
- * A set of options applied to the JavaScript files
125
- */
126
- export interface JavascriptConfiguration {
127
- /**
128
- * Formatting options
129
- */
130
- formatter?: JavascriptFormatter;
131
- /**
132
- * A list of global bindings that should be ignored by the analyzers
133
-
134
- If defined here, they should not emit diagnostics.
135
- */
136
- globals?: StringSet;
137
- organize_imports?: JavascriptOrganizeImports;
138
- /**
139
- * Parsing options
140
- */
141
- parser?: JavascriptParser;
142
- }
143
- /**
144
- * Options applied to JSON files
145
- */
146
- export interface JsonConfiguration {
147
- /**
148
- * Formatting options
149
- */
150
- formatter?: JsonFormatter;
151
- /**
152
- * Parsing options
153
- */
154
- parser?: JsonParser;
155
- }
156
- export interface LinterConfiguration {
157
- /**
158
- * if `false`, it disables the feature and the linter won't be executed. `true` by default
159
- */
160
- enabled?: boolean;
161
- /**
162
- * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.
163
- */
164
- ignore?: StringSet;
165
- /**
166
- * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.
167
- */
168
- include?: StringSet;
169
- /**
170
- * List of rules
171
- */
172
- rules?: Rules;
173
- }
174
- export interface OrganizeImports {
175
- /**
176
- * Enables the organization of imports
177
- */
178
- enabled?: boolean;
179
- /**
180
- * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.
181
- */
182
- ignore?: StringSet;
183
- /**
184
- * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.
185
- */
186
- include?: StringSet;
187
- }
188
- export type Overrides = OverridePattern[];
189
- /**
190
- * Set of properties to integrate Biome with a VCS software.
191
- */
192
- export interface VcsConfiguration {
193
- /**
194
- * The kind of client.
195
- */
196
- clientKind?: VcsClientKind;
197
- /**
198
- * Whether Biome should integrate itself with the VCS client
199
- */
200
- enabled?: boolean;
201
- /**
202
- * The folder where Biome should check for VCS files. By default, Biome will use the same folder where `biome.json` was found.
203
-
204
- If Biome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Biome won't use the VCS integration, and a diagnostic will be emitted
205
- */
206
- root?: string;
207
- /**
208
- * Whether Biome should use the VCS ignore file. When [true], Biome will ignore the files specified in the ignore file.
209
- */
210
- useIgnoreFile?: boolean;
211
- }
212
- export type PlainIndentStyle = "tab" | "space";
213
- /**
214
- * Validated value for the `line_width` formatter options
215
-
216
- The allowed range of values is 1..=320
217
- */
218
- export type LineWidth = number;
219
- /**
220
- * Formatting options specific to the JavaScript files
221
- */
222
- export interface JavascriptFormatter {
223
- /**
224
- * Whether to add non-necessary parentheses to arrow functions. Defaults to "always".
225
- */
226
- arrowParentheses?: ArrowParentheses;
227
- /**
228
- * Control the formatter for JavaScript (and its super languages) files.
229
- */
230
- enabled?: boolean;
231
- /**
232
- * The size of the indentation applied to JavaScript (and its super languages) files. Default to 2.
233
- */
234
- indentSize?: number;
235
- /**
236
- * The indent style applied to JavaScript (and its super languages) files.
237
- */
238
- indentStyle?: PlainIndentStyle;
239
- /**
240
- * The size of the indentation applied to JavaScript (and its super languages) files. Default to 2.
241
- */
242
- indentWidth?: number;
243
- /**
244
- * The type of quotes used in JSX. Defaults to double.
245
- */
246
- jsxQuoteStyle?: QuoteStyle;
247
- /**
248
- * What's the max width of a line, applied to JavaScript (and its super languages) files. Defaults to 80.
249
- */
250
- lineWidth?: LineWidth;
251
- /**
252
- * When properties in objects are quoted. Defaults to asNeeded.
253
- */
254
- quoteProperties?: QuoteProperties;
255
- /**
256
- * The type of quotes used in JavaScript code. Defaults to double.
257
- */
258
- quoteStyle?: QuoteStyle;
259
- /**
260
- * Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI.
261
- */
262
- semicolons?: Semicolons;
263
- /**
264
- * Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all".
265
- */
266
- trailingComma?: TrailingComma;
267
- }
268
- export interface JavascriptOrganizeImports {}
269
- /**
270
- * Options that changes how the JavaScript parser behaves
271
- */
272
- export interface JavascriptParser {
273
- /**
274
- * It enables the experimental and unsafe parsing of parameter decorators
275
-
276
- These decorators belong to an old proposal, and they are subject to change.
277
- */
278
- unsafeParameterDecoratorsEnabled?: boolean;
279
- }
280
- export interface JsonFormatter {
281
- /**
282
- * Control the formatter for JSON (and its super languages) files.
283
- */
284
- enabled?: boolean;
285
- /**
286
- * The size of the indentation applied to JSON (and its super languages) files. Default to 2.
287
- */
288
- indentSize?: number;
289
- /**
290
- * The indent style applied to JSON (and its super languages) files.
291
- */
292
- indentStyle?: PlainIndentStyle;
293
- /**
294
- * The size of the indentation applied to JSON (and its super languages) files. Default to 2.
295
- */
296
- indentWidth?: number;
297
- /**
298
- * What's the max width of a line, applied to JSON (and its super languages) files. Defaults to 80.
299
- */
300
- lineWidth?: LineWidth;
301
- }
302
- /**
303
- * Options that changes how the JSON parser behaves
304
- */
305
- export interface JsonParser {
306
- /**
307
- * Allow parsing comments in `.json` files
308
- */
309
- allowComments?: boolean;
310
- /**
311
- * Allow parsing trailing commas in `.json` files
312
- */
313
- allowTrailingCommas?: boolean;
314
- }
315
- export interface Rules {
316
- a11y?: A11y;
317
- /**
318
- * It enables ALL rules. The rules that belong to `nursery` won't be enabled.
319
- */
320
- all?: boolean;
321
- complexity?: Complexity;
322
- correctness?: Correctness;
323
- nursery?: Nursery;
324
- performance?: Performance;
325
- /**
326
- * It enables the lint rules recommended by Biome. `true` by default.
327
- */
328
- recommended?: boolean;
329
- security?: Security;
330
- style?: Style;
331
- suspicious?: Suspicious;
332
- }
333
- export interface OverridePattern {
334
- /**
335
- * Specific configuration for the Json language
336
- */
337
- formatter?: OverrideFormatterConfiguration;
338
- /**
339
- * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.
340
- */
341
- ignore?: StringSet;
342
- /**
343
- * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.
344
- */
345
- include?: StringSet;
346
- /**
347
- * Specific configuration for the JavaScript language
348
- */
349
- javascript?: JavascriptConfiguration;
350
- /**
351
- * Specific configuration for the Json language
352
- */
353
- json?: JsonConfiguration;
354
- /**
355
- * Specific configuration for the Json language
356
- */
357
- linter?: OverrideLinterConfiguration;
358
- /**
359
- * Specific configuration for the Json language
360
- */
361
- organizeImports?: OverrideOrganizeImportsConfiguration;
362
- }
363
- export type VcsClientKind = "git";
364
- export type ArrowParentheses = "always" | "asNeeded";
365
- export type QuoteStyle = "double" | "single";
366
- export type QuoteProperties = "asNeeded" | "preserve";
367
- export type Semicolons = "always" | "asNeeded";
368
- /**
369
- * Print trailing commas wherever possible in multi-line comma-separated syntactic structures.
370
- */
371
- export type TrailingComma = "all" | "es5" | "none";
372
- /**
373
- * A list of rules that belong to this group
374
- */
375
- export interface A11y {
376
- /**
377
- * It enables ALL rules for this group.
378
- */
379
- all?: boolean;
380
- /**
381
- * Enforce that the accessKey attribute is not used on any HTML element.
382
- */
383
- noAccessKey?: RuleConfiguration;
384
- /**
385
- * Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes.
386
- */
387
- noAriaUnsupportedElements?: RuleConfiguration;
388
- /**
389
- * Enforce that autoFocus prop is not used on elements.
390
- */
391
- noAutofocus?: RuleConfiguration;
392
- /**
393
- * Disallow target="_blank" attribute without rel="noreferrer"
394
- */
395
- noBlankTarget?: RuleConfiguration;
396
- /**
397
- * Enforces that no distracting elements are used.
398
- */
399
- noDistractingElements?: RuleConfiguration;
400
- /**
401
- * The scope prop should be used only on <th> elements.
402
- */
403
- noHeaderScope?: RuleConfiguration;
404
- /**
405
- * Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements.
406
- */
407
- noNoninteractiveElementToInteractiveRole?: RuleConfiguration;
408
- /**
409
- * Enforce that tabIndex is not assigned to non-interactive HTML elements.
410
- */
411
- noNoninteractiveTabindex?: RuleConfiguration;
412
- /**
413
- * Prevent the usage of positive integers on tabIndex property
414
- */
415
- noPositiveTabindex?: RuleConfiguration;
416
- /**
417
- * Enforce img alt prop does not contain the word "image", "picture", or "photo".
418
- */
419
- noRedundantAlt?: RuleConfiguration;
420
- /**
421
- * Enforce explicit role property is not the same as implicit/default role property on an element.
422
- */
423
- noRedundantRoles?: RuleConfiguration;
424
- /**
425
- * Enforces the usage of the title element for the svg element.
426
- */
427
- noSvgWithoutTitle?: RuleConfiguration;
428
- /**
429
- * It enables the recommended rules for this group
430
- */
431
- recommended?: boolean;
432
- /**
433
- * Enforce that all elements that require alternative text have meaningful information to relay back to the end user.
434
- */
435
- useAltText?: RuleConfiguration;
436
- /**
437
- * Enforce that anchors have content and that the content is accessible to screen readers.
438
- */
439
- useAnchorContent?: RuleConfiguration;
440
- /**
441
- * Enforce that elements with ARIA roles must have all required ARIA attributes for that role.
442
- */
443
- useAriaPropsForRole?: RuleConfiguration;
444
- /**
445
- * Enforces the usage of the attribute type for the element button
446
- */
447
- useButtonType?: RuleConfiguration;
448
- /**
449
- * Enforce that heading elements (h1, h2, etc.) have content and that the content is accessible to screen readers. Accessible means that it is not hidden using the aria-hidden prop.
450
- */
451
- useHeadingContent?: RuleConfiguration;
452
- /**
453
- * Enforce that html element has lang attribute.
454
- */
455
- useHtmlLang?: RuleConfiguration;
456
- /**
457
- * Enforces the usage of the attribute title for the element iframe.
458
- */
459
- useIframeTitle?: RuleConfiguration;
460
- /**
461
- * Enforce onClick is accompanied by at least one of the following: onKeyUp, onKeyDown, onKeyPress.
462
- */
463
- useKeyWithClickEvents?: RuleConfiguration;
464
- /**
465
- * Enforce onMouseOver / onMouseOut are accompanied by onFocus / onBlur.
466
- */
467
- useKeyWithMouseEvents?: RuleConfiguration;
468
- /**
469
- * Enforces that audio and video elements must have a track for captions.
470
- */
471
- useMediaCaption?: RuleConfiguration;
472
- /**
473
- * Enforce that all anchors are valid, and they are navigable elements.
474
- */
475
- useValidAnchor?: RuleConfiguration;
476
- /**
477
- * Ensures that ARIA properties aria-* are all valid.
478
- */
479
- useValidAriaProps?: RuleConfiguration;
480
- /**
481
- * Enforce that ARIA state and property values are valid.
482
- */
483
- useValidAriaValues?: RuleConfiguration;
484
- /**
485
- * Ensure that the attribute passed to the lang attribute is a correct ISO language and/or country.
486
- */
487
- useValidLang?: RuleConfiguration;
488
- }
489
- /**
490
- * A list of rules that belong to this group
491
- */
492
- export interface Complexity {
493
- /**
494
- * It enables ALL rules for this group.
495
- */
496
- all?: boolean;
497
- /**
498
- * Disallow primitive type aliases and misleading types.
499
- */
500
- noBannedTypes?: RuleConfiguration;
501
- /**
502
- * Disallow functions that exceed a given Cognitive Complexity score.
503
- */
504
- noExcessiveCognitiveComplexity?: RuleConfiguration;
505
- /**
506
- * Disallow unnecessary boolean casts
507
- */
508
- noExtraBooleanCast?: RuleConfiguration;
509
- /**
510
- * Prefer for...of statement instead of Array.forEach.
511
- */
512
- noForEach?: RuleConfiguration;
513
- /**
514
- * Disallow unclear usage of consecutive space characters in regular expression literals
515
- */
516
- noMultipleSpacesInRegularExpressionLiterals?: RuleConfiguration;
517
- /**
518
- * This rule reports when a class has no non-static members, such as for a class used exclusively as a static namespace.
519
- */
520
- noStaticOnlyClass?: RuleConfiguration;
521
- /**
522
- * Disallow unnecessary catch clauses.
523
- */
524
- noUselessCatch?: RuleConfiguration;
525
- /**
526
- * Disallow unnecessary constructors.
527
- */
528
- noUselessConstructor?: RuleConfiguration;
529
- /**
530
- * Disallow empty exports that don't change anything in a module file.
531
- */
532
- noUselessEmptyExport?: RuleConfiguration;
533
- /**
534
- * Disallow unnecessary fragments
535
- */
536
- noUselessFragments?: RuleConfiguration;
537
- /**
538
- * Disallow unnecessary labels.
539
- */
540
- noUselessLabel?: RuleConfiguration;
541
- /**
542
- * Disallow renaming import, export, and destructured assignments to the same name.
543
- */
544
- noUselessRename?: RuleConfiguration;
545
- /**
546
- * Disallow useless case in switch statements.
547
- */
548
- noUselessSwitchCase?: RuleConfiguration;
549
- /**
550
- * Disallow useless this aliasing.
551
- */
552
- noUselessThisAlias?: RuleConfiguration;
553
- /**
554
- * Disallow using any or unknown as type constraint.
555
- */
556
- noUselessTypeConstraint?: RuleConfiguration;
557
- /**
558
- * Disallow the use of void operators, which is not a familiar operator.
559
- */
560
- noVoid?: RuleConfiguration;
561
- /**
562
- * Disallow with statements in non-strict contexts.
563
- */
564
- noWith?: RuleConfiguration;
565
- /**
566
- * It enables the recommended rules for this group
567
- */
568
- recommended?: boolean;
569
- /**
570
- * Promotes the use of .flatMap() when map().flat() are used together.
571
- */
572
- useFlatMap?: RuleConfiguration;
573
- /**
574
- * Enforce the usage of a literal access to properties over computed property access.
575
- */
576
- useLiteralKeys?: RuleConfiguration;
577
- /**
578
- * Enforce using concise optional chain instead of chained logical expressions.
579
- */
580
- useOptionalChain?: RuleConfiguration;
581
- /**
582
- * Disallow number literal object member names which are not base10 or uses underscore as separator
583
- */
584
- useSimpleNumberKeys?: RuleConfiguration;
585
- /**
586
- * Discard redundant terms from logical expressions.
587
- */
588
- useSimplifiedLogicExpression?: RuleConfiguration;
589
- }
590
- /**
591
- * A list of rules that belong to this group
592
- */
593
- export interface Correctness {
594
- /**
595
- * It enables ALL rules for this group.
596
- */
597
- all?: boolean;
598
- /**
599
- * Prevent passing of children as props.
600
- */
601
- noChildrenProp?: RuleConfiguration;
602
- /**
603
- * Prevents from having const variables being re-assigned.
604
- */
605
- noConstAssign?: RuleConfiguration;
606
- /**
607
- * Disallow constant expressions in conditions
608
- */
609
- noConstantCondition?: RuleConfiguration;
610
- /**
611
- * Disallow returning a value from a constructor.
612
- */
613
- noConstructorReturn?: RuleConfiguration;
614
- /**
615
- * Disallows empty destructuring patterns.
616
- */
617
- noEmptyPattern?: RuleConfiguration;
618
- /**
619
- * Disallow calling global object properties as functions
620
- */
621
- noGlobalObjectCalls?: RuleConfiguration;
622
- /**
623
- * Disallow function and var declarations that are accessible outside their block.
624
- */
625
- noInnerDeclarations?: RuleConfiguration;
626
- /**
627
- * Prevents the incorrect use of super() inside classes. It also checks whether a call super() is missing from classes that extends other constructors.
628
- */
629
- noInvalidConstructorSuper?: RuleConfiguration;
630
- /**
631
- * Disallow new operators with the Symbol object.
632
- */
633
- noNewSymbol?: RuleConfiguration;
634
- /**
635
- * Disallow \8 and \9 escape sequences in string literals.
636
- */
637
- noNonoctalDecimalEscape?: RuleConfiguration;
638
- /**
639
- * Disallow literal numbers that lose precision
640
- */
641
- noPrecisionLoss?: RuleConfiguration;
642
- /**
643
- * Prevent the usage of the return value of React.render.
644
- */
645
- noRenderReturnValue?: RuleConfiguration;
646
- /**
647
- * Disallow assignments where both sides are exactly the same.
648
- */
649
- noSelfAssign?: RuleConfiguration;
650
- /**
651
- * Disallow returning a value from a setter
652
- */
653
- noSetterReturn?: RuleConfiguration;
654
- /**
655
- * Disallow comparison of expressions modifying the string case with non-compliant value.
656
- */
657
- noStringCaseMismatch?: RuleConfiguration;
658
- /**
659
- * Disallow lexical declarations in switch clauses.
660
- */
661
- noSwitchDeclarations?: RuleConfiguration;
662
- /**
663
- * Prevents the usage of variables that haven't been declared inside the document.
664
- */
665
- noUndeclaredVariables?: RuleConfiguration;
666
- /**
667
- * Avoid using unnecessary continue.
668
- */
669
- noUnnecessaryContinue?: RuleConfiguration;
670
- /**
671
- * Disallow unreachable code
672
- */
673
- noUnreachable?: RuleConfiguration;
674
- /**
675
- * Ensures the super() constructor is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass
676
- */
677
- noUnreachableSuper?: RuleConfiguration;
678
- /**
679
- * Disallow control flow statements in finally blocks.
680
- */
681
- noUnsafeFinally?: RuleConfiguration;
682
- /**
683
- * Disallow the use of optional chaining in contexts where the undefined value is not allowed.
684
- */
685
- noUnsafeOptionalChaining?: RuleConfiguration;
686
- /**
687
- * Disallow unused labels.
688
- */
689
- noUnusedLabels?: RuleConfiguration;
690
- /**
691
- * Disallow unused variables.
692
- */
693
- noUnusedVariables?: RuleConfiguration;
694
- /**
695
- * This rules prevents void elements (AKA self-closing elements) from having children.
696
- */
697
- noVoidElementsWithChildren?: RuleConfiguration;
698
- /**
699
- * Disallow returning a value from a function with the return type 'void'
700
- */
701
- noVoidTypeReturn?: RuleConfiguration;
702
- /**
703
- * It enables the recommended rules for this group
704
- */
705
- recommended?: boolean;
706
- /**
707
- * Enforce all dependencies are correctly specified in a React hook.
708
- */
709
- useExhaustiveDependencies?: RuleConfiguration;
710
- /**
711
- * Enforce that all React hooks are being called from the Top Level component functions.
712
- */
713
- useHookAtTopLevel?: RuleConfiguration;
714
- /**
715
- * Require calls to isNaN() when checking for NaN.
716
- */
717
- useIsNan?: RuleConfiguration;
718
- /**
719
- * Enforce "for" loop update clause moving the counter in the right direction.
720
- */
721
- useValidForDirection?: RuleConfiguration;
722
- /**
723
- * Require generator functions to contain yield.
724
- */
725
- useYield?: RuleConfiguration;
726
- }
727
- /**
728
- * A list of rules that belong to this group
729
- */
730
- export interface Nursery {
731
- /**
732
- * It enables ALL rules for this group.
733
- */
734
- all?: boolean;
735
- /**
736
- * Usually, the definition in the standard library is more precise than what people come up with or the used constant exceeds the maximum precision of the number type.
737
- */
738
- noApproximativeNumericConstant?: RuleConfiguration;
739
- /**
740
- * Disallow two keys with the same name inside a JSON object.
741
- */
742
- noDuplicateJsonKeys?: RuleConfiguration;
743
- /**
744
- * Disallow empty block statements and static blocks.
745
- */
746
- noEmptyBlockStatements?: RuleConfiguration;
747
- /**
748
- * Disallow empty character classes in regular expression literals.
749
- */
750
- noEmptyCharacterClassInRegex?: RuleConfiguration;
751
- /**
752
- * Enforce that non-interactive ARIA roles are not assigned to interactive HTML elements.
753
- */
754
- noInteractiveElementToNoninteractiveRole?: RuleConfiguration;
755
- /**
756
- * Disallow new operators with global non-constructor functions.
757
- */
758
- noInvalidNewBuiltin?: RuleConfiguration;
759
- /**
760
- * Enforce proper usage of new and constructor.
761
- */
762
- noMisleadingInstantiator?: RuleConfiguration;
763
- /**
764
- * Disallow shorthand assign when variable appears on both sides.
765
- */
766
- noMisrefactoredShorthandAssign?: RuleConfiguration;
767
- /**
768
- * Disallow this and super in static contexts.
769
- */
770
- noThisInStatic?: RuleConfiguration;
771
- /**
772
- * Disallow unused imports.
773
- */
774
- noUnusedImports?: RuleConfiguration;
775
- /**
776
- * Disallow else block when the if block breaks early.
777
- */
778
- noUselessElse?: RuleConfiguration;
779
- /**
780
- * Disallow unnecessary nested block statements.
781
- */
782
- noUselessLoneBlockStatements?: RuleConfiguration;
783
- /**
784
- * It enables the recommended rules for this group
785
- */
786
- recommended?: boolean;
787
- /**
788
- * Enforce that tabIndex is assigned to non-interactive HTML elements with aria-activedescendant.
789
- */
790
- useAriaActivedescendantWithTabindex?: RuleConfiguration;
791
- /**
792
- * Use arrow functions over function expressions.
793
- */
794
- useArrowFunction?: RuleConfiguration;
795
- /**
796
- * Enforce the use of as const over literal type and type annotation.
797
- */
798
- useAsConstAssertion?: RuleConfiguration;
799
- /**
800
- * Enforce the use of import type when an import only has specifiers with type qualifier.
801
- */
802
- useGroupedTypeImport?: RuleConfiguration;
803
- /**
804
- * Disallows package private imports.
805
- */
806
- useImportRestrictions?: RuleConfiguration;
807
- /**
808
- * Require assignment operator shorthand where possible.
809
- */
810
- useShorthandAssign?: RuleConfiguration;
811
- }
812
- /**
813
- * A list of rules that belong to this group
814
- */
815
- export interface Performance {
816
- /**
817
- * It enables ALL rules for this group.
818
- */
819
- all?: boolean;
820
- /**
821
- * Disallow the use of spread (...) syntax on accumulators.
822
- */
823
- noAccumulatingSpread?: RuleConfiguration;
824
- /**
825
- * Disallow the use of the delete operator.
826
- */
827
- noDelete?: RuleConfiguration;
828
- /**
829
- * It enables the recommended rules for this group
830
- */
831
- recommended?: boolean;
832
- }
833
- /**
834
- * A list of rules that belong to this group
835
- */
836
- export interface Security {
837
- /**
838
- * It enables ALL rules for this group.
839
- */
840
- all?: boolean;
841
- /**
842
- * Prevent the usage of dangerous JSX props
843
- */
844
- noDangerouslySetInnerHtml?: RuleConfiguration;
845
- /**
846
- * Report when a DOM element or a component uses both children and dangerouslySetInnerHTML prop.
847
- */
848
- noDangerouslySetInnerHtmlWithChildren?: RuleConfiguration;
849
- /**
850
- * It enables the recommended rules for this group
851
- */
852
- recommended?: boolean;
853
- }
854
- /**
855
- * A list of rules that belong to this group
856
- */
857
- export interface Style {
858
- /**
859
- * It enables ALL rules for this group.
860
- */
861
- all?: boolean;
862
- /**
863
- * Disallow the use of arguments
864
- */
865
- noArguments?: RuleConfiguration;
866
- /**
867
- * Disallow comma operator.
868
- */
869
- noCommaOperator?: RuleConfiguration;
870
- /**
871
- * Disallow implicit true values on JSX boolean attributes
872
- */
873
- noImplicitBoolean?: RuleConfiguration;
874
- /**
875
- * Disallow type annotations for variables, parameters, and class properties initialized with a literal expression.
876
- */
877
- noInferrableTypes?: RuleConfiguration;
878
- /**
879
- * Disallow the use of TypeScript's namespaces.
880
- */
881
- noNamespace?: RuleConfiguration;
882
- /**
883
- * Disallow negation in the condition of an if statement if it has an else clause.
884
- */
885
- noNegationElse?: RuleConfiguration;
886
- /**
887
- * Disallow non-null assertions using the ! postfix operator.
888
- */
889
- noNonNullAssertion?: RuleConfiguration;
890
- /**
891
- * Disallow reassigning function parameters.
892
- */
893
- noParameterAssign?: RuleConfiguration;
894
- /**
895
- * Disallow the use of parameter properties in class constructors.
896
- */
897
- noParameterProperties?: RuleConfiguration;
898
- /**
899
- * This rule allows you to specify global variable names that you don’t want to use in your application.
900
- */
901
- noRestrictedGlobals?: RuleConfiguration;
902
- /**
903
- * Disallow the use of constants which its value is the upper-case version of its name.
904
- */
905
- noShoutyConstants?: RuleConfiguration;
906
- /**
907
- * Disallow template literals if interpolation and special-character handling are not needed
908
- */
909
- noUnusedTemplateLiteral?: RuleConfiguration;
910
- /**
911
- * Disallow the use of var
912
- */
913
- noVar?: RuleConfiguration;
914
- /**
915
- * It enables the recommended rules for this group
916
- */
917
- recommended?: boolean;
918
- /**
919
- * Requires following curly brace conventions.
920
- */
921
- useBlockStatements?: RuleConfiguration;
922
- /**
923
- * Enforce using else if instead of nested if in else clauses.
924
- */
925
- useCollapsedElseIf?: RuleConfiguration;
926
- /**
927
- * Require const declarations for variables that are never reassigned after declared.
928
- */
929
- useConst?: RuleConfiguration;
930
- /**
931
- * Enforce default function parameters and optional function parameters to be last.
932
- */
933
- useDefaultParameterLast?: RuleConfiguration;
934
- /**
935
- * Require that each enum member value be explicitly initialized.
936
- */
937
- useEnumInitializers?: RuleConfiguration;
938
- /**
939
- * Disallow the use of Math.pow in favor of the ** operator.
940
- */
941
- useExponentiationOperator?: RuleConfiguration;
942
- /**
943
- * This rule enforces the use of <>...</> over <Fragment>...</Fragment>.
944
- */
945
- useFragmentSyntax?: RuleConfiguration;
946
- /**
947
- * Require all enum members to be literal values.
948
- */
949
- useLiteralEnumMembers?: RuleConfiguration;
950
- /**
951
- * Enforce naming conventions for everything across a codebase.
952
- */
953
- useNamingConvention?: RuleConfiguration;
954
- /**
955
- * Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals
956
- */
957
- useNumericLiterals?: RuleConfiguration;
958
- /**
959
- * Prevent extra closing tags for components without children
960
- */
961
- useSelfClosingElements?: RuleConfiguration;
962
- /**
963
- * When expressing array types, this rule promotes the usage of T[] shorthand instead of Array<T>.
964
- */
965
- useShorthandArrayType?: RuleConfiguration;
966
- /**
967
- * Enforces switch clauses have a single statement, emits a quick fix wrapping the statements in a block.
968
- */
969
- useSingleCaseStatement?: RuleConfiguration;
970
- /**
971
- * Disallow multiple variable declarations in the same variable statement
972
- */
973
- useSingleVarDeclarator?: RuleConfiguration;
974
- /**
975
- * Prefer template literals over string concatenation.
976
- */
977
- useTemplate?: RuleConfiguration;
978
- /**
979
- * Enforce the use of while loops instead of for loops when the initializer and update expressions are not needed.
980
- */
981
- useWhile?: RuleConfiguration;
982
- }
983
- /**
984
- * A list of rules that belong to this group
985
- */
986
- export interface Suspicious {
987
- /**
988
- * It enables ALL rules for this group.
989
- */
990
- all?: boolean;
991
- /**
992
- * Discourage the usage of Array index in keys.
993
- */
994
- noArrayIndexKey?: RuleConfiguration;
995
- /**
996
- * Disallow assignments in expressions.
997
- */
998
- noAssignInExpressions?: RuleConfiguration;
999
- /**
1000
- * Disallows using an async function as a Promise executor.
1001
- */
1002
- noAsyncPromiseExecutor?: RuleConfiguration;
1003
- /**
1004
- * Disallow reassigning exceptions in catch clauses.
1005
- */
1006
- noCatchAssign?: RuleConfiguration;
1007
- /**
1008
- * Disallow reassigning class members.
1009
- */
1010
- noClassAssign?: RuleConfiguration;
1011
- /**
1012
- * Prevent comments from being inserted as text nodes
1013
- */
1014
- noCommentText?: RuleConfiguration;
1015
- /**
1016
- * Disallow comparing against -0
1017
- */
1018
- noCompareNegZero?: RuleConfiguration;
1019
- /**
1020
- * Disallow labeled statements that are not loops.
1021
- */
1022
- noConfusingLabels?: RuleConfiguration;
1023
- /**
1024
- * Disallow void type outside of generic or return types.
1025
- */
1026
- noConfusingVoidType?: RuleConfiguration;
1027
- /**
1028
- * Disallow the use of console.log
1029
- */
1030
- noConsoleLog?: RuleConfiguration;
1031
- /**
1032
- * Disallow TypeScript const enum
1033
- */
1034
- noConstEnum?: RuleConfiguration;
1035
- /**
1036
- * Prevents from having control characters and some escape sequences that match control characters in regular expressions.
1037
- */
1038
- noControlCharactersInRegex?: RuleConfiguration;
1039
- /**
1040
- * Disallow the use of debugger
1041
- */
1042
- noDebugger?: RuleConfiguration;
1043
- /**
1044
- * Require the use of === and !==
1045
- */
1046
- noDoubleEquals?: RuleConfiguration;
1047
- /**
1048
- * Disallow duplicate case labels.
1049
- */
1050
- noDuplicateCase?: RuleConfiguration;
1051
- /**
1052
- * Disallow duplicate class members.
1053
- */
1054
- noDuplicateClassMembers?: RuleConfiguration;
1055
- /**
1056
- * Prevents JSX properties to be assigned multiple times.
1057
- */
1058
- noDuplicateJsxProps?: RuleConfiguration;
1059
- /**
1060
- * Prevents object literals having more than one property declaration for the same name.
1061
- */
1062
- noDuplicateObjectKeys?: RuleConfiguration;
1063
- /**
1064
- * Disallow duplicate function parameter name.
1065
- */
1066
- noDuplicateParameters?: RuleConfiguration;
1067
- /**
1068
- * Disallow the declaration of empty interfaces.
1069
- */
1070
- noEmptyInterface?: RuleConfiguration;
1071
- /**
1072
- * Disallow the any type usage.
1073
- */
1074
- noExplicitAny?: RuleConfiguration;
1075
- /**
1076
- * Prevents the wrong usage of the non-null assertion operator (!) in TypeScript files.
1077
- */
1078
- noExtraNonNullAssertion?: RuleConfiguration;
1079
- /**
1080
- * Disallow fallthrough of switch clauses.
1081
- */
1082
- noFallthroughSwitchClause?: RuleConfiguration;
1083
- /**
1084
- * Disallow reassigning function declarations.
1085
- */
1086
- noFunctionAssign?: RuleConfiguration;
1087
- /**
1088
- * Use Number.isFinite instead of global isFinite.
1089
- */
1090
- noGlobalIsFinite?: RuleConfiguration;
1091
- /**
1092
- * Use Number.isNaN instead of global isNaN.
1093
- */
1094
- noGlobalIsNan?: RuleConfiguration;
1095
- /**
1096
- * Disallow assigning to imported bindings
1097
- */
1098
- noImportAssign?: RuleConfiguration;
1099
- /**
1100
- * Disallow labels that share a name with a variable
1101
- */
1102
- noLabelVar?: RuleConfiguration;
1103
- /**
1104
- * Disallow direct use of Object.prototype builtins.
1105
- */
1106
- noPrototypeBuiltins?: RuleConfiguration;
1107
- /**
1108
- * Disallow variable, function, class, and type redeclarations in the same scope.
1109
- */
1110
- noRedeclare?: RuleConfiguration;
1111
- /**
1112
- * Prevents from having redundant "use strict".
1113
- */
1114
- noRedundantUseStrict?: RuleConfiguration;
1115
- /**
1116
- * Disallow comparisons where both sides are exactly the same.
1117
- */
1118
- noSelfCompare?: RuleConfiguration;
1119
- /**
1120
- * Disallow identifiers from shadowing restricted names.
1121
- */
1122
- noShadowRestrictedNames?: RuleConfiguration;
1123
- /**
1124
- * Disallow sparse arrays
1125
- */
1126
- noSparseArray?: RuleConfiguration;
1127
- /**
1128
- * Disallow unsafe declaration merging between interfaces and classes.
1129
- */
1130
- noUnsafeDeclarationMerging?: RuleConfiguration;
1131
- /**
1132
- * Disallow using unsafe negation.
1133
- */
1134
- noUnsafeNegation?: RuleConfiguration;
1135
- /**
1136
- * It enables the recommended rules for this group
1137
- */
1138
- recommended?: boolean;
1139
- /**
1140
- * Enforce default clauses in switch statements to be last
1141
- */
1142
- useDefaultSwitchClauseLast?: RuleConfiguration;
1143
- /**
1144
- * Enforce get methods to always return a value.
1145
- */
1146
- useGetterReturn?: RuleConfiguration;
1147
- /**
1148
- * Use Array.isArray() instead of instanceof Array.
1149
- */
1150
- useIsArray?: RuleConfiguration;
1151
- /**
1152
- * Require using the namespace keyword over the module keyword to declare TypeScript namespaces.
1153
- */
1154
- useNamespaceKeyword?: RuleConfiguration;
1155
- /**
1156
- * This rule verifies the result of typeof $expr unary expressions is being compared to valid values, either string literals containing valid type names or other typeof expressions
1157
- */
1158
- useValidTypeof?: RuleConfiguration;
1159
- }
1160
- export interface OverrideFormatterConfiguration {
1161
- enabled?: boolean;
1162
- /**
1163
- * Stores whether formatting should be allowed to proceed if a given file has syntax errors
1164
- */
1165
- formatWithErrors?: boolean;
1166
- /**
1167
- * The size of the indentation, 2 by default (deprecated, use `indent-width`)
1168
- */
1169
- indentSize?: number;
1170
- /**
1171
- * The indent style.
1172
- */
1173
- indentStyle?: PlainIndentStyle;
1174
- /**
1175
- * The size of the indentation, 2 by default
1176
- */
1177
- indentWidth?: number;
1178
- /**
1179
- * What's the max width of a line. Defaults to 80.
1180
- */
1181
- lineWidth?: LineWidth;
1182
- }
1183
- export interface OverrideLinterConfiguration {
1184
- /**
1185
- * if `false`, it disables the feature and the linter won't be executed. `true` by default
1186
- */
1187
- enabled?: boolean;
1188
- /**
1189
- * List of rules
1190
- */
1191
- rules?: Rules;
1192
- }
1193
- export interface OverrideOrganizeImportsConfiguration {
1194
- /**
1195
- * if `false`, it disables the feature and the linter won't be executed. `true` by default
1196
- */
1197
- enabled?: boolean;
1198
- }
1199
- export type RuleConfiguration = RulePlainConfiguration | RuleWithOptions;
1200
- export type RulePlainConfiguration = "warn" | "error" | "off";
1201
- export interface RuleWithOptions {
1202
- level: RulePlainConfiguration;
1203
- options?: PossibleOptions;
1204
- }
1205
- export type PossibleOptions =
1206
- | ComplexityOptions
1207
- | HooksOptions
1208
- | NamingConventionOptions
1209
- | RestrictedGlobalsOptions;
1210
- /**
1211
- * Options for the rule `noExcessiveCognitiveComplexity`.
1212
- */
1213
- export interface ComplexityOptions {
1214
- /**
1215
- * The maximum complexity score that we allow. Anything higher is considered excessive.
1216
- */
1217
- maxAllowedComplexity: number;
1218
- }
1219
- /**
1220
- * Options for the rule `useExhaustiveDependencies` and `useHookAtTopLevel`
1221
- */
1222
- export interface HooksOptions {
1223
- /**
1224
- * List of safe hooks
1225
- */
1226
- hooks: Hooks[];
1227
- }
1228
- /**
1229
- * Rule's options.
1230
- */
1231
- export interface NamingConventionOptions {
1232
- /**
1233
- * Allowed cases for _TypeScript_ `enum` member names.
1234
- */
1235
- enumMemberCase: EnumMemberCase;
1236
- /**
1237
- * If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. This does not affect other [Case].
1238
- */
1239
- strictCase: boolean;
1240
- }
1241
- /**
1242
- * Options for the rule `noRestrictedGlobals`.
1243
- */
1244
- export interface RestrictedGlobalsOptions {
1245
- /**
1246
- * A list of names that should trigger the rule
1247
- */
1248
- deniedGlobals?: string[];
1249
- }
1250
- export interface Hooks {
1251
- /**
1252
- * The "position" of the closure function, starting from zero.
1253
-
1254
- ### Example
1255
- */
1256
- closureIndex?: number;
1257
- /**
1258
- * The "position" of the array of dependencies, starting from zero.
1259
- */
1260
- dependenciesIndex?: number;
1261
- /**
1262
- * The name of the hook
1263
- */
1264
- name: string;
1265
- }
1266
- /**
1267
- * Supported cases for TypeScript `enum` member names.
1268
- */
1269
- export type EnumMemberCase = "PascalCase" | "CONSTANT_CASE" | "camelCase";
1270
- export interface OpenFileParams {
1271
- content: string;
1272
- language_hint?: Language;
1273
- path: RomePath;
1274
- version: number;
1275
- }
1276
- /**
1277
- * Supported languages by Biome
1278
- */
1279
- export type Language =
1280
- | "JavaScript"
1281
- | "JavaScriptReact"
1282
- | "TypeScript"
1283
- | "TypeScriptReact"
1284
- | "Json"
1285
- | "Jsonc"
1286
- | "Unknown";
1287
- export interface ChangeFileParams {
1288
- content: string;
1289
- path: RomePath;
1290
- version: number;
1291
- }
1292
- export interface CloseFileParams {
1293
- path: RomePath;
1294
- }
1295
- export interface GetSyntaxTreeParams {
1296
- path: RomePath;
1297
- }
1298
- export interface GetSyntaxTreeResult {
1299
- ast: string;
1300
- cst: string;
1301
- }
1302
- export interface OrganizeImportsParams {
1303
- path: RomePath;
1304
- }
1305
- export interface OrganizeImportsResult {
1306
- code: string;
1307
- }
1308
- export interface GetFileContentParams {
1309
- path: RomePath;
1310
- }
1311
- export interface GetControlFlowGraphParams {
1312
- cursor: TextSize;
1313
- path: RomePath;
1314
- }
1315
- export type TextSize = number;
1316
- export interface GetFormatterIRParams {
1317
- path: RomePath;
1318
- }
1319
- export interface PullDiagnosticsParams {
1320
- categories: RuleCategories;
1321
- max_diagnostics: number;
1322
- path: RomePath;
1323
- }
1324
- export type RuleCategories = RuleCategory[];
1325
- export type RuleCategory = "Syntax" | "Lint" | "Action" | "Transformation";
1326
- export interface PullDiagnosticsResult {
1327
- diagnostics: Diagnostic[];
1328
- errors: number;
1329
- skipped_diagnostics: number;
1330
- }
1331
- /**
1332
- * Serializable representation for a [Diagnostic](super::Diagnostic).
1333
- */
1334
- export interface Diagnostic {
1335
- advices: Advices;
1336
- category?: Category;
1337
- description: string;
1338
- location: Location;
1339
- message: MarkupBuf;
1340
- severity: Severity;
1341
- source?: Diagnostic;
1342
- tags: DiagnosticTags;
1343
- verbose_advices: Advices;
1344
- }
1345
- /**
1346
- * Implementation of [Visitor] collecting serializable [Advice] into a vector.
1347
- */
1348
- export interface Advices {
1349
- advices: Advice[];
1350
- }
1351
- export type Category =
1352
- | "lint/a11y/noAccessKey"
1353
- | "lint/a11y/noAriaUnsupportedElements"
1354
- | "lint/a11y/noAutofocus"
1355
- | "lint/a11y/noBlankTarget"
1356
- | "lint/a11y/noDistractingElements"
1357
- | "lint/a11y/noHeaderScope"
1358
- | "lint/a11y/noNoninteractiveElementToInteractiveRole"
1359
- | "lint/a11y/noNoninteractiveTabindex"
1360
- | "lint/a11y/noPositiveTabindex"
1361
- | "lint/a11y/noRedundantAlt"
1362
- | "lint/a11y/noRedundantRoles"
1363
- | "lint/a11y/noSvgWithoutTitle"
1364
- | "lint/a11y/useAltText"
1365
- | "lint/a11y/useAnchorContent"
1366
- | "lint/a11y/useAriaPropsForRole"
1367
- | "lint/a11y/useButtonType"
1368
- | "lint/a11y/useHeadingContent"
1369
- | "lint/a11y/useHtmlLang"
1370
- | "lint/a11y/useIframeTitle"
1371
- | "lint/a11y/useKeyWithClickEvents"
1372
- | "lint/a11y/useKeyWithMouseEvents"
1373
- | "lint/a11y/useMediaCaption"
1374
- | "lint/a11y/useValidAnchor"
1375
- | "lint/a11y/useValidAriaProps"
1376
- | "lint/a11y/useValidAriaValues"
1377
- | "lint/a11y/useValidLang"
1378
- | "lint/complexity/noBannedTypes"
1379
- | "lint/complexity/noExcessiveCognitiveComplexity"
1380
- | "lint/complexity/noExtraBooleanCast"
1381
- | "lint/complexity/noForEach"
1382
- | "lint/complexity/noMultipleSpacesInRegularExpressionLiterals"
1383
- | "lint/complexity/noStaticOnlyClass"
1384
- | "lint/complexity/noUselessCatch"
1385
- | "lint/complexity/noUselessConstructor"
1386
- | "lint/complexity/noUselessEmptyExport"
1387
- | "lint/complexity/noUselessFragments"
1388
- | "lint/complexity/noUselessLabel"
1389
- | "lint/complexity/noUselessRename"
1390
- | "lint/complexity/noUselessSwitchCase"
1391
- | "lint/complexity/noUselessThisAlias"
1392
- | "lint/complexity/noUselessTypeConstraint"
1393
- | "lint/complexity/noVoid"
1394
- | "lint/complexity/noWith"
1395
- | "lint/complexity/useFlatMap"
1396
- | "lint/complexity/useLiteralKeys"
1397
- | "lint/complexity/useOptionalChain"
1398
- | "lint/complexity/useSimpleNumberKeys"
1399
- | "lint/complexity/useSimplifiedLogicExpression"
1400
- | "lint/correctness/noChildrenProp"
1401
- | "lint/correctness/noConstAssign"
1402
- | "lint/correctness/noConstantCondition"
1403
- | "lint/correctness/noConstructorReturn"
1404
- | "lint/correctness/noEmptyPattern"
1405
- | "lint/correctness/noGlobalObjectCalls"
1406
- | "lint/correctness/noInnerDeclarations"
1407
- | "lint/correctness/noInvalidConstructorSuper"
1408
- | "lint/correctness/noNewSymbol"
1409
- | "lint/correctness/noNonoctalDecimalEscape"
1410
- | "lint/correctness/noPrecisionLoss"
1411
- | "lint/correctness/noRenderReturnValue"
1412
- | "lint/correctness/noSelfAssign"
1413
- | "lint/correctness/noSetterReturn"
1414
- | "lint/correctness/noStringCaseMismatch"
1415
- | "lint/correctness/noSwitchDeclarations"
1416
- | "lint/correctness/noUndeclaredVariables"
1417
- | "lint/correctness/noUnnecessaryContinue"
1418
- | "lint/correctness/noUnreachable"
1419
- | "lint/correctness/noUnreachableSuper"
1420
- | "lint/correctness/noUnsafeFinally"
1421
- | "lint/correctness/noUnsafeOptionalChaining"
1422
- | "lint/correctness/noUnusedLabels"
1423
- | "lint/correctness/noUnusedVariables"
1424
- | "lint/correctness/noVoidElementsWithChildren"
1425
- | "lint/correctness/noVoidTypeReturn"
1426
- | "lint/correctness/useExhaustiveDependencies"
1427
- | "lint/correctness/useHookAtTopLevel"
1428
- | "lint/correctness/useIsNan"
1429
- | "lint/correctness/useValidForDirection"
1430
- | "lint/correctness/useYield"
1431
- | "lint/nursery/noApproximativeNumericConstant"
1432
- | "lint/nursery/noDuplicateJsonKeys"
1433
- | "lint/nursery/noEmptyBlockStatements"
1434
- | "lint/nursery/noEmptyCharacterClassInRegex"
1435
- | "lint/nursery/noInteractiveElementToNoninteractiveRole"
1436
- | "lint/nursery/noInvalidNewBuiltin"
1437
- | "lint/nursery/noMisleadingInstantiator"
1438
- | "lint/nursery/noMisrefactoredShorthandAssign"
1439
- | "lint/nursery/noThisInStatic"
1440
- | "lint/nursery/noUnusedImports"
1441
- | "lint/nursery/noUselessElse"
1442
- | "lint/nursery/noUselessLoneBlockStatements"
1443
- | "lint/nursery/useAriaActivedescendantWithTabindex"
1444
- | "lint/nursery/useArrowFunction"
1445
- | "lint/nursery/useAsConstAssertion"
1446
- | "lint/nursery/useBiomeSuppressionComment"
1447
- | "lint/nursery/useGroupedTypeImport"
1448
- | "lint/nursery/useImportRestrictions"
1449
- | "lint/nursery/useShorthandAssign"
1450
- | "lint/performance/noAccumulatingSpread"
1451
- | "lint/performance/noDelete"
1452
- | "lint/security/noDangerouslySetInnerHtml"
1453
- | "lint/security/noDangerouslySetInnerHtmlWithChildren"
1454
- | "lint/style/noArguments"
1455
- | "lint/style/noCommaOperator"
1456
- | "lint/style/noImplicitBoolean"
1457
- | "lint/style/noInferrableTypes"
1458
- | "lint/style/noNamespace"
1459
- | "lint/style/noNegationElse"
1460
- | "lint/style/noNonNullAssertion"
1461
- | "lint/style/noParameterAssign"
1462
- | "lint/style/noParameterProperties"
1463
- | "lint/style/noRestrictedGlobals"
1464
- | "lint/style/noShoutyConstants"
1465
- | "lint/style/noUnusedTemplateLiteral"
1466
- | "lint/style/noVar"
1467
- | "lint/style/useBlockStatements"
1468
- | "lint/style/useCollapsedElseIf"
1469
- | "lint/style/useConst"
1470
- | "lint/style/useDefaultParameterLast"
1471
- | "lint/style/useEnumInitializers"
1472
- | "lint/style/useExponentiationOperator"
1473
- | "lint/style/useFragmentSyntax"
1474
- | "lint/style/useLiteralEnumMembers"
1475
- | "lint/style/useNamingConvention"
1476
- | "lint/style/useNumericLiterals"
1477
- | "lint/style/useSelfClosingElements"
1478
- | "lint/style/useShorthandArrayType"
1479
- | "lint/style/useSingleCaseStatement"
1480
- | "lint/style/useSingleVarDeclarator"
1481
- | "lint/style/useTemplate"
1482
- | "lint/style/useWhile"
1483
- | "lint/suspicious/noArrayIndexKey"
1484
- | "lint/suspicious/noAssignInExpressions"
1485
- | "lint/suspicious/noAsyncPromiseExecutor"
1486
- | "lint/suspicious/noCatchAssign"
1487
- | "lint/suspicious/noClassAssign"
1488
- | "lint/suspicious/noCommentText"
1489
- | "lint/suspicious/noCompareNegZero"
1490
- | "lint/suspicious/noConfusingLabels"
1491
- | "lint/suspicious/noConfusingVoidType"
1492
- | "lint/suspicious/noConsoleLog"
1493
- | "lint/suspicious/noConstEnum"
1494
- | "lint/suspicious/noControlCharactersInRegex"
1495
- | "lint/suspicious/noDebugger"
1496
- | "lint/suspicious/noDoubleEquals"
1497
- | "lint/suspicious/noDuplicateCase"
1498
- | "lint/suspicious/noDuplicateClassMembers"
1499
- | "lint/suspicious/noDuplicateJsxProps"
1500
- | "lint/suspicious/noDuplicateObjectKeys"
1501
- | "lint/suspicious/noDuplicateParameters"
1502
- | "lint/suspicious/noEmptyInterface"
1503
- | "lint/suspicious/noExplicitAny"
1504
- | "lint/suspicious/noExtraNonNullAssertion"
1505
- | "lint/suspicious/noFallthroughSwitchClause"
1506
- | "lint/suspicious/noFunctionAssign"
1507
- | "lint/suspicious/noGlobalIsFinite"
1508
- | "lint/suspicious/noGlobalIsNan"
1509
- | "lint/suspicious/noImportAssign"
1510
- | "lint/suspicious/noLabelVar"
1511
- | "lint/suspicious/noPrototypeBuiltins"
1512
- | "lint/suspicious/noRedeclare"
1513
- | "lint/suspicious/noRedundantUseStrict"
1514
- | "lint/suspicious/noSelfCompare"
1515
- | "lint/suspicious/noShadowRestrictedNames"
1516
- | "lint/suspicious/noSparseArray"
1517
- | "lint/suspicious/noUnsafeDeclarationMerging"
1518
- | "lint/suspicious/noUnsafeNegation"
1519
- | "lint/suspicious/useDefaultSwitchClauseLast"
1520
- | "lint/suspicious/useGetterReturn"
1521
- | "lint/suspicious/useIsArray"
1522
- | "lint/suspicious/useNamespaceKeyword"
1523
- | "lint/suspicious/useValidTypeof"
1524
- | "files/missingHandler"
1525
- | "format"
1526
- | "check"
1527
- | "ci"
1528
- | "configuration"
1529
- | "organizeImports"
1530
- | "migrate"
1531
- | "deserialize"
1532
- | "internalError/io"
1533
- | "internalError/fs"
1534
- | "internalError/panic"
1535
- | "parse"
1536
- | "parse/noSuperWithoutExtends"
1537
- | "parse/noDuplicatePrivateClassMembers"
1538
- | "lint"
1539
- | "lint/a11y"
1540
- | "lint/complexity"
1541
- | "lint/correctness"
1542
- | "lint/nursery"
1543
- | "lint/performance"
1544
- | "lint/security"
1545
- | "lint/style"
1546
- | "lint/suspicious"
1547
- | "suppressions/parse"
1548
- | "suppressions/unknownGroup"
1549
- | "suppressions/unknownRule"
1550
- | "suppressions/unused"
1551
- | "suppressions/deprecatedSuppressionComment"
1552
- | "args/fileNotFound"
1553
- | "flags/invalid"
1554
- | "semanticTests";
1555
- export interface Location {
1556
- path?: Resource_for_String;
1557
- source_code?: string;
1558
- span?: TextRange;
1559
- }
1560
- export type MarkupBuf = MarkupNodeBuf[];
1561
- /**
1562
- * The severity to associate to a diagnostic.
1563
- */
1564
- export type Severity = "hint" | "information" | "warning" | "error" | "fatal";
1565
- export type DiagnosticTags = DiagnosticTag[];
1566
- /**
1567
- * Serializable representation of a [Diagnostic](super::Diagnostic) advice
1568
-
1569
- See the [Visitor] trait for additional documentation on all the supported advice types.
1570
- */
1571
- export type Advice =
1572
- | { Log: [LogCategory, MarkupBuf] }
1573
- | { List: MarkupBuf[] }
1574
- | { Frame: Location }
1575
- | { Diff: TextEdit }
1576
- | { Backtrace: [MarkupBuf, Backtrace] }
1577
- | { Command: string }
1578
- | { Group: [MarkupBuf, Advices] };
1579
- /**
1580
- * Represents the resource a diagnostic is associated with.
1581
- */
1582
- export type Resource_for_String = "argv" | "memory" | { file: string };
1583
- export type TextRange = [TextSize, TextSize];
1584
- export interface MarkupNodeBuf {
1585
- content: string;
1586
- elements: MarkupElement[];
1587
- }
1588
- /**
1589
- * Internal enum used to automatically generate bit offsets for [DiagnosticTags] and help with the implementation of `serde` and `schemars` for tags.
1590
- */
1591
- export type DiagnosticTag =
1592
- | "fixable"
1593
- | "internal"
1594
- | "unnecessaryCode"
1595
- | "deprecatedCode";
1596
- /**
1597
- * The category for a log advice, defines how the message should be presented to the user.
1598
- */
1599
- export type LogCategory = "None" | "Info" | "Warn" | "Error";
1600
- export interface TextEdit {
1601
- dictionary: string;
1602
- ops: CompressedOp[];
1603
- }
1604
- export type Backtrace = BacktraceFrame[];
1605
- /**
1606
- * Enumeration of all the supported markup elements
1607
- */
1608
- export type MarkupElement =
1609
- | "Emphasis"
1610
- | "Dim"
1611
- | "Italic"
1612
- | "Underline"
1613
- | "Error"
1614
- | "Success"
1615
- | "Warn"
1616
- | "Info"
1617
- | "Debug"
1618
- | "Trace"
1619
- | "Inverse"
1620
- | { Hyperlink: { href: string } };
1621
- export type CompressedOp =
1622
- | { DiffOp: DiffOp }
1623
- | { EqualLines: { line_count: number } };
1624
- /**
1625
- * Serializable representation of a backtrace frame.
1626
- */
1627
- export interface BacktraceFrame {
1628
- ip: number;
1629
- symbols: BacktraceSymbol[];
1630
- }
1631
- export type DiffOp =
1632
- | { Equal: { range: TextRange } }
1633
- | { Insert: { range: TextRange } }
1634
- | { Delete: { range: TextRange } };
1635
- /**
1636
- * Serializable representation of a backtrace frame symbol.
1637
- */
1638
- export interface BacktraceSymbol {
1639
- colno?: number;
1640
- filename?: string;
1641
- lineno?: number;
1642
- name?: string;
1643
- }
1644
- export interface PullActionsParams {
1645
- path: RomePath;
1646
- range: TextRange;
1647
- }
1648
- export interface PullActionsResult {
1649
- actions: CodeAction[];
1650
- }
1651
- export interface CodeAction {
1652
- category: ActionCategory;
1653
- rule_name?: [string, string];
1654
- suggestion: CodeSuggestion;
1655
- }
1656
- /**
1657
- * The category of a code action, this type maps directly to the [CodeActionKind] type in the Language Server Protocol specification
1658
-
1659
- [CodeActionKind]: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeActionKind
1660
- */
1661
- export type ActionCategory =
1662
- | "QuickFix"
1663
- | { Refactor: RefactorKind }
1664
- | { Source: SourceActionKind }
1665
- | { Other: string };
1666
- /**
1667
- * A Suggestion that is provided by Biome's linter, and can be reported to the user, and can be automatically applied if it has the right [`Applicability`].
1668
- */
1669
- export interface CodeSuggestion {
1670
- applicability: Applicability;
1671
- labels: TextRange[];
1672
- msg: MarkupBuf;
1673
- span: TextRange;
1674
- suggestion: TextEdit;
1675
- }
1676
- /**
1677
- * The sub-category of a refactor code action
1678
- */
1679
- export type RefactorKind =
1680
- | "None"
1681
- | "Extract"
1682
- | "Inline"
1683
- | "Rewrite"
1684
- | { Other: string };
1685
- /**
1686
- * The sub-category of a source code action
1687
- */
1688
- export type SourceActionKind =
1689
- | "FixAll"
1690
- | "None"
1691
- | "OrganizeImports"
1692
- | { Other: string };
1693
- /**
1694
- * Indicates how a tool should manage this suggestion.
1695
- */
1696
- export type Applicability = "Always" | "MaybeIncorrect";
1697
- export interface FormatFileParams {
1698
- path: RomePath;
1699
- }
1700
- export interface Printed {
1701
- code: string;
1702
- range?: TextRange;
1703
- sourcemap: SourceMarker[];
1704
- verbatim_ranges: TextRange[];
1705
- }
1706
- /**
1707
- * Lightweight sourcemap marker between source and output tokens
1708
- */
1709
- export interface SourceMarker {
1710
- /**
1711
- * Position of the marker in the output code
1712
- */
1713
- dest: TextSize;
1714
- /**
1715
- * Position of the marker in the original source
1716
- */
1717
- source: TextSize;
1718
- }
1719
- export interface FormatRangeParams {
1720
- path: RomePath;
1721
- range: TextRange;
1722
- }
1723
- export interface FormatOnTypeParams {
1724
- offset: TextSize;
1725
- path: RomePath;
1726
- }
1727
- export interface FixFileParams {
1728
- fix_file_mode: FixFileMode;
1729
- path: RomePath;
1730
- should_format: boolean;
1731
- }
1732
- /**
1733
- * Which fixes should be applied during the analyzing phase
1734
- */
1735
- export type FixFileMode = "SafeFixes" | "SafeAndUnsafeFixes";
1736
- export interface FixFileResult {
1737
- /**
1738
- * List of all the code actions applied to the file
1739
- */
1740
- actions: FixAction[];
1741
- /**
1742
- * New source code for the file with all fixes applied
1743
- */
1744
- code: string;
1745
- /**
1746
- * Number of errors
1747
- */
1748
- errors: number;
1749
- /**
1750
- * number of skipped suggested fixes
1751
- */
1752
- skipped_suggested_fixes: number;
1753
- }
1754
- export interface FixAction {
1755
- /**
1756
- * Source range at which this action was applied
1757
- */
1758
- range: TextRange;
1759
- /**
1760
- * Name of the rule group and rule that emitted this code action
1761
- */
1762
- rule_name?: [string, string];
1763
- }
1764
- export interface RenameParams {
1765
- new_name: string;
1766
- path: RomePath;
1767
- symbol_at: TextSize;
1768
- }
1769
- export interface RenameResult {
1770
- /**
1771
- * List of text edit operations to apply on the source code
1772
- */
1773
- indels: TextEdit;
1774
- /**
1775
- * Range of source code modified by this rename operation
1776
- */
1777
- range: TextRange;
1778
- }
1779
- export interface Workspace {
1780
- fileFeatures(params: SupportsFeatureParams): Promise<SupportsFeatureResult>;
1781
- updateSettings(params: UpdateSettingsParams): Promise<void>;
1782
- openFile(params: OpenFileParams): Promise<void>;
1783
- changeFile(params: ChangeFileParams): Promise<void>;
1784
- closeFile(params: CloseFileParams): Promise<void>;
1785
- getSyntaxTree(params: GetSyntaxTreeParams): Promise<GetSyntaxTreeResult>;
1786
- organizeImports(
1787
- params: OrganizeImportsParams,
1788
- ): Promise<OrganizeImportsResult>;
1789
- getFileContent(params: GetFileContentParams): Promise<string>;
1790
- getControlFlowGraph(params: GetControlFlowGraphParams): Promise<string>;
1791
- getFormatterIr(params: GetFormatterIRParams): Promise<string>;
1792
- pullDiagnostics(
1793
- params: PullDiagnosticsParams,
1794
- ): Promise<PullDiagnosticsResult>;
1795
- pullActions(params: PullActionsParams): Promise<PullActionsResult>;
1796
- formatFile(params: FormatFileParams): Promise<Printed>;
1797
- formatRange(params: FormatRangeParams): Promise<Printed>;
1798
- formatOnType(params: FormatOnTypeParams): Promise<Printed>;
1799
- fixFile(params: FixFileParams): Promise<FixFileResult>;
1800
- rename(params: RenameParams): Promise<RenameResult>;
1801
- destroy(): void;
1802
- }
1803
- export function createWorkspace(transport: Transport): Workspace {
1804
- return {
1805
- fileFeatures(params) {
1806
- return transport.request("biome/file_features", params);
1807
- },
1808
- updateSettings(params) {
1809
- return transport.request("biome/update_settings", params);
1810
- },
1811
- openFile(params) {
1812
- return transport.request("biome/open_file", params);
1813
- },
1814
- changeFile(params) {
1815
- return transport.request("biome/change_file", params);
1816
- },
1817
- closeFile(params) {
1818
- return transport.request("biome/close_file", params);
1819
- },
1820
- getSyntaxTree(params) {
1821
- return transport.request("biome/get_syntax_tree", params);
1822
- },
1823
- organizeImports(params) {
1824
- return transport.request("biome/organize_imports", params);
1825
- },
1826
- getFileContent(params) {
1827
- return transport.request("biome/get_file_content", params);
1828
- },
1829
- getControlFlowGraph(params) {
1830
- return transport.request("biome/get_control_flow_graph", params);
1831
- },
1832
- getFormatterIr(params) {
1833
- return transport.request("biome/get_formatter_ir", params);
1834
- },
1835
- pullDiagnostics(params) {
1836
- return transport.request("biome/pull_diagnostics", params);
1837
- },
1838
- pullActions(params) {
1839
- return transport.request("biome/pull_actions", params);
1840
- },
1841
- formatFile(params) {
1842
- return transport.request("biome/format_file", params);
1843
- },
1844
- formatRange(params) {
1845
- return transport.request("biome/format_range", params);
1846
- },
1847
- formatOnType(params) {
1848
- return transport.request("biome/format_on_type", params);
1849
- },
1850
- fixFile(params) {
1851
- return transport.request("biome/fix_file", params);
1852
- },
1853
- rename(params) {
1854
- return transport.request("biome/rename", params);
1855
- },
1856
- destroy() {
1857
- transport.destroy();
1858
- },
1859
- };
1860
- }