@konvert7/klint 1.3.1 → 1.4.1

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/klint.schema.yaml CHANGED
@@ -1,4 +1,4 @@
1
- $id: https://raw.githubusercontent.com/konvert7/klint/refs/tags/v1.3.1/klint.schema.json
1
+ $id: https://raw.githubusercontent.com/konvert7/klint/refs/tags/v1.4.1/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: 'Named rule bundles to enable. Each plugin applies a default set of rules at "error" severity. Individual rules from the bundle can be overridden or silenced via the rules map. Available: "sonar".'
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
- additionalProperties:
426
- anyOf:
427
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
428
- enum:
429
- - error
430
- - warn
431
- - off
432
- type: string
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
- statements:
477
- 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.'
478
- items:
479
- description: A block statement kind the rule targets. match is an alias of switch.
480
- enum:
481
- - if
482
- - for
483
- - while
484
- - switch
485
- - match
486
- - try
487
- - guard
488
- - loop
489
- - with
490
- type: string
491
- type: array
492
- type: object
493
- 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.
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
- allowSetup:
513
- description: Skip an if, guard or switch statement whose condition uses a name assigned by the statement directly above it. Defaults to true.
514
- type: boolean
515
- include:
516
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
517
- items:
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
- type: array
520
- severity:
521
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
522
- enum:
523
- - error
524
- - warn
525
- - off
526
- - null
527
- type: string
528
- statements:
529
- 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.'
530
- items:
531
- description: A statement kind the rule targets. match is an alias of switch.
532
- enum:
533
- - if
534
- - for
535
- - while
536
- - switch
537
- - match
538
- - try
539
- - return
540
- - guard
541
- - loop
542
- - with
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
- type: array
545
- type: object
546
- 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.
547
- examples:
548
- - 'blank-line-before-control-flow: error'
549
- - |-
550
- blank-line-before-control-flow:
551
- severity: error
552
- include: ["src/**", "!src/generated/**"]
553
- statements: [if, for, while, switch, try, return, guard, loop, with]
554
- allowSetup: true
555
- cognitive-complexity:
556
- anyOf:
557
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
558
- enum:
559
- - error
560
- - warn
561
- - off
562
- type: string
563
- - additionalProperties: false
564
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
565
- properties:
566
- include:
567
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
568
- items:
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
- type: array
571
- max:
572
- default: 15
573
- description: Highest cognitive complexity a function may have; a function scoring above it is reported. An integer of at least 1. Defaults to 15.
574
- format: uint32
575
- minimum: 1
576
- type: integer
577
- severity:
578
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
579
- enum:
580
- - error
581
- - warn
582
- - off
583
- - null
584
- type: string
585
- type: object
586
- 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.
587
- examples:
588
- - 'cognitive-complexity: error'
589
- - |-
590
- cognitive-complexity:
591
- severity: warn
592
- include: ["src/**", "!src/generated/**"]
593
- max: 14
594
- function-length:
595
- anyOf:
596
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
597
- enum:
598
- - error
599
- - warn
600
- - off
601
- type: string
602
- - additionalProperties: false
603
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
604
- properties:
605
- include:
606
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
607
- items:
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 `eslint-plugin-sonarjs` 3.0.5's `cognitive-complexity` (SonarSource rule S3776). 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
- type: array
610
- max:
611
- default: 50
612
- 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.
613
- format: uint32
614
- minimum: 1
615
- type: integer
616
- severity:
617
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
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
- skipBlankLines:
625
- default: false
626
- description: Leave blank lines out of the count. Defaults to false.
627
- type: boolean
628
- type: object
629
- 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.'
630
- examples:
631
- - 'function-length: error'
632
- - |-
633
- function-length:
634
- severity: warn
635
- include: ["src/**", "!src/generated/**"]
636
- max: 40
637
- skipBlankLines: true
638
- no-async-predicate:
639
- anyOf:
640
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
641
- enum:
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
- include:
650
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
651
- items:
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
- type: array
654
- severity:
655
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
656
- enum:
657
- - error
658
- - warn
659
- - off
660
- - null
661
- type: string
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
- 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.
664
- examples:
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
- description: Flags consecutive `arr.push(x); arr.push(y);` calls — combine into `arr.push(x, y)` or `arr.push(...items)`.
692
- examples:
693
- - 'no-consecutive-array-push: warn'
694
- no-nested-template-literals:
695
- anyOf:
696
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
697
- enum:
698
- - error
699
- - warn
700
- - off
701
- type: string
702
- - additionalProperties: false
703
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
704
- properties:
705
- include:
706
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
707
- items:
708
- type: string
709
- type: array
710
- severity:
711
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
712
- enum:
713
- - error
714
- - warn
715
- - off
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
- type: array
738
- severity:
739
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
740
- enum:
741
- - error
742
- - warn
743
- - off
744
- - null
745
- type: string
746
- type: object
747
- description: Flags `String#match` — prefer `.matchAll()` for iteration or `.test()` for boolean checks. `.match()` returns different shapes depending on the `/g` flag.
748
- examples:
749
- - 'no-string-match: error'
750
- no-sync-in-async:
751
- anyOf:
752
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
753
- enum:
754
- - error
755
- - warn
756
- - off
757
- type: string
758
- - additionalProperties: false
759
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
760
- properties:
761
- include:
762
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
763
- items:
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
- type: array
766
- severity:
767
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
768
- enum:
769
- - error
770
- - warn
771
- - off
772
- - null
773
- type: string
774
- type: object
775
- description: Flags synchronous I/O (`readFileSync`, `execSync`, etc.) inside async functions — blocks the event loop when an async equivalent is available.
776
- examples:
777
- - 'no-sync-in-async: error'
778
- - |-
779
- no-sync-in-async:
780
- severity: warn
781
- include: ["src/server/**"]
782
- no-unguarded-json-parse:
783
- anyOf:
784
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
785
- enum:
786
- - error
787
- - warn
788
- - off
789
- type: string
790
- - additionalProperties: false
791
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
792
- properties:
793
- include:
794
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
795
- items:
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
- type: array
798
- severity:
799
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
800
- enum:
801
- - error
802
- - warn
803
- - off
804
- - null
805
- type: string
806
- type: object
807
- description: Flags `JSON.parse()` calls that aren't wrapped in try/catch — malformed input crashes the process.
808
- examples:
809
- - 'no-unguarded-json-parse: error'
810
- sonar/no-single-char-class:
811
- anyOf:
812
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
813
- enum:
814
- - error
815
- - warn
816
- - off
817
- type: string
818
- - additionalProperties: false
819
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
820
- properties:
821
- include:
822
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
823
- items:
1178
+ type: object
1179
+ description: Reports every function whose cognitive complexity is above `max` (default 15), scored like `eslint-plugin-sonarjs` 3.0.5's `cognitive-complexity` (SonarSource rule S3776). 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
- type: array
826
- severity:
827
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
828
- enum:
829
- - error
830
- - warn
831
- - off
832
- - null
833
- type: string
834
- type: object
835
- description: Flags single-character character classes in regex (e.g. `/[a]/`) — drop the brackets; the regex matches the same.
836
- examples:
837
- - 'sonar/no-single-char-class: warn'
838
- sonar/prefer-at:
839
- anyOf:
840
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
841
- enum:
842
- - error
843
- - warn
844
- - off
845
- type: string
846
- - additionalProperties: false
847
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
848
- properties:
849
- include:
850
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
851
- items:
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
- type: array
854
- severity:
855
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
856
- enum:
857
- - error
858
- - warn
859
- - off
860
- - null
861
- type: string
862
- type: object
863
- description: Flags negative-index access via `arr[arr.length - 1]` — `.at(-1)` reads cleaner for last-element access.
864
- examples:
865
- - 'sonar/prefer-at: warn'
866
- sonar/prefer-nullish-coalescing-assign:
867
- anyOf:
868
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
869
- enum:
870
- - error
871
- - warn
872
- - off
873
- type: string
874
- - additionalProperties: false
875
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
876
- properties:
877
- include:
878
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
879
- items:
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
- type: array
882
- severity:
883
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
884
- enum:
885
- - error
886
- - warn
887
- - off
888
- - null
889
- type: string
890
- type: object
891
- description: Flags explicit nullish assignment guards — `x ??= y` is the dedicated nullish assignment operator.
892
- examples:
893
- - 'sonar/prefer-nullish-coalescing-assign: warn'
894
- sonar/prefer-string-raw:
895
- anyOf:
896
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
897
- enum:
898
- - error
899
- - warn
900
- - off
901
- type: string
902
- - additionalProperties: false
903
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
904
- properties:
905
- include:
906
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
907
- items:
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
- type: array
910
- severity:
911
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
912
- enum:
913
- - error
914
- - warn
915
- - off
916
- - null
917
- type: string
918
- type: object
919
- description: Flags string literals with multiple backslash escapes — `String.raw` is more readable (Windows paths, regex source, etc.).
920
- examples:
921
- - 'sonar/prefer-string-raw: warn'
922
- sonar/prefer-string-raw-regexp:
923
- anyOf:
924
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
925
- enum:
926
- - error
927
- - warn
928
- - off
929
- type: string
930
- - additionalProperties: false
931
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
932
- properties:
933
- include:
934
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
935
- items:
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
- type: array
938
- severity:
939
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
940
- enum:
941
- - error
942
- - warn
943
- - off
944
- - null
945
- type: string
946
- type: object
947
- description: Flags regex literals built from escape-heavy string concatenation — `String.raw` drops the double backslashes.
948
- examples:
949
- - 'sonar/prefer-string-raw-regexp: warn'
950
- sonar/prefer-string-replaceall:
951
- anyOf:
952
- - description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
953
- enum:
954
- - error
955
- - warn
956
- - off
957
- type: string
958
- - additionalProperties: false
959
- description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
960
- properties:
961
- include:
962
- description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**", "!src/hooks/scripts/**"]'
963
- items:
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
- type: array
966
- severity:
967
- description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
968
- enum:
969
- - error
970
- - warn
971
- - off
972
- - null
973
- type: string
974
- type: object
975
- description: Flags `.replace(/x/g, y)` on strings — `.replaceAll('x', y)` is clearer and faster for all-occurrence replacements.
976
- examples:
977
- - 'sonar/prefer-string-replaceall: error'
978
- type: object
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