@konvert7/klint 1.3.0 → 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/README.md +58 -39
- package/klint.schema.json +1434 -607
- package/klint.schema.yaml +1100 -505
- package/package.json +7 -7
package/klint.schema.yaml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$id: https://raw.githubusercontent.com/konvert7/klint/refs/tags/v1.
|
|
1
|
+
$id: https://raw.githubusercontent.com/konvert7/klint/refs/tags/v1.4.0/klint.schema.json
|
|
2
2
|
$schema: http://json-schema.org/draft-07/schema#
|
|
3
3
|
additionalProperties: false
|
|
4
4
|
description: klint configuration. Lives at klint.yaml (or klint.config.json) next to biome.json and knip.json.
|
|
@@ -412,7 +412,7 @@ properties:
|
|
|
412
412
|
type: string
|
|
413
413
|
type: array
|
|
414
414
|
plugins:
|
|
415
|
-
description: '
|
|
415
|
+
description: 'Deprecated (v1): named rule bundles. plugins: [sonar] is replaced by rules.recommended: true — run `klint migrate` to upgrade the config in place. Available: "sonar".'
|
|
416
416
|
items:
|
|
417
417
|
enum:
|
|
418
418
|
- sonar
|
|
@@ -422,248 +422,600 @@ properties:
|
|
|
422
422
|
description: Root directory used to resolve include paths and report relative file names. Defaults to the directory containing klint.config.json.
|
|
423
423
|
type: string
|
|
424
424
|
rules:
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
- additionalProperties: false
|
|
434
|
-
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
435
|
-
properties:
|
|
436
|
-
include:
|
|
437
|
-
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
438
|
-
items:
|
|
439
|
-
type: string
|
|
440
|
-
type: array
|
|
441
|
-
severity:
|
|
442
|
-
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
443
|
-
enum:
|
|
444
|
-
- error
|
|
445
|
-
- warn
|
|
446
|
-
- off
|
|
447
|
-
- null
|
|
448
|
-
type: string
|
|
449
|
-
type: object
|
|
450
|
-
description: 'Map of rule name → severity or options. Example: { "no-floating-promise": "error", "no-sync-in-async": { "severity": "warn", "include": ["src/hooks/**"] } }.'
|
|
451
|
-
properties:
|
|
452
|
-
blank-line-after-block:
|
|
453
|
-
anyOf:
|
|
454
|
-
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
455
|
-
enum:
|
|
456
|
-
- error
|
|
457
|
-
- warn
|
|
458
|
-
- off
|
|
459
|
-
type: string
|
|
460
|
-
- additionalProperties: false
|
|
461
|
-
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
462
|
-
properties:
|
|
463
|
-
include:
|
|
464
|
-
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
465
|
-
items:
|
|
466
|
-
type: string
|
|
467
|
-
type: array
|
|
468
|
-
severity:
|
|
469
|
-
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
425
|
+
anyOf:
|
|
426
|
+
- additionalProperties: false
|
|
427
|
+
description: 'v2 format: rule groups.'
|
|
428
|
+
properties:
|
|
429
|
+
core:
|
|
430
|
+
additionalProperties:
|
|
431
|
+
anyOf:
|
|
432
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
470
433
|
enum:
|
|
471
434
|
- error
|
|
472
435
|
- warn
|
|
473
436
|
- off
|
|
474
|
-
- null
|
|
475
437
|
type: string
|
|
476
|
-
|
|
477
|
-
description:
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
examples:
|
|
495
|
-
- 'blank-line-after-block: warn'
|
|
496
|
-
- |-
|
|
497
|
-
blank-line-after-block:
|
|
498
|
-
severity: warn
|
|
499
|
-
include: ["src/**"]
|
|
500
|
-
statements: [if, for, while, switch, try, guard, loop, with]
|
|
501
|
-
blank-line-before-control-flow:
|
|
502
|
-
anyOf:
|
|
503
|
-
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
504
|
-
enum:
|
|
505
|
-
- error
|
|
506
|
-
- warn
|
|
507
|
-
- off
|
|
508
|
-
type: string
|
|
509
|
-
- additionalProperties: false
|
|
510
|
-
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
438
|
+
- additionalProperties: false
|
|
439
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
440
|
+
properties:
|
|
441
|
+
include:
|
|
442
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
443
|
+
items:
|
|
444
|
+
type: string
|
|
445
|
+
type: array
|
|
446
|
+
severity:
|
|
447
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
448
|
+
enum:
|
|
449
|
+
- error
|
|
450
|
+
- warn
|
|
451
|
+
- off
|
|
452
|
+
- null
|
|
453
|
+
type: string
|
|
454
|
+
type: object
|
|
455
|
+
description: Built-in rules by name.
|
|
511
456
|
properties:
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
457
|
+
blank-line-after-block:
|
|
458
|
+
anyOf:
|
|
459
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
460
|
+
enum:
|
|
461
|
+
- error
|
|
462
|
+
- warn
|
|
463
|
+
- off
|
|
518
464
|
type: string
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
465
|
+
- additionalProperties: false
|
|
466
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
467
|
+
properties:
|
|
468
|
+
include:
|
|
469
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
470
|
+
items:
|
|
471
|
+
type: string
|
|
472
|
+
type: array
|
|
473
|
+
severity:
|
|
474
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
475
|
+
enum:
|
|
476
|
+
- error
|
|
477
|
+
- warn
|
|
478
|
+
- off
|
|
479
|
+
- null
|
|
480
|
+
type: string
|
|
481
|
+
statements:
|
|
482
|
+
description: 'Block statement kinds this rule targets. Defaults to every kind: if, for, while, switch, try, guard, loop, with. match is an alias of switch. return is not a block statement. An empty list turns the rule off.'
|
|
483
|
+
items:
|
|
484
|
+
description: A block statement kind the rule targets. match is an alias of switch.
|
|
485
|
+
enum:
|
|
486
|
+
- if
|
|
487
|
+
- for
|
|
488
|
+
- while
|
|
489
|
+
- switch
|
|
490
|
+
- match
|
|
491
|
+
- try
|
|
492
|
+
- guard
|
|
493
|
+
- loop
|
|
494
|
+
- with
|
|
495
|
+
type: string
|
|
496
|
+
type: array
|
|
497
|
+
type: object
|
|
498
|
+
description: Requires a blank line below a block statement (if, for, while, switch/match, try, guard, loop, with) when another statement follows it in the same block, like C# IDE2003. Works on TypeScript/JavaScript, Python, Swift, Rust and C#; `klint --fix` inserts the line.
|
|
499
|
+
examples:
|
|
500
|
+
- 'blank-line-after-block: warn'
|
|
501
|
+
- |-
|
|
502
|
+
blank-line-after-block:
|
|
503
|
+
severity: warn
|
|
504
|
+
include: ["src/**"]
|
|
505
|
+
statements: [if, for, while, switch, try, guard, loop, with]
|
|
506
|
+
blank-line-before-control-flow:
|
|
507
|
+
anyOf:
|
|
508
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
509
|
+
enum:
|
|
510
|
+
- error
|
|
511
|
+
- warn
|
|
512
|
+
- off
|
|
543
513
|
type: string
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
514
|
+
- additionalProperties: false
|
|
515
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
516
|
+
properties:
|
|
517
|
+
allowSetup:
|
|
518
|
+
description: Skip an if, guard or switch statement whose condition uses a name assigned by the statement directly above it. Defaults to true.
|
|
519
|
+
type: boolean
|
|
520
|
+
include:
|
|
521
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
522
|
+
items:
|
|
523
|
+
type: string
|
|
524
|
+
type: array
|
|
525
|
+
severity:
|
|
526
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
527
|
+
enum:
|
|
528
|
+
- error
|
|
529
|
+
- warn
|
|
530
|
+
- off
|
|
531
|
+
- null
|
|
532
|
+
type: string
|
|
533
|
+
statements:
|
|
534
|
+
description: 'Statement kinds this rule targets. Defaults to every kind: if, for, while, switch, try, return, guard, loop, with. match is an alias of switch. An empty list turns the rule off.'
|
|
535
|
+
items:
|
|
536
|
+
description: A statement kind the rule targets. match is an alias of switch.
|
|
537
|
+
enum:
|
|
538
|
+
- if
|
|
539
|
+
- for
|
|
540
|
+
- while
|
|
541
|
+
- switch
|
|
542
|
+
- match
|
|
543
|
+
- try
|
|
544
|
+
- return
|
|
545
|
+
- guard
|
|
546
|
+
- loop
|
|
547
|
+
- with
|
|
548
|
+
type: string
|
|
549
|
+
type: array
|
|
550
|
+
type: object
|
|
551
|
+
description: Requires a blank line above a control-flow statement (if, for, while, switch/match, try, return, guard, loop, with) that follows another statement in the same block. Works on TypeScript/JavaScript, Python, Swift, Rust and C#; `klint --fix` inserts the line.
|
|
552
|
+
examples:
|
|
553
|
+
- 'blank-line-before-control-flow: error'
|
|
554
|
+
- |-
|
|
555
|
+
blank-line-before-control-flow:
|
|
556
|
+
severity: error
|
|
557
|
+
include: ["src/**", "!src/generated/**"]
|
|
558
|
+
statements: [if, for, while, switch, try, return, guard, loop, with]
|
|
559
|
+
allowSetup: true
|
|
560
|
+
cognitive-complexity:
|
|
561
|
+
anyOf:
|
|
562
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
563
|
+
enum:
|
|
564
|
+
- error
|
|
565
|
+
- warn
|
|
566
|
+
- off
|
|
569
567
|
type: string
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
568
|
+
- additionalProperties: false
|
|
569
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
570
|
+
properties:
|
|
571
|
+
include:
|
|
572
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
573
|
+
items:
|
|
574
|
+
type: string
|
|
575
|
+
type: array
|
|
576
|
+
max:
|
|
577
|
+
default: 15
|
|
578
|
+
description: Highest cognitive complexity a function may have; a function scoring above it is reported. An integer of at least 1. Defaults to 15.
|
|
579
|
+
format: uint32
|
|
580
|
+
minimum: 1
|
|
581
|
+
type: integer
|
|
582
|
+
severity:
|
|
583
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
584
|
+
enum:
|
|
585
|
+
- error
|
|
586
|
+
- warn
|
|
587
|
+
- off
|
|
588
|
+
- null
|
|
589
|
+
type: string
|
|
590
|
+
type: object
|
|
591
|
+
description: Reports every function whose cognitive complexity is above `max` (default 15), scored like Biome 2.6.5's `noExcessiveCognitiveComplexity` (the SonarSource Cognitive Complexity model). Works on TypeScript/JavaScript, Python, Swift, Rust and C#. Opt-in; no autofix.
|
|
592
|
+
examples:
|
|
593
|
+
- 'cognitive-complexity: error'
|
|
594
|
+
- |-
|
|
595
|
+
cognitive-complexity:
|
|
596
|
+
severity: warn
|
|
597
|
+
include: ["src/**", "!src/generated/**"]
|
|
598
|
+
max: 14
|
|
599
|
+
function-length:
|
|
600
|
+
anyOf:
|
|
601
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
602
|
+
enum:
|
|
603
|
+
- error
|
|
604
|
+
- warn
|
|
605
|
+
- off
|
|
608
606
|
type: string
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
607
|
+
- additionalProperties: false
|
|
608
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
609
|
+
properties:
|
|
610
|
+
include:
|
|
611
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
612
|
+
items:
|
|
613
|
+
type: string
|
|
614
|
+
type: array
|
|
615
|
+
max:
|
|
616
|
+
default: 50
|
|
617
|
+
description: Highest number of lines a function body may have; a function counting more is reported. An integer of at least 1. Defaults to 50.
|
|
618
|
+
format: uint32
|
|
619
|
+
minimum: 1
|
|
620
|
+
type: integer
|
|
621
|
+
severity:
|
|
622
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
623
|
+
enum:
|
|
624
|
+
- error
|
|
625
|
+
- warn
|
|
626
|
+
- off
|
|
627
|
+
- null
|
|
628
|
+
type: string
|
|
629
|
+
skipBlankLines:
|
|
630
|
+
default: false
|
|
631
|
+
description: Leave blank lines out of the count. Defaults to false.
|
|
632
|
+
type: boolean
|
|
633
|
+
type: object
|
|
634
|
+
description: 'Reports every function whose body has more than `max` lines (default 50), counted like Biome 2.6.5''s `noExcessiveLinesPerFunction`: brace lines do not count, comment and blank lines do (blank lines not with `skipBlankLines`), and a nested function''s lines count toward its parent. Getters and setters are not checked. Works on TypeScript/JavaScript, Python, Swift, Rust and C#. Opt-in; no autofix.'
|
|
635
|
+
examples:
|
|
636
|
+
- 'function-length: error'
|
|
637
|
+
- |-
|
|
638
|
+
function-length:
|
|
639
|
+
severity: warn
|
|
640
|
+
include: ["src/**", "!src/generated/**"]
|
|
641
|
+
max: 40
|
|
642
|
+
skipBlankLines: true
|
|
643
|
+
no-async-predicate:
|
|
644
|
+
anyOf:
|
|
645
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
646
|
+
enum:
|
|
647
|
+
- error
|
|
648
|
+
- warn
|
|
649
|
+
- off
|
|
650
|
+
type: string
|
|
651
|
+
- additionalProperties: false
|
|
652
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
653
|
+
properties:
|
|
654
|
+
include:
|
|
655
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
656
|
+
items:
|
|
657
|
+
type: string
|
|
658
|
+
type: array
|
|
659
|
+
severity:
|
|
660
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
661
|
+
enum:
|
|
662
|
+
- error
|
|
663
|
+
- warn
|
|
664
|
+
- off
|
|
665
|
+
- null
|
|
666
|
+
type: string
|
|
667
|
+
type: object
|
|
668
|
+
description: Flags `async` functions passed to `.filter`/`.some`/`.every`/`.find`/`.findIndex`. Array methods coerce the returned promise to truthy, so every element appears to match.
|
|
669
|
+
examples:
|
|
670
|
+
- 'no-async-predicate: error'
|
|
671
|
+
no-consecutive-array-push:
|
|
672
|
+
anyOf:
|
|
673
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
674
|
+
enum:
|
|
675
|
+
- error
|
|
676
|
+
- warn
|
|
677
|
+
- off
|
|
678
|
+
type: string
|
|
679
|
+
- additionalProperties: false
|
|
680
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
681
|
+
properties:
|
|
682
|
+
include:
|
|
683
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
684
|
+
items:
|
|
685
|
+
type: string
|
|
686
|
+
type: array
|
|
687
|
+
severity:
|
|
688
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
689
|
+
enum:
|
|
690
|
+
- error
|
|
691
|
+
- warn
|
|
692
|
+
- off
|
|
693
|
+
- null
|
|
694
|
+
type: string
|
|
695
|
+
type: object
|
|
696
|
+
description: Flags consecutive `arr.push(x); arr.push(y);` calls — combine into `arr.push(x, y)` or `arr.push(...items)`.
|
|
697
|
+
examples:
|
|
698
|
+
- 'no-consecutive-array-push: warn'
|
|
699
|
+
no-nested-template-literals:
|
|
700
|
+
anyOf:
|
|
701
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
702
|
+
enum:
|
|
703
|
+
- error
|
|
704
|
+
- warn
|
|
705
|
+
- off
|
|
706
|
+
type: string
|
|
707
|
+
- additionalProperties: false
|
|
708
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
709
|
+
properties:
|
|
710
|
+
include:
|
|
711
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
712
|
+
items:
|
|
713
|
+
type: string
|
|
714
|
+
type: array
|
|
715
|
+
severity:
|
|
716
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
717
|
+
enum:
|
|
718
|
+
- error
|
|
719
|
+
- warn
|
|
720
|
+
- off
|
|
721
|
+
- null
|
|
722
|
+
type: string
|
|
723
|
+
type: object
|
|
724
|
+
description: Flags template literals nested inside template literals — almost always unreadable; extract to a variable.
|
|
725
|
+
examples:
|
|
726
|
+
- 'no-nested-template-literals: warn'
|
|
727
|
+
no-string-match:
|
|
728
|
+
anyOf:
|
|
729
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
730
|
+
enum:
|
|
731
|
+
- error
|
|
732
|
+
- warn
|
|
733
|
+
- off
|
|
734
|
+
type: string
|
|
735
|
+
- additionalProperties: false
|
|
736
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
737
|
+
properties:
|
|
738
|
+
include:
|
|
739
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
740
|
+
items:
|
|
741
|
+
type: string
|
|
742
|
+
type: array
|
|
743
|
+
severity:
|
|
744
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
745
|
+
enum:
|
|
746
|
+
- error
|
|
747
|
+
- warn
|
|
748
|
+
- off
|
|
749
|
+
- null
|
|
750
|
+
type: string
|
|
751
|
+
type: object
|
|
752
|
+
description: Flags `String#match` — prefer `.matchAll()` for iteration or `.test()` for boolean checks. `.match()` returns different shapes depending on the `/g` flag.
|
|
753
|
+
examples:
|
|
754
|
+
- 'no-string-match: error'
|
|
755
|
+
no-sync-in-async:
|
|
756
|
+
anyOf:
|
|
757
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
758
|
+
enum:
|
|
759
|
+
- error
|
|
760
|
+
- warn
|
|
761
|
+
- off
|
|
762
|
+
type: string
|
|
763
|
+
- additionalProperties: false
|
|
764
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
765
|
+
properties:
|
|
766
|
+
include:
|
|
767
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
768
|
+
items:
|
|
769
|
+
type: string
|
|
770
|
+
type: array
|
|
771
|
+
severity:
|
|
772
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
773
|
+
enum:
|
|
774
|
+
- error
|
|
775
|
+
- warn
|
|
776
|
+
- off
|
|
777
|
+
- null
|
|
778
|
+
type: string
|
|
779
|
+
type: object
|
|
780
|
+
description: Flags synchronous I/O (`readFileSync`, `execSync`, etc.) inside async functions — blocks the event loop when an async equivalent is available.
|
|
781
|
+
examples:
|
|
782
|
+
- 'no-sync-in-async: error'
|
|
783
|
+
- |-
|
|
784
|
+
no-sync-in-async:
|
|
785
|
+
severity: warn
|
|
786
|
+
include: ["src/server/**"]
|
|
787
|
+
no-unguarded-json-parse:
|
|
788
|
+
anyOf:
|
|
789
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
790
|
+
enum:
|
|
791
|
+
- error
|
|
792
|
+
- warn
|
|
793
|
+
- off
|
|
794
|
+
type: string
|
|
795
|
+
- additionalProperties: false
|
|
796
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
797
|
+
properties:
|
|
798
|
+
include:
|
|
799
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
800
|
+
items:
|
|
801
|
+
type: string
|
|
802
|
+
type: array
|
|
803
|
+
severity:
|
|
804
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
805
|
+
enum:
|
|
806
|
+
- error
|
|
807
|
+
- warn
|
|
808
|
+
- off
|
|
809
|
+
- null
|
|
810
|
+
type: string
|
|
811
|
+
type: object
|
|
812
|
+
description: Flags `JSON.parse()` calls that aren't wrapped in try/catch — malformed input crashes the process.
|
|
813
|
+
examples:
|
|
814
|
+
- 'no-unguarded-json-parse: error'
|
|
815
|
+
type: object
|
|
816
|
+
recommended:
|
|
817
|
+
default: false
|
|
818
|
+
description: 'true enables the six sonar rules at error, as plugins: [sonar] did.'
|
|
819
|
+
type: boolean
|
|
820
|
+
sonar:
|
|
821
|
+
additionalProperties:
|
|
822
|
+
anyOf:
|
|
823
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
618
824
|
enum:
|
|
619
825
|
- error
|
|
620
826
|
- warn
|
|
621
827
|
- off
|
|
622
|
-
- null
|
|
623
828
|
type: string
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
- error
|
|
643
|
-
- warn
|
|
644
|
-
- off
|
|
645
|
-
type: string
|
|
646
|
-
- additionalProperties: false
|
|
647
|
-
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
829
|
+
- additionalProperties: false
|
|
830
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
831
|
+
properties:
|
|
832
|
+
include:
|
|
833
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
834
|
+
items:
|
|
835
|
+
type: string
|
|
836
|
+
type: array
|
|
837
|
+
severity:
|
|
838
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
839
|
+
enum:
|
|
840
|
+
- error
|
|
841
|
+
- warn
|
|
842
|
+
- off
|
|
843
|
+
- null
|
|
844
|
+
type: string
|
|
845
|
+
type: object
|
|
846
|
+
description: Sonar rules without the sonar/ prefix.
|
|
648
847
|
properties:
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
848
|
+
no-single-char-class:
|
|
849
|
+
anyOf:
|
|
850
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
851
|
+
enum:
|
|
852
|
+
- error
|
|
853
|
+
- warn
|
|
854
|
+
- off
|
|
652
855
|
type: string
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
856
|
+
- additionalProperties: false
|
|
857
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
858
|
+
properties:
|
|
859
|
+
include:
|
|
860
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
861
|
+
items:
|
|
862
|
+
type: string
|
|
863
|
+
type: array
|
|
864
|
+
severity:
|
|
865
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
866
|
+
enum:
|
|
867
|
+
- error
|
|
868
|
+
- warn
|
|
869
|
+
- off
|
|
870
|
+
- null
|
|
871
|
+
type: string
|
|
872
|
+
type: object
|
|
873
|
+
description: Flags single-character character classes in regex (e.g. `/[a]/`) — drop the brackets; the regex matches the same.
|
|
874
|
+
examples:
|
|
875
|
+
- 'sonar/no-single-char-class: warn'
|
|
876
|
+
prefer-at:
|
|
877
|
+
anyOf:
|
|
878
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
879
|
+
enum:
|
|
880
|
+
- error
|
|
881
|
+
- warn
|
|
882
|
+
- off
|
|
883
|
+
type: string
|
|
884
|
+
- additionalProperties: false
|
|
885
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
886
|
+
properties:
|
|
887
|
+
include:
|
|
888
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
889
|
+
items:
|
|
890
|
+
type: string
|
|
891
|
+
type: array
|
|
892
|
+
severity:
|
|
893
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
894
|
+
enum:
|
|
895
|
+
- error
|
|
896
|
+
- warn
|
|
897
|
+
- off
|
|
898
|
+
- null
|
|
899
|
+
type: string
|
|
900
|
+
type: object
|
|
901
|
+
description: Flags negative-index access via `arr[arr.length - 1]` — `.at(-1)` reads cleaner for last-element access.
|
|
902
|
+
examples:
|
|
903
|
+
- 'sonar/prefer-at: warn'
|
|
904
|
+
prefer-nullish-coalescing-assign:
|
|
905
|
+
anyOf:
|
|
906
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
907
|
+
enum:
|
|
908
|
+
- error
|
|
909
|
+
- warn
|
|
910
|
+
- off
|
|
911
|
+
type: string
|
|
912
|
+
- additionalProperties: false
|
|
913
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
914
|
+
properties:
|
|
915
|
+
include:
|
|
916
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
917
|
+
items:
|
|
918
|
+
type: string
|
|
919
|
+
type: array
|
|
920
|
+
severity:
|
|
921
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
922
|
+
enum:
|
|
923
|
+
- error
|
|
924
|
+
- warn
|
|
925
|
+
- off
|
|
926
|
+
- null
|
|
927
|
+
type: string
|
|
928
|
+
type: object
|
|
929
|
+
description: Flags explicit nullish assignment guards — `x ??= y` is the dedicated nullish assignment operator.
|
|
930
|
+
examples:
|
|
931
|
+
- 'sonar/prefer-nullish-coalescing-assign: warn'
|
|
932
|
+
prefer-string-raw:
|
|
933
|
+
anyOf:
|
|
934
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
935
|
+
enum:
|
|
936
|
+
- error
|
|
937
|
+
- warn
|
|
938
|
+
- off
|
|
939
|
+
type: string
|
|
940
|
+
- additionalProperties: false
|
|
941
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
942
|
+
properties:
|
|
943
|
+
include:
|
|
944
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
945
|
+
items:
|
|
946
|
+
type: string
|
|
947
|
+
type: array
|
|
948
|
+
severity:
|
|
949
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
950
|
+
enum:
|
|
951
|
+
- error
|
|
952
|
+
- warn
|
|
953
|
+
- off
|
|
954
|
+
- null
|
|
955
|
+
type: string
|
|
956
|
+
type: object
|
|
957
|
+
description: Flags string literals with multiple backslash escapes — `String.raw` is more readable (Windows paths, regex source, etc.).
|
|
958
|
+
examples:
|
|
959
|
+
- 'sonar/prefer-string-raw: warn'
|
|
960
|
+
prefer-string-raw-regexp:
|
|
961
|
+
anyOf:
|
|
962
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
963
|
+
enum:
|
|
964
|
+
- error
|
|
965
|
+
- warn
|
|
966
|
+
- off
|
|
967
|
+
type: string
|
|
968
|
+
- additionalProperties: false
|
|
969
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
970
|
+
properties:
|
|
971
|
+
include:
|
|
972
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
973
|
+
items:
|
|
974
|
+
type: string
|
|
975
|
+
type: array
|
|
976
|
+
severity:
|
|
977
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
978
|
+
enum:
|
|
979
|
+
- error
|
|
980
|
+
- warn
|
|
981
|
+
- off
|
|
982
|
+
- null
|
|
983
|
+
type: string
|
|
984
|
+
type: object
|
|
985
|
+
description: Flags regex literals built from escape-heavy string concatenation — `String.raw` drops the double backslashes.
|
|
986
|
+
examples:
|
|
987
|
+
- 'sonar/prefer-string-raw-regexp: warn'
|
|
988
|
+
prefer-string-replaceall:
|
|
989
|
+
anyOf:
|
|
990
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
991
|
+
enum:
|
|
992
|
+
- error
|
|
993
|
+
- warn
|
|
994
|
+
- off
|
|
995
|
+
type: string
|
|
996
|
+
- additionalProperties: false
|
|
997
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
998
|
+
properties:
|
|
999
|
+
include:
|
|
1000
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1001
|
+
items:
|
|
1002
|
+
type: string
|
|
1003
|
+
type: array
|
|
1004
|
+
severity:
|
|
1005
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1006
|
+
enum:
|
|
1007
|
+
- error
|
|
1008
|
+
- warn
|
|
1009
|
+
- off
|
|
1010
|
+
- null
|
|
1011
|
+
type: string
|
|
1012
|
+
type: object
|
|
1013
|
+
description: Flags `.replace(/x/g, y)` on strings — `.replaceAll('x', y)` is clearer and faster for all-occurrence replacements.
|
|
1014
|
+
examples:
|
|
1015
|
+
- 'sonar/prefer-string-replaceall: error'
|
|
662
1016
|
type: object
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
- 'no-async-predicate: error'
|
|
666
|
-
no-consecutive-array-push:
|
|
1017
|
+
type: object
|
|
1018
|
+
- additionalProperties:
|
|
667
1019
|
anyOf:
|
|
668
1020
|
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
669
1021
|
enum:
|
|
@@ -688,292 +1040,535 @@ properties:
|
|
|
688
1040
|
- null
|
|
689
1041
|
type: string
|
|
690
1042
|
type: object
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
type:
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
- null
|
|
717
|
-
type: string
|
|
718
|
-
type: object
|
|
719
|
-
description: Flags template literals nested inside template literals — almost always unreadable; extract to a variable.
|
|
720
|
-
examples:
|
|
721
|
-
- 'no-nested-template-literals: warn'
|
|
722
|
-
no-string-match:
|
|
723
|
-
anyOf:
|
|
724
|
-
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
725
|
-
enum:
|
|
726
|
-
- error
|
|
727
|
-
- warn
|
|
728
|
-
- off
|
|
729
|
-
type: string
|
|
730
|
-
- additionalProperties: false
|
|
731
|
-
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
732
|
-
properties:
|
|
733
|
-
include:
|
|
734
|
-
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
735
|
-
items:
|
|
1043
|
+
description: 'v1 format (deprecated): flat map of rule name → severity or options, sonar rules prefixed with sonar/. Run `klint migrate` to upgrade it to rules.recommended / rules.core / rules.sonar.'
|
|
1044
|
+
properties:
|
|
1045
|
+
blank-line-after-block:
|
|
1046
|
+
anyOf:
|
|
1047
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1048
|
+
enum:
|
|
1049
|
+
- error
|
|
1050
|
+
- warn
|
|
1051
|
+
- off
|
|
1052
|
+
type: string
|
|
1053
|
+
- additionalProperties: false
|
|
1054
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1055
|
+
properties:
|
|
1056
|
+
include:
|
|
1057
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1058
|
+
items:
|
|
1059
|
+
type: string
|
|
1060
|
+
type: array
|
|
1061
|
+
severity:
|
|
1062
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1063
|
+
enum:
|
|
1064
|
+
- error
|
|
1065
|
+
- warn
|
|
1066
|
+
- off
|
|
1067
|
+
- null
|
|
736
1068
|
type: string
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
1069
|
+
statements:
|
|
1070
|
+
description: 'Block statement kinds this rule targets. Defaults to every kind: if, for, while, switch, try, guard, loop, with. match is an alias of switch. return is not a block statement. An empty list turns the rule off.'
|
|
1071
|
+
items:
|
|
1072
|
+
description: A block statement kind the rule targets. match is an alias of switch.
|
|
1073
|
+
enum:
|
|
1074
|
+
- if
|
|
1075
|
+
- for
|
|
1076
|
+
- while
|
|
1077
|
+
- switch
|
|
1078
|
+
- match
|
|
1079
|
+
- try
|
|
1080
|
+
- guard
|
|
1081
|
+
- loop
|
|
1082
|
+
- with
|
|
1083
|
+
type: string
|
|
1084
|
+
type: array
|
|
1085
|
+
type: object
|
|
1086
|
+
description: Requires a blank line below a block statement (if, for, while, switch/match, try, guard, loop, with) when another statement follows it in the same block, like C# IDE2003. Works on TypeScript/JavaScript, Python, Swift, Rust and C#; `klint --fix` inserts the line.
|
|
1087
|
+
examples:
|
|
1088
|
+
- 'blank-line-after-block: warn'
|
|
1089
|
+
- |-
|
|
1090
|
+
blank-line-after-block:
|
|
1091
|
+
severity: warn
|
|
1092
|
+
include: ["src/**"]
|
|
1093
|
+
statements: [if, for, while, switch, try, guard, loop, with]
|
|
1094
|
+
blank-line-before-control-flow:
|
|
1095
|
+
anyOf:
|
|
1096
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1097
|
+
enum:
|
|
1098
|
+
- error
|
|
1099
|
+
- warn
|
|
1100
|
+
- off
|
|
1101
|
+
type: string
|
|
1102
|
+
- additionalProperties: false
|
|
1103
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1104
|
+
properties:
|
|
1105
|
+
allowSetup:
|
|
1106
|
+
description: Skip an if, guard or switch statement whose condition uses a name assigned by the statement directly above it. Defaults to true.
|
|
1107
|
+
type: boolean
|
|
1108
|
+
include:
|
|
1109
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1110
|
+
items:
|
|
1111
|
+
type: string
|
|
1112
|
+
type: array
|
|
1113
|
+
severity:
|
|
1114
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1115
|
+
enum:
|
|
1116
|
+
- error
|
|
1117
|
+
- warn
|
|
1118
|
+
- off
|
|
1119
|
+
- null
|
|
764
1120
|
type: string
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
1121
|
+
statements:
|
|
1122
|
+
description: 'Statement kinds this rule targets. Defaults to every kind: if, for, while, switch, try, return, guard, loop, with. match is an alias of switch. An empty list turns the rule off.'
|
|
1123
|
+
items:
|
|
1124
|
+
description: A statement kind the rule targets. match is an alias of switch.
|
|
1125
|
+
enum:
|
|
1126
|
+
- if
|
|
1127
|
+
- for
|
|
1128
|
+
- while
|
|
1129
|
+
- switch
|
|
1130
|
+
- match
|
|
1131
|
+
- try
|
|
1132
|
+
- return
|
|
1133
|
+
- guard
|
|
1134
|
+
- loop
|
|
1135
|
+
- with
|
|
1136
|
+
type: string
|
|
1137
|
+
type: array
|
|
1138
|
+
type: object
|
|
1139
|
+
description: Requires a blank line above a control-flow statement (if, for, while, switch/match, try, return, guard, loop, with) that follows another statement in the same block. Works on TypeScript/JavaScript, Python, Swift, Rust and C#; `klint --fix` inserts the line.
|
|
1140
|
+
examples:
|
|
1141
|
+
- 'blank-line-before-control-flow: error'
|
|
1142
|
+
- |-
|
|
1143
|
+
blank-line-before-control-flow:
|
|
1144
|
+
severity: error
|
|
1145
|
+
include: ["src/**", "!src/generated/**"]
|
|
1146
|
+
statements: [if, for, while, switch, try, return, guard, loop, with]
|
|
1147
|
+
allowSetup: true
|
|
1148
|
+
cognitive-complexity:
|
|
1149
|
+
anyOf:
|
|
1150
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1151
|
+
enum:
|
|
1152
|
+
- error
|
|
1153
|
+
- warn
|
|
1154
|
+
- off
|
|
1155
|
+
type: string
|
|
1156
|
+
- additionalProperties: false
|
|
1157
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1158
|
+
properties:
|
|
1159
|
+
include:
|
|
1160
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1161
|
+
items:
|
|
1162
|
+
type: string
|
|
1163
|
+
type: array
|
|
1164
|
+
max:
|
|
1165
|
+
default: 15
|
|
1166
|
+
description: Highest cognitive complexity a function may have; a function scoring above it is reported. An integer of at least 1. Defaults to 15.
|
|
1167
|
+
format: uint32
|
|
1168
|
+
minimum: 1
|
|
1169
|
+
type: integer
|
|
1170
|
+
severity:
|
|
1171
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1172
|
+
enum:
|
|
1173
|
+
- error
|
|
1174
|
+
- warn
|
|
1175
|
+
- off
|
|
1176
|
+
- null
|
|
796
1177
|
type: string
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
1178
|
+
type: object
|
|
1179
|
+
description: Reports every function whose cognitive complexity is above `max` (default 15), scored like Biome 2.6.5's `noExcessiveCognitiveComplexity` (the SonarSource Cognitive Complexity model). Works on TypeScript/JavaScript, Python, Swift, Rust and C#. Opt-in; no autofix.
|
|
1180
|
+
examples:
|
|
1181
|
+
- 'cognitive-complexity: error'
|
|
1182
|
+
- |-
|
|
1183
|
+
cognitive-complexity:
|
|
1184
|
+
severity: warn
|
|
1185
|
+
include: ["src/**", "!src/generated/**"]
|
|
1186
|
+
max: 14
|
|
1187
|
+
function-length:
|
|
1188
|
+
anyOf:
|
|
1189
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1190
|
+
enum:
|
|
1191
|
+
- error
|
|
1192
|
+
- warn
|
|
1193
|
+
- off
|
|
1194
|
+
type: string
|
|
1195
|
+
- additionalProperties: false
|
|
1196
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1197
|
+
properties:
|
|
1198
|
+
include:
|
|
1199
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1200
|
+
items:
|
|
1201
|
+
type: string
|
|
1202
|
+
type: array
|
|
1203
|
+
max:
|
|
1204
|
+
default: 50
|
|
1205
|
+
description: Highest number of lines a function body may have; a function counting more is reported. An integer of at least 1. Defaults to 50.
|
|
1206
|
+
format: uint32
|
|
1207
|
+
minimum: 1
|
|
1208
|
+
type: integer
|
|
1209
|
+
severity:
|
|
1210
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1211
|
+
enum:
|
|
1212
|
+
- error
|
|
1213
|
+
- warn
|
|
1214
|
+
- off
|
|
1215
|
+
- null
|
|
824
1216
|
type: string
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1217
|
+
skipBlankLines:
|
|
1218
|
+
default: false
|
|
1219
|
+
description: Leave blank lines out of the count. Defaults to false.
|
|
1220
|
+
type: boolean
|
|
1221
|
+
type: object
|
|
1222
|
+
description: 'Reports every function whose body has more than `max` lines (default 50), counted like Biome 2.6.5''s `noExcessiveLinesPerFunction`: brace lines do not count, comment and blank lines do (blank lines not with `skipBlankLines`), and a nested function''s lines count toward its parent. Getters and setters are not checked. Works on TypeScript/JavaScript, Python, Swift, Rust and C#. Opt-in; no autofix.'
|
|
1223
|
+
examples:
|
|
1224
|
+
- 'function-length: error'
|
|
1225
|
+
- |-
|
|
1226
|
+
function-length:
|
|
1227
|
+
severity: warn
|
|
1228
|
+
include: ["src/**", "!src/generated/**"]
|
|
1229
|
+
max: 40
|
|
1230
|
+
skipBlankLines: true
|
|
1231
|
+
no-async-predicate:
|
|
1232
|
+
anyOf:
|
|
1233
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1234
|
+
enum:
|
|
1235
|
+
- error
|
|
1236
|
+
- warn
|
|
1237
|
+
- off
|
|
1238
|
+
type: string
|
|
1239
|
+
- additionalProperties: false
|
|
1240
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1241
|
+
properties:
|
|
1242
|
+
include:
|
|
1243
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1244
|
+
items:
|
|
1245
|
+
type: string
|
|
1246
|
+
type: array
|
|
1247
|
+
severity:
|
|
1248
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1249
|
+
enum:
|
|
1250
|
+
- error
|
|
1251
|
+
- warn
|
|
1252
|
+
- off
|
|
1253
|
+
- null
|
|
852
1254
|
type: string
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1255
|
+
type: object
|
|
1256
|
+
description: Flags `async` functions passed to `.filter`/`.some`/`.every`/`.find`/`.findIndex`. Array methods coerce the returned promise to truthy, so every element appears to match.
|
|
1257
|
+
examples:
|
|
1258
|
+
- 'no-async-predicate: error'
|
|
1259
|
+
no-consecutive-array-push:
|
|
1260
|
+
anyOf:
|
|
1261
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1262
|
+
enum:
|
|
1263
|
+
- error
|
|
1264
|
+
- warn
|
|
1265
|
+
- off
|
|
1266
|
+
type: string
|
|
1267
|
+
- additionalProperties: false
|
|
1268
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1269
|
+
properties:
|
|
1270
|
+
include:
|
|
1271
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1272
|
+
items:
|
|
1273
|
+
type: string
|
|
1274
|
+
type: array
|
|
1275
|
+
severity:
|
|
1276
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1277
|
+
enum:
|
|
1278
|
+
- error
|
|
1279
|
+
- warn
|
|
1280
|
+
- off
|
|
1281
|
+
- null
|
|
880
1282
|
type: string
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1283
|
+
type: object
|
|
1284
|
+
description: Flags consecutive `arr.push(x); arr.push(y);` calls — combine into `arr.push(x, y)` or `arr.push(...items)`.
|
|
1285
|
+
examples:
|
|
1286
|
+
- 'no-consecutive-array-push: warn'
|
|
1287
|
+
no-nested-template-literals:
|
|
1288
|
+
anyOf:
|
|
1289
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1290
|
+
enum:
|
|
1291
|
+
- error
|
|
1292
|
+
- warn
|
|
1293
|
+
- off
|
|
1294
|
+
type: string
|
|
1295
|
+
- additionalProperties: false
|
|
1296
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1297
|
+
properties:
|
|
1298
|
+
include:
|
|
1299
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1300
|
+
items:
|
|
1301
|
+
type: string
|
|
1302
|
+
type: array
|
|
1303
|
+
severity:
|
|
1304
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1305
|
+
enum:
|
|
1306
|
+
- error
|
|
1307
|
+
- warn
|
|
1308
|
+
- off
|
|
1309
|
+
- null
|
|
908
1310
|
type: string
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1311
|
+
type: object
|
|
1312
|
+
description: Flags template literals nested inside template literals — almost always unreadable; extract to a variable.
|
|
1313
|
+
examples:
|
|
1314
|
+
- 'no-nested-template-literals: warn'
|
|
1315
|
+
no-string-match:
|
|
1316
|
+
anyOf:
|
|
1317
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1318
|
+
enum:
|
|
1319
|
+
- error
|
|
1320
|
+
- warn
|
|
1321
|
+
- off
|
|
1322
|
+
type: string
|
|
1323
|
+
- additionalProperties: false
|
|
1324
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1325
|
+
properties:
|
|
1326
|
+
include:
|
|
1327
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1328
|
+
items:
|
|
1329
|
+
type: string
|
|
1330
|
+
type: array
|
|
1331
|
+
severity:
|
|
1332
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1333
|
+
enum:
|
|
1334
|
+
- error
|
|
1335
|
+
- warn
|
|
1336
|
+
- off
|
|
1337
|
+
- null
|
|
936
1338
|
type: string
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1339
|
+
type: object
|
|
1340
|
+
description: Flags `String#match` — prefer `.matchAll()` for iteration or `.test()` for boolean checks. `.match()` returns different shapes depending on the `/g` flag.
|
|
1341
|
+
examples:
|
|
1342
|
+
- 'no-string-match: error'
|
|
1343
|
+
no-sync-in-async:
|
|
1344
|
+
anyOf:
|
|
1345
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1346
|
+
enum:
|
|
1347
|
+
- error
|
|
1348
|
+
- warn
|
|
1349
|
+
- off
|
|
1350
|
+
type: string
|
|
1351
|
+
- additionalProperties: false
|
|
1352
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1353
|
+
properties:
|
|
1354
|
+
include:
|
|
1355
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1356
|
+
items:
|
|
1357
|
+
type: string
|
|
1358
|
+
type: array
|
|
1359
|
+
severity:
|
|
1360
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1361
|
+
enum:
|
|
1362
|
+
- error
|
|
1363
|
+
- warn
|
|
1364
|
+
- off
|
|
1365
|
+
- null
|
|
964
1366
|
type: string
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1367
|
+
type: object
|
|
1368
|
+
description: Flags synchronous I/O (`readFileSync`, `execSync`, etc.) inside async functions — blocks the event loop when an async equivalent is available.
|
|
1369
|
+
examples:
|
|
1370
|
+
- 'no-sync-in-async: error'
|
|
1371
|
+
- |-
|
|
1372
|
+
no-sync-in-async:
|
|
1373
|
+
severity: warn
|
|
1374
|
+
include: ["src/server/**"]
|
|
1375
|
+
no-unguarded-json-parse:
|
|
1376
|
+
anyOf:
|
|
1377
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1378
|
+
enum:
|
|
1379
|
+
- error
|
|
1380
|
+
- warn
|
|
1381
|
+
- off
|
|
1382
|
+
type: string
|
|
1383
|
+
- additionalProperties: false
|
|
1384
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1385
|
+
properties:
|
|
1386
|
+
include:
|
|
1387
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1388
|
+
items:
|
|
1389
|
+
type: string
|
|
1390
|
+
type: array
|
|
1391
|
+
severity:
|
|
1392
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1393
|
+
enum:
|
|
1394
|
+
- error
|
|
1395
|
+
- warn
|
|
1396
|
+
- off
|
|
1397
|
+
- null
|
|
1398
|
+
type: string
|
|
1399
|
+
type: object
|
|
1400
|
+
description: Flags `JSON.parse()` calls that aren't wrapped in try/catch — malformed input crashes the process.
|
|
1401
|
+
examples:
|
|
1402
|
+
- 'no-unguarded-json-parse: error'
|
|
1403
|
+
sonar/no-single-char-class:
|
|
1404
|
+
anyOf:
|
|
1405
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1406
|
+
enum:
|
|
1407
|
+
- error
|
|
1408
|
+
- warn
|
|
1409
|
+
- off
|
|
1410
|
+
type: string
|
|
1411
|
+
- additionalProperties: false
|
|
1412
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1413
|
+
properties:
|
|
1414
|
+
include:
|
|
1415
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1416
|
+
items:
|
|
1417
|
+
type: string
|
|
1418
|
+
type: array
|
|
1419
|
+
severity:
|
|
1420
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1421
|
+
enum:
|
|
1422
|
+
- error
|
|
1423
|
+
- warn
|
|
1424
|
+
- off
|
|
1425
|
+
- null
|
|
1426
|
+
type: string
|
|
1427
|
+
type: object
|
|
1428
|
+
description: Flags single-character character classes in regex (e.g. `/[a]/`) — drop the brackets; the regex matches the same.
|
|
1429
|
+
examples:
|
|
1430
|
+
- 'sonar/no-single-char-class: warn'
|
|
1431
|
+
sonar/prefer-at:
|
|
1432
|
+
anyOf:
|
|
1433
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1434
|
+
enum:
|
|
1435
|
+
- error
|
|
1436
|
+
- warn
|
|
1437
|
+
- off
|
|
1438
|
+
type: string
|
|
1439
|
+
- additionalProperties: false
|
|
1440
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1441
|
+
properties:
|
|
1442
|
+
include:
|
|
1443
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1444
|
+
items:
|
|
1445
|
+
type: string
|
|
1446
|
+
type: array
|
|
1447
|
+
severity:
|
|
1448
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1449
|
+
enum:
|
|
1450
|
+
- error
|
|
1451
|
+
- warn
|
|
1452
|
+
- off
|
|
1453
|
+
- null
|
|
1454
|
+
type: string
|
|
1455
|
+
type: object
|
|
1456
|
+
description: Flags negative-index access via `arr[arr.length - 1]` — `.at(-1)` reads cleaner for last-element access.
|
|
1457
|
+
examples:
|
|
1458
|
+
- 'sonar/prefer-at: warn'
|
|
1459
|
+
sonar/prefer-nullish-coalescing-assign:
|
|
1460
|
+
anyOf:
|
|
1461
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1462
|
+
enum:
|
|
1463
|
+
- error
|
|
1464
|
+
- warn
|
|
1465
|
+
- off
|
|
1466
|
+
type: string
|
|
1467
|
+
- additionalProperties: false
|
|
1468
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1469
|
+
properties:
|
|
1470
|
+
include:
|
|
1471
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1472
|
+
items:
|
|
1473
|
+
type: string
|
|
1474
|
+
type: array
|
|
1475
|
+
severity:
|
|
1476
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1477
|
+
enum:
|
|
1478
|
+
- error
|
|
1479
|
+
- warn
|
|
1480
|
+
- off
|
|
1481
|
+
- null
|
|
1482
|
+
type: string
|
|
1483
|
+
type: object
|
|
1484
|
+
description: Flags explicit nullish assignment guards — `x ??= y` is the dedicated nullish assignment operator.
|
|
1485
|
+
examples:
|
|
1486
|
+
- 'sonar/prefer-nullish-coalescing-assign: warn'
|
|
1487
|
+
sonar/prefer-string-raw:
|
|
1488
|
+
anyOf:
|
|
1489
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1490
|
+
enum:
|
|
1491
|
+
- error
|
|
1492
|
+
- warn
|
|
1493
|
+
- off
|
|
1494
|
+
type: string
|
|
1495
|
+
- additionalProperties: false
|
|
1496
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1497
|
+
properties:
|
|
1498
|
+
include:
|
|
1499
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1500
|
+
items:
|
|
1501
|
+
type: string
|
|
1502
|
+
type: array
|
|
1503
|
+
severity:
|
|
1504
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1505
|
+
enum:
|
|
1506
|
+
- error
|
|
1507
|
+
- warn
|
|
1508
|
+
- off
|
|
1509
|
+
- null
|
|
1510
|
+
type: string
|
|
1511
|
+
type: object
|
|
1512
|
+
description: Flags string literals with multiple backslash escapes — `String.raw` is more readable (Windows paths, regex source, etc.).
|
|
1513
|
+
examples:
|
|
1514
|
+
- 'sonar/prefer-string-raw: warn'
|
|
1515
|
+
sonar/prefer-string-raw-regexp:
|
|
1516
|
+
anyOf:
|
|
1517
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1518
|
+
enum:
|
|
1519
|
+
- error
|
|
1520
|
+
- warn
|
|
1521
|
+
- off
|
|
1522
|
+
type: string
|
|
1523
|
+
- additionalProperties: false
|
|
1524
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1525
|
+
properties:
|
|
1526
|
+
include:
|
|
1527
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1528
|
+
items:
|
|
1529
|
+
type: string
|
|
1530
|
+
type: array
|
|
1531
|
+
severity:
|
|
1532
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1533
|
+
enum:
|
|
1534
|
+
- error
|
|
1535
|
+
- warn
|
|
1536
|
+
- off
|
|
1537
|
+
- null
|
|
1538
|
+
type: string
|
|
1539
|
+
type: object
|
|
1540
|
+
description: Flags regex literals built from escape-heavy string concatenation — `String.raw` drops the double backslashes.
|
|
1541
|
+
examples:
|
|
1542
|
+
- 'sonar/prefer-string-raw-regexp: warn'
|
|
1543
|
+
sonar/prefer-string-replaceall:
|
|
1544
|
+
anyOf:
|
|
1545
|
+
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1546
|
+
enum:
|
|
1547
|
+
- error
|
|
1548
|
+
- warn
|
|
1549
|
+
- off
|
|
1550
|
+
type: string
|
|
1551
|
+
- additionalProperties: false
|
|
1552
|
+
description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
|
|
1553
|
+
properties:
|
|
1554
|
+
include:
|
|
1555
|
+
description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
|
|
1556
|
+
items:
|
|
1557
|
+
type: string
|
|
1558
|
+
type: array
|
|
1559
|
+
severity:
|
|
1560
|
+
description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
|
|
1561
|
+
enum:
|
|
1562
|
+
- error
|
|
1563
|
+
- warn
|
|
1564
|
+
- off
|
|
1565
|
+
- null
|
|
1566
|
+
type: string
|
|
1567
|
+
type: object
|
|
1568
|
+
description: Flags `.replace(/x/g, y)` on strings — `.replaceAll('x', y)` is clearer and faster for all-occurrence replacements.
|
|
1569
|
+
examples:
|
|
1570
|
+
- 'sonar/prefer-string-replaceall: error'
|
|
1571
|
+
type: object
|
|
1572
|
+
default: null
|
|
1573
|
+
description: 'Rules, in groups: recommended (true enables the six sonar rules at error), core (built-in rules) and sonar (sonar rules, without the sonar/ prefix). Example: { "recommended": true, "core": { "no-string-match": "error" }, "sonar": { "prefer-at": "warn" } }. The v1 flat map (rule name → severity or options, sonar/ prefixed) is still read; run `klint migrate` to upgrade it.'
|
|
979
1574
|
type: object
|