@component-hook/eslint-plugin 1.4.4 → 1.5.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/dist/index.mjs CHANGED
@@ -21,10 +21,9 @@ import pluginDeMorgan from "eslint-plugin-de-morgan";
21
21
  import pluginPerfectionist from "eslint-plugin-perfectionist";
22
22
  import pluginJsdoc from "eslint-plugin-jsdoc";
23
23
  import pluginJsonc from "eslint-plugin-jsonc";
24
- import parserJsonc from "jsonc-eslint-parser";
24
+ import { parseForESLint } from "jsonc-eslint-parser";
25
25
  import pluginYaml from "eslint-plugin-yml";
26
26
  import { defineConfig } from "eslint/config";
27
-
28
27
  //#region configs/comments.ts
29
28
  const commentsConfigs = [{
30
29
  ...configComments.recommended,
@@ -33,14 +32,12 @@ const commentsConfigs = [{
33
32
  name: "component-hook/comments",
34
33
  rules: { "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }] }
35
34
  }];
36
-
37
35
  //#endregion
38
36
  //#region configs/de-morgan.ts
39
37
  const deMorganConfig = {
40
38
  ...pluginDeMorgan.configs.recommended,
41
39
  name: "component-hook/de-morgan"
42
40
  };
43
-
44
41
  //#endregion
45
42
  //#region configs/ignores.ts
46
43
  const ignores = {
@@ -64,6 +61,7 @@ const ignores = {
64
61
  "**/.idea",
65
62
  "**/.output",
66
63
  "**/.vite-inspect",
64
+ "**/.context",
67
65
  "**/.nitro",
68
66
  "**/CHANGELOG*.md",
69
67
  "**/*.min.*",
@@ -77,17 +75,17 @@ const ignores = {
77
75
  "**/mockServiceWorker.js"
78
76
  ]
79
77
  };
80
-
81
78
  //#endregion
82
79
  //#region constants.ts
83
80
  const SRC = "**/*.?([cm])[jt]s?(x)";
84
81
  const SRC_EXT = "?([cm])[jt]s?(x)";
82
+ const JSX = "**/*.jsx";
83
+ const TSX = "**/*.tsx";
85
84
  const VUE = "**/*.vue";
86
85
  const BLOB_JSON = "**/*.json";
87
86
  const JSON5 = "**/*.json5";
88
87
  const JSONC = "**/*.jsonc";
89
88
  const RESTRICTED_SYNTAX = ["ForInStatement", "LabeledStatement"];
90
-
91
89
  //#endregion
92
90
  //#region configs/import.ts
93
91
  const plugins$2 = {
@@ -128,7 +126,6 @@ const importConfigs = [{
128
126
  languageOptions,
129
127
  rules: { "import/no-default-export": "off" }
130
128
  }];
131
-
132
129
  //#endregion
133
130
  //#region configs/javascript.ts
134
131
  const jsConfigs = [{
@@ -168,7 +165,6 @@ const jsConfigs = [{
168
165
  }
169
166
  }
170
167
  }];
171
-
172
168
  //#endregion
173
169
  //#region configs/jsdoc.ts
174
170
  const jsdocConfig = {
@@ -192,9 +188,12 @@ const jsdocConfig = {
192
188
  "jsdoc/require-yields-check": "warn"
193
189
  }
194
190
  };
195
-
196
191
  //#endregion
197
192
  //#region configs/jsonc.ts
193
+ const recommendedRules$1 = pluginJsonc.configs["recommended-with-jsonc"].map((config) => config.rules).reduce((acc, rules) => ({
194
+ ...acc,
195
+ ...rules
196
+ }), {});
198
197
  const jsoncConfigs = [
199
198
  {
200
199
  name: "component-hook/jsonc",
@@ -203,10 +202,11 @@ const jsoncConfigs = [
203
202
  JSON5,
204
203
  JSONC
205
204
  ],
205
+ language: "jsonc/x",
206
206
  plugins: { jsonc: pluginJsonc },
207
- languageOptions: { parser: parserJsonc },
207
+ languageOptions: { parser: parseForESLint },
208
208
  rules: {
209
- ...pluginJsonc.configs["recommended-with-jsonc"].rules,
209
+ ...recommendedRules$1,
210
210
  "jsonc/quote-props": "off",
211
211
  "jsonc/quotes": "off"
212
212
  }
@@ -259,6 +259,7 @@ const jsoncConfigs = [
259
259
  "peerDependencies",
260
260
  "peerDependenciesMeta",
261
261
  "dependencies",
262
+ "inlinedDependencies",
262
263
  "optionalDependencies",
263
264
  "devDependencies",
264
265
  "pnpm",
@@ -408,7 +409,6 @@ const jsoncConfigs = [
408
409
  ] }
409
410
  }
410
411
  ];
411
-
412
412
  //#endregion
413
413
  //#region configs/markdown.ts
414
414
  const markdownConfigs = [...pluginMarkdown.configs.processor.map((config) => ({
@@ -436,10 +436,10 @@ const markdownConfigs = [...pluginMarkdown.configs.processor.map((config) => ({
436
436
  "sonarjs/unused-import": "off",
437
437
  "sonarjs/no-unused-vars": "off",
438
438
  "unicorn/no-useless-undefined": "off",
439
- "unicorn/no-anonymous-default-export": "off"
439
+ "unicorn/no-anonymous-default-export": "off",
440
+ "unicorn/no-top-level-side-effects": "off"
440
441
  }
441
442
  }];
442
-
443
443
  //#endregion
444
444
  //#region configs/perfectionist.ts
445
445
  const perfectionistConfig = {
@@ -474,18 +474,15 @@ const perfectionistConfig = {
474
474
  }]
475
475
  }
476
476
  };
477
-
478
477
  //#endregion
479
478
  //#region configs/playwright.ts
480
479
  const playwrightConfig = {
481
480
  ...pluginPlaywright.configs["flat/recommended"],
482
481
  name: "component-hook/playwright"
483
482
  };
484
-
485
483
  //#endregion
486
484
  //#region configs/prettier.ts
487
- const rules$1 = { ...pluginPrettierRecommended.rules };
488
- delete rules$1["vue/html-self-closing"];
485
+ const rules$1 = Object.fromEntries(Object.entries(pluginPrettierRecommended.rules ?? {}).filter(([name]) => name !== "vue/html-self-closing"));
489
486
  const prettierConfig = {
490
487
  name: "component-hook/prettier",
491
488
  plugins: { prettier: pluginPrettier },
@@ -494,7 +491,6 @@ const prettierConfig = {
494
491
  "prettier/prettier": "warn"
495
492
  }
496
493
  };
497
-
498
494
  //#endregion
499
495
  //#region configs/react.ts
500
496
  const reactConfigs = [
@@ -516,16 +512,19 @@ const reactConfigs = [
516
512
  {
517
513
  ...pluginJsxA11y.flatConfigs.recommended,
518
514
  name: "component-hook/jsx-a11y"
515
+ },
516
+ {
517
+ name: "component-hook/react/components",
518
+ files: [TSX, JSX],
519
+ rules: { "unicorn/no-anonymous-default-export": "off" }
519
520
  }
520
521
  ];
521
-
522
522
  //#endregion
523
523
  //#region configs/regexp.ts
524
524
  const regexpConfig = {
525
525
  ...pluginRegexp.configs["flat/recommended"],
526
526
  name: "component-hook/regexp"
527
527
  };
528
-
529
528
  //#endregion
530
529
  //#region configs/security.ts
531
530
  const securityConfig = {
@@ -536,7 +535,6 @@ const securityConfig = {
536
535
  "security/detect-object-injection": "off"
537
536
  }
538
537
  };
539
-
540
538
  //#endregion
541
539
  //#region configs/sonarjs.ts
542
540
  const plugins$1 = { sonarjs: pluginSonarjs };
@@ -560,7 +558,6 @@ const sonarjsConfigs = [{
560
558
  },
561
559
  settings
562
560
  }];
563
-
564
561
  //#endregion
565
562
  //#region configs/testing-library.ts
566
563
  const configs$1 = pluginTestingLibrary.configs;
@@ -590,7 +587,6 @@ const testingLibraryMarkoConfig = {
590
587
  plugins,
591
588
  rules: { ...configs$1["flat/marko"].rules }
592
589
  };
593
-
594
590
  //#endregion
595
591
  //#region configs/typescript.ts
596
592
  const typescriptCoreConfig = defineConfig({
@@ -638,7 +634,6 @@ const typescriptConfigs = [...typescriptCoreConfig, {
638
634
  "unused-imports/no-unused-vars": "off"
639
635
  }
640
636
  }];
641
-
642
637
  //#endregion
643
638
  //#region configs/unicorn.ts
644
639
  const unicornConfigs = [
@@ -649,21 +644,26 @@ const unicornConfigs = [
649
644
  {
650
645
  name: "component-hook/unicorn",
651
646
  rules: {
652
- "unicorn/catch-error-name": "error",
653
- "unicorn/consistent-empty-array-spread": "error",
647
+ "unicorn/consistent-arrow-return-style": "off",
654
648
  "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
655
- "unicorn/custom-error-definition": "error",
656
649
  "unicorn/filename-case": ["error", {
657
650
  cases: {
658
651
  kebabCase: true,
659
652
  pascalCase: true
660
653
  },
661
- ignore: [/^[A-Z]+\..*$/, /import_map\.json/]
654
+ ignore: [
655
+ /^[A-Z]+\..*$/,
656
+ /^[a-z]{2}-[A-Za-z]{2}(\.\w+)?$/,
657
+ /import_map\.json/
658
+ ]
662
659
  }],
663
660
  "unicorn/import-style": "off",
664
661
  "unicorn/no-abusive-eslint-disable": "off",
665
662
  "unicorn/no-array-for-each": "off",
663
+ "unicorn/no-barrel-files": "off",
664
+ "unicorn/no-duplicate-set-values": "error",
666
665
  "unicorn/no-empty-file": "off",
666
+ "unicorn/no-for-each": "off",
667
667
  "unicorn/no-for-loop": "error",
668
668
  "unicorn/no-process-exit": "off",
669
669
  "unicorn/no-this-assignment": "off",
@@ -673,6 +673,7 @@ const unicornConfigs = [
673
673
  checkArrowFunctionBody: false
674
674
  }],
675
675
  "unicorn/numeric-separators-style": "off",
676
+ "unicorn/prefer-await": "off",
676
677
  "unicorn/prefer-module": "off",
677
678
  "unicorn/prefer-query-selector": "error",
678
679
  "unicorn/prefer-ternary": "off",
@@ -681,12 +682,11 @@ const unicornConfigs = [
681
682
  }
682
683
  },
683
684
  {
684
- name: "component-hook/unicorn/locales",
685
- files: ["**/locales/**/*.json"],
685
+ name: "component-hook/unicorn/allow-filename-case",
686
+ files: ["**/ISSUE_TEMPLATE/**"],
686
687
  rules: { "unicorn/filename-case": "off" }
687
688
  }
688
689
  ];
689
-
690
690
  //#endregion
691
691
  //#region configs/vue.ts
692
692
  const recommendedRules = pluginVue.configs["flat/recommended"].map((config) => config.rules).reduce((acc, rules) => ({
@@ -735,12 +735,11 @@ const rules = {
735
735
  "vue/no-setup-props-reactivity-loss": "off",
736
736
  "vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
737
737
  };
738
- const eslintVueTypescript = typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
738
+ const vueConfigs = [...typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
739
739
  ...config,
740
740
  files: [VUE],
741
741
  name: `component-hook/vue/${config.name?.replace("component-hook/", "")}`
742
- }));
743
- const vueConfigs = [...eslintVueTypescript, {
742
+ })), {
744
743
  name: "component-hook/vue",
745
744
  files: [VUE],
746
745
  plugins: {
@@ -763,26 +762,24 @@ const vueConfigs = [...eslintVueTypescript, {
763
762
  ...rules
764
763
  }
765
764
  }];
766
-
767
765
  //#endregion
768
766
  //#region configs/yaml.ts
769
767
  const initialRules = { rules: { "yml/no-empty-mapping-value": "off" } };
770
- const mergedConfig = Array.from(new Set([
771
- ...pluginYaml.configs.standard,
772
- ...pluginYaml.configs.prettier,
773
- initialRules
774
- ])).reduce((map, config) => {
775
- return {
776
- ...map,
777
- ...config,
778
- rules: {
779
- ...map.rules,
780
- ...config.rules
781
- }
782
- };
783
- }, {});
784
768
  const yamlConfigs = [{
785
- ...mergedConfig,
769
+ ...Array.from(/* @__PURE__ */ new Set([
770
+ ...pluginYaml.configs.standard,
771
+ ...pluginYaml.configs.prettier,
772
+ initialRules
773
+ ])).reduce((map, config) => {
774
+ return {
775
+ ...map,
776
+ ...config,
777
+ rules: {
778
+ ...map.rules,
779
+ ...config.rules
780
+ }
781
+ };
782
+ }, {}),
786
783
  name: "component-hook/yaml"
787
784
  }, {
788
785
  name: "component-hook/yaml/pnpm-workspace",
@@ -813,7 +810,6 @@ const yamlConfigs = [{
813
810
  }
814
811
  ] }
815
812
  }];
816
-
817
813
  //#endregion
818
814
  //#region index.ts
819
815
  const basicConfigs = [
@@ -830,7 +826,7 @@ const basicConfigs = [
830
826
  ...yamlConfigs,
831
827
  ignores
832
828
  ];
833
- const configs = {
829
+ var eslint_plugin_default = { configs: {
834
830
  basic: basicConfigs,
835
831
  react: reactConfigs,
836
832
  vue: vueConfigs,
@@ -844,8 +840,7 @@ const configs = {
844
840
  "testing-library/react": testingLibraryReactConfig,
845
841
  "testing-library/angular": testingLibraryAngularConfig,
846
842
  "testing-library/marko": testingLibraryMarkoConfig
847
- };
848
- var eslint_plugin_default = { configs };
843
+ } };
849
844
  const basicPreset = [
850
845
  prettierConfig,
851
846
  ...sonarjsConfigs,
@@ -862,6 +857,5 @@ const vuePreset = [
862
857
  ...vueConfigs,
863
858
  ...basicPreset
864
859
  ];
865
-
866
860
  //#endregion
867
- export { eslint_plugin_default as default, reactPreset, vuePreset };
861
+ export { eslint_plugin_default as default, reactPreset, vuePreset };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@component-hook/eslint-plugin",
3
3
  "type": "module",
4
- "version": "1.4.4",
4
+ "version": "1.5.1",
5
5
  "description": "ESLint config for component hook",
6
6
  "author": "Tzuyi",
7
7
  "license": "MIT",
@@ -38,45 +38,44 @@
38
38
  "tag": "latest"
39
39
  },
40
40
  "peerDependencies": {
41
- "eslint": "^9.39.2"
41
+ "eslint": "^9.39.5"
42
42
  },
43
43
  "dependencies": {
44
- "@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
45
- "@eslint/js": "^9.39.2",
46
- "@eslint/markdown": "^7.5.1",
44
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
45
+ "@eslint/js": "^9.39.5",
46
+ "@eslint/markdown": "^8.0.3",
47
47
  "eslint-config-prettier": "^10.1.8",
48
- "eslint-plugin-de-morgan": "^2.0.0",
48
+ "eslint-plugin-de-morgan": "^2.1.3",
49
49
  "eslint-plugin-import": "^2.32.0",
50
- "eslint-plugin-jsdoc": "^62.5.4",
51
- "eslint-plugin-jsonc": "^2.21.1",
50
+ "eslint-plugin-jsdoc": "^64.0.2",
51
+ "eslint-plugin-jsonc": "^3.4.1",
52
52
  "eslint-plugin-jsx-a11y": "^6.10.2",
53
- "eslint-plugin-perfectionist": "^5.5.0",
54
- "eslint-plugin-playwright": "^2.5.1",
55
- "eslint-plugin-prettier": "^5.5.5",
53
+ "eslint-plugin-perfectionist": "^5.10.1",
54
+ "eslint-plugin-playwright": "^2.11.0",
55
+ "eslint-plugin-prettier": "^5.5.6",
56
56
  "eslint-plugin-react": "^7.37.5",
57
- "eslint-plugin-react-hooks": "^7.0.1",
58
- "eslint-plugin-regexp": "^3.0.0",
59
- "eslint-plugin-security": "^3.0.1",
60
- "eslint-plugin-sonarjs": "^3.0.7",
61
- "eslint-plugin-testing-library": "^7.15.4",
62
- "eslint-plugin-unicorn": "^63.0.0",
63
- "eslint-plugin-vue": "^10.7.0",
64
- "eslint-plugin-yml": "^3.1.2",
65
- "globals": "^17.3.0",
66
- "jsonc-eslint-parser": "^2.4.2",
67
- "typescript-eslint": "^8.55.0",
68
- "vue-eslint-parser": "^10.2.0"
57
+ "eslint-plugin-react-hooks": "^7.1.1",
58
+ "eslint-plugin-regexp": "^3.1.1",
59
+ "eslint-plugin-security": "^4.0.1",
60
+ "eslint-plugin-sonarjs": "^4.2.0",
61
+ "eslint-plugin-testing-library": "^7.16.2",
62
+ "eslint-plugin-unicorn": "^73.0.0",
63
+ "eslint-plugin-vue": "^10.10.0",
64
+ "eslint-plugin-yml": "^3.8.1",
65
+ "globals": "^17.9.0",
66
+ "jsonc-eslint-parser": "^3.3.0",
67
+ "typescript-eslint": "^8.66.0",
68
+ "vue-eslint-parser": "^10.4.1"
69
69
  },
70
70
  "devDependencies": {
71
- "@eslint/config-inspector": "^1.4.2",
71
+ "@eslint/config-inspector": "^3.2.0",
72
72
  "@types/eslint-plugin-security": "^3.0.1",
73
- "eslint-typegen": "^2.3.0",
74
- "unrun": "^0.2.27"
73
+ "eslint-typegen": "^2.3.1"
75
74
  },
76
75
  "scripts": {
77
76
  "dev": "eslint-config-inspector --config ../../eslint.config.js",
78
77
  "build": "pnpm run build:typegen && tsdown",
79
- "build:typegen": "unrun scripts/typegen.ts",
78
+ "build:typegen": "node scripts/typegen.ts",
80
79
  "typecheck": "tsc --noEmit --skipLibCheck"
81
80
  }
82
81
  }