@@ -468,10 +468,14 @@ describe("blockESLint", () => {
468
468
specifier : "c" ,
469
469
} ,
470
470
] ,
471
- rules : {
472
- "a/b" : "error" ,
473
- "a/c" : [ "error" , { d : "e" } ] ,
474
- } ,
471
+ rules : [
472
+ {
473
+ entries : {
474
+ "a/b" : "error" ,
475
+ "a/c" : [ "error" , { d : "e" } ] ,
476
+ } ,
477
+ } ,
478
+ ] ,
475
479
settings : {
476
480
react : {
477
481
version : "detect" ,
@@ -596,7 +600,149 @@ describe("blockESLint", () => {
596
600
{ ignores: ["generated", "lib", "node_modules", "pnpm-lock.yaml"] },
597
601
{ linterOptions: {"reportUnusedDisableDirectives":"error"} },
598
602
eslint.configs.recommended,
599
- a.configs.recommended,{ extends: [b.configs.recommended], files: ["**/*.b"], rules: {"b/c":"error","b/d":["error",{"e":"f"}]}, },{ extends: [c.configs.recommended], rules: {"c/d":"error","c/e":["error",{"f":"g"}]}, },{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, rules: {"a/b":"error","a/c":["error",{"d":"e"}]}, settings: {"react":{"version":"detect"}}, }
603
+ a.configs.recommended,{ extends: [b.configs.recommended], files: ["**/*.b"], rules: {"b/c":"error","b/d":["error",{"e":"f"}]}, },{ extends: [c.configs.recommended], rules: {"c/d":"error","c/e":["error",{"f":"g"}]}, },{ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, rules: {"a/b": "error","a/c": ["error",{"d":"e"}],}, settings: {"react":{"version":"detect"}}, }
604
+ );",
605
+ },
606
+ "scripts": [
607
+ {
608
+ "commands": [
609
+ "pnpm lint --fix",
610
+ ],
611
+ "phase": 3,
612
+ },
613
+ ],
614
+ }
615
+ ` ) ;
616
+ } ) ;
617
+
618
+ test ( "with identical addon rules comments" , ( ) => {
619
+ const creation = testBlock ( blockESLint , {
620
+ addons : {
621
+ rules : [
622
+ {
623
+ comment : "Duplicated comment" ,
624
+ entries : { a : "error" } ,
625
+ } ,
626
+ {
627
+ comment : "Standalone comment" ,
628
+ entries : { b : "error" } ,
629
+ } ,
630
+ {
631
+ comment : "Duplicated comment" ,
632
+ entries : { c : "error" } ,
633
+ } ,
634
+ ] ,
635
+ } ,
636
+ options : optionsBase ,
637
+ } ) ;
638
+
639
+ expect ( creation ) . toMatchInlineSnapshot ( `
640
+ {
641
+ "addons": [
642
+ {
643
+ "addons": {
644
+ "sections": {
645
+ "Linting": {
646
+ "contents": {
647
+ "after": [
648
+ "
649
+ For example, ESLint can be run with \`--fix\` to auto-fix some lint rule complaints:
650
+
651
+ \`\`\`shell
652
+ pnpm run lint --fix
653
+ \`\`\`
654
+ ",
655
+ ],
656
+ "before": "
657
+ This package includes several forms of linting to enforce consistent code quality and styling.
658
+ Each should be shown in VS Code, and can be run manually on the command-line:
659
+ ",
660
+ "items": [
661
+ "- \`pnpm lint\` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files",
662
+ ],
663
+ "plural": "Read the individual documentation for each linter to understand how it can be configured and used best.",
664
+ },
665
+ },
666
+ },
667
+ },
668
+ "block": [Function],
669
+ },
670
+ {
671
+ "addons": {
672
+ "jobs": [
673
+ {
674
+ "name": "Lint",
675
+ "steps": [
676
+ {
677
+ "run": "pnpm lint",
678
+ },
679
+ ],
680
+ },
681
+ ],
682
+ },
683
+ "block": [Function],
684
+ },
685
+ {
686
+ "addons": {
687
+ "properties": {
688
+ "devDependencies": {
689
+ "@eslint/js": "9.22.0",
690
+ "@types/node": "22.13.10",
691
+ "eslint": "9.22.0",
692
+ "typescript-eslint": "8.26.1",
693
+ },
694
+ "scripts": {
695
+ "lint": "eslint . --max-warnings 0",
696
+ },
697
+ },
698
+ },
699
+ "block": [Function],
700
+ },
701
+ {
702
+ "addons": {
703
+ "extensions": [
704
+ "dbaeumer.vscode-eslint",
705
+ ],
706
+ "settings": {
707
+ "editor.codeActionsOnSave": {
708
+ "source.fixAll.eslint": "explicit",
709
+ },
710
+ "eslint.probe": [
711
+ "javascript",
712
+ "javascriptreact",
713
+ "json",
714
+ "jsonc",
715
+ "markdown",
716
+ "typescript",
717
+ "typescriptreact",
718
+ "yaml",
719
+ ],
720
+ "eslint.rules.customizations": [
721
+ {
722
+ "rule": "*",
723
+ "severity": "warn",
724
+ },
725
+ ],
726
+ },
727
+ },
728
+ "block": [Function],
729
+ },
730
+ ],
731
+ "files": {
732
+ "eslint.config.js": "import eslint from "@eslint/js";
733
+ import tseslint from "typescript-eslint";
734
+
735
+ export default tseslint.config(
736
+ { ignores: ["lib", "node_modules", "pnpm-lock.yaml"] },
737
+ { linterOptions: {"reportUnusedDisableDirectives":"error"} },
738
+ eslint.configs.recommended,
739
+ { extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked], files: ["**/*.{js,ts}"], languageOptions: {"parserOptions":{"projectService":{"allowDefaultProject":["*.config.*s"]},"tsconfigRootDir":import.meta.dirname}}, rules: {
740
+
741
+ // Duplicated comment
742
+ "a": "error","c": "error",
743
+
744
+ // Standalone comment
745
+ "b": "error",}, }
600
746
);",
601
747
},
602
748
"scripts": [
0 commit comments