@component-hook/eslint-plugin 1.4.4 → 1.5.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/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) => ({
@@ -439,7 +439,6 @@ const markdownConfigs = [...pluginMarkdown.configs.processor.map((config) => ({
439
439
  "unicorn/no-anonymous-default-export": "off"
440
440
  }
441
441
  }];
442
-
443
442
  //#endregion
444
443
  //#region configs/perfectionist.ts
445
444
  const perfectionistConfig = {
@@ -474,18 +473,15 @@ const perfectionistConfig = {
474
473
  }]
475
474
  }
476
475
  };
477
-
478
476
  //#endregion
479
477
  //#region configs/playwright.ts
480
478
  const playwrightConfig = {
481
479
  ...pluginPlaywright.configs["flat/recommended"],
482
480
  name: "component-hook/playwright"
483
481
  };
484
-
485
482
  //#endregion
486
483
  //#region configs/prettier.ts
487
- const rules$1 = { ...pluginPrettierRecommended.rules };
488
- delete rules$1["vue/html-self-closing"];
484
+ const rules$1 = Object.fromEntries(Object.entries(pluginPrettierRecommended.rules ?? {}).filter(([name]) => name !== "vue/html-self-closing"));
489
485
  const prettierConfig = {
490
486
  name: "component-hook/prettier",
491
487
  plugins: { prettier: pluginPrettier },
@@ -494,7 +490,6 @@ const prettierConfig = {
494
490
  "prettier/prettier": "warn"
495
491
  }
496
492
  };
497
-
498
493
  //#endregion
499
494
  //#region configs/react.ts
500
495
  const reactConfigs = [
@@ -516,16 +511,19 @@ const reactConfigs = [
516
511
  {
517
512
  ...pluginJsxA11y.flatConfigs.recommended,
518
513
  name: "component-hook/jsx-a11y"
514
+ },
515
+ {
516
+ name: "component-hook/react/components",
517
+ files: [TSX, JSX],
518
+ rules: { "unicorn/no-anonymous-default-export": "off" }
519
519
  }
520
520
  ];
521
-
522
521
  //#endregion
523
522
  //#region configs/regexp.ts
524
523
  const regexpConfig = {
525
524
  ...pluginRegexp.configs["flat/recommended"],
526
525
  name: "component-hook/regexp"
527
526
  };
528
-
529
527
  //#endregion
530
528
  //#region configs/security.ts
531
529
  const securityConfig = {
@@ -536,7 +534,6 @@ const securityConfig = {
536
534
  "security/detect-object-injection": "off"
537
535
  }
538
536
  };
539
-
540
537
  //#endregion
541
538
  //#region configs/sonarjs.ts
542
539
  const plugins$1 = { sonarjs: pluginSonarjs };
@@ -560,7 +557,6 @@ const sonarjsConfigs = [{
560
557
  },
561
558
  settings
562
559
  }];
563
-
564
560
  //#endregion
565
561
  //#region configs/testing-library.ts
566
562
  const configs$1 = pluginTestingLibrary.configs;
@@ -590,7 +586,6 @@ const testingLibraryMarkoConfig = {
590
586
  plugins,
591
587
  rules: { ...configs$1["flat/marko"].rules }
592
588
  };
593
-
594
589
  //#endregion
595
590
  //#region configs/typescript.ts
596
591
  const typescriptCoreConfig = defineConfig({
@@ -638,7 +633,6 @@ const typescriptConfigs = [...typescriptCoreConfig, {
638
633
  "unused-imports/no-unused-vars": "off"
639
634
  }
640
635
  }];
641
-
642
636
  //#endregion
643
637
  //#region configs/unicorn.ts
644
638
  const unicornConfigs = [
@@ -658,11 +652,16 @@ const unicornConfigs = [
658
652
  kebabCase: true,
659
653
  pascalCase: true
660
654
  },
661
- ignore: [/^[A-Z]+\..*$/, /import_map\.json/]
655
+ ignore: [
656
+ /^[A-Z]+\..*$/,
657
+ /^[a-z]{2}-[A-Za-z]{2}(\.\w+)?$/,
658
+ /import_map\.json/
659
+ ]
662
660
  }],
663
661
  "unicorn/import-style": "off",
664
662
  "unicorn/no-abusive-eslint-disable": "off",
665
663
  "unicorn/no-array-for-each": "off",
664
+ "unicorn/no-duplicate-set-values": "error",
666
665
  "unicorn/no-empty-file": "off",
667
666
  "unicorn/no-for-loop": "error",
668
667
  "unicorn/no-process-exit": "off",
@@ -681,12 +680,11 @@ const unicornConfigs = [
681
680
  }
682
681
  },
683
682
  {
684
- name: "component-hook/unicorn/locales",
685
- files: ["**/locales/**/*.json"],
683
+ name: "component-hook/unicorn/allow-filename-case",
684
+ files: ["**/ISSUE_TEMPLATE/**"],
686
685
  rules: { "unicorn/filename-case": "off" }
687
686
  }
688
687
  ];
689
-
690
688
  //#endregion
691
689
  //#region configs/vue.ts
692
690
  const recommendedRules = pluginVue.configs["flat/recommended"].map((config) => config.rules).reduce((acc, rules) => ({
@@ -735,12 +733,11 @@ const rules = {
735
733
  "vue/no-setup-props-reactivity-loss": "off",
736
734
  "vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
737
735
  };
738
- const eslintVueTypescript = typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
736
+ const vueConfigs = [...typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
739
737
  ...config,
740
738
  files: [VUE],
741
739
  name: `component-hook/vue/${config.name?.replace("component-hook/", "")}`
742
- }));
743
- const vueConfigs = [...eslintVueTypescript, {
740
+ })), {
744
741
  name: "component-hook/vue",
745
742
  files: [VUE],
746
743
  plugins: {
@@ -763,26 +760,24 @@ const vueConfigs = [...eslintVueTypescript, {
763
760
  ...rules
764
761
  }
765
762
  }];
766
-
767
763
  //#endregion
768
764
  //#region configs/yaml.ts
769
765
  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
766
  const yamlConfigs = [{
785
- ...mergedConfig,
767
+ ...Array.from(/* @__PURE__ */ new Set([
768
+ ...pluginYaml.configs.standard,
769
+ ...pluginYaml.configs.prettier,
770
+ initialRules
771
+ ])).reduce((map, config) => {
772
+ return {
773
+ ...map,
774
+ ...config,
775
+ rules: {
776
+ ...map.rules,
777
+ ...config.rules
778
+ }
779
+ };
780
+ }, {}),
786
781
  name: "component-hook/yaml"
787
782
  }, {
788
783
  name: "component-hook/yaml/pnpm-workspace",
@@ -813,7 +808,6 @@ const yamlConfigs = [{
813
808
  }
814
809
  ] }
815
810
  }];
816
-
817
811
  //#endregion
818
812
  //#region index.ts
819
813
  const basicConfigs = [
@@ -830,7 +824,7 @@ const basicConfigs = [
830
824
  ...yamlConfigs,
831
825
  ignores
832
826
  ];
833
- const configs = {
827
+ var eslint_plugin_default = { configs: {
834
828
  basic: basicConfigs,
835
829
  react: reactConfigs,
836
830
  vue: vueConfigs,
@@ -844,8 +838,7 @@ const configs = {
844
838
  "testing-library/react": testingLibraryReactConfig,
845
839
  "testing-library/angular": testingLibraryAngularConfig,
846
840
  "testing-library/marko": testingLibraryMarkoConfig
847
- };
848
- var eslint_plugin_default = { configs };
841
+ } };
849
842
  const basicPreset = [
850
843
  prettierConfig,
851
844
  ...sonarjsConfigs,
@@ -862,6 +855,5 @@ const vuePreset = [
862
855
  ...vueConfigs,
863
856
  ...basicPreset
864
857
  ];
865
-
866
858
  //#endregion
867
- export { eslint_plugin_default as default, reactPreset, vuePreset };
859
+ 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.0",
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.4"
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.4",
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.2",
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": "^63.0.13",
51
+ "eslint-plugin-jsonc": "^3.3.0",
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.0",
54
+ "eslint-plugin-playwright": "^2.10.5",
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.1.0",
61
+ "eslint-plugin-testing-library": "^7.16.2",
62
+ "eslint-plugin-unicorn": "^69.0.0",
63
+ "eslint-plugin-vue": "^10.9.2",
64
+ "eslint-plugin-yml": "^3.6.0",
65
+ "globals": "^17.7.0",
66
+ "jsonc-eslint-parser": "^3.1.0",
67
+ "typescript-eslint": "^8.63.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.0.4",
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
  }