@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/README.md CHANGED
@@ -51,11 +51,11 @@ export default [
51
51
  componentHookPlugin.configs.security,
52
52
  ...componentHookPlugin.configs.markdown,
53
53
  {
54
- files: ['**/__tests__/unit/**/*.test.[jt]s?(x)'],
54
+ files: ['**/*.test.[jt]s?(x)'],
55
55
  ...componentHookPlugin.configs['testing-library/vue'],
56
56
  },
57
57
  {
58
- files: ['**/__tests__/e2e/**/*.spec.[jt]s?(x)'],
58
+ files: ['**/e2e/**/*.spec.[jt]s?(x)'],
59
59
  ...componentHookPlugin.configs.playwright,
60
60
  },
61
61
  // your custom config
package/dist/index.cjs CHANGED
@@ -1,4 +1,7 @@
1
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
2
5
  //#region \0rolldown/runtime.js
3
6
  var __create = Object.create;
4
7
  var __defProp = Object.defineProperty;
@@ -7,77 +10,70 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
10
  var __getProtoOf = Object.getPrototypeOf;
8
11
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
12
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
13
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
20
19
  }
21
20
  return to;
22
21
  };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
24
23
  value: mod,
25
24
  enumerable: true
26
25
  }) : target, mod));
27
-
28
26
  //#endregion
29
27
  let globals = require("globals");
30
- globals = __toESM(globals);
28
+ globals = __toESM(globals, 1);
31
29
  let _eslint_js = require("@eslint/js");
32
- _eslint_js = __toESM(_eslint_js);
30
+ _eslint_js = __toESM(_eslint_js, 1);
33
31
  let typescript_eslint = require("typescript-eslint");
34
- typescript_eslint = __toESM(typescript_eslint);
32
+ typescript_eslint = __toESM(typescript_eslint, 1);
35
33
  let eslint_plugin_react = require("eslint-plugin-react");
36
- eslint_plugin_react = __toESM(eslint_plugin_react);
34
+ eslint_plugin_react = __toESM(eslint_plugin_react, 1);
37
35
  let eslint_plugin_react_hooks = require("eslint-plugin-react-hooks");
38
- eslint_plugin_react_hooks = __toESM(eslint_plugin_react_hooks);
36
+ eslint_plugin_react_hooks = __toESM(eslint_plugin_react_hooks, 1);
39
37
  let eslint_plugin_jsx_a11y = require("eslint-plugin-jsx-a11y");
40
- eslint_plugin_jsx_a11y = __toESM(eslint_plugin_jsx_a11y);
38
+ eslint_plugin_jsx_a11y = __toESM(eslint_plugin_jsx_a11y, 1);
41
39
  let eslint_plugin_vue = require("eslint-plugin-vue");
42
- eslint_plugin_vue = __toESM(eslint_plugin_vue);
40
+ eslint_plugin_vue = __toESM(eslint_plugin_vue, 1);
43
41
  let vue_eslint_parser = require("vue-eslint-parser");
44
- vue_eslint_parser = __toESM(vue_eslint_parser);
42
+ vue_eslint_parser = __toESM(vue_eslint_parser, 1);
45
43
  let eslint_plugin_prettier = require("eslint-plugin-prettier");
46
- eslint_plugin_prettier = __toESM(eslint_plugin_prettier);
44
+ eslint_plugin_prettier = __toESM(eslint_plugin_prettier, 1);
47
45
  let eslint_plugin_prettier_recommended = require("eslint-plugin-prettier/recommended");
48
- eslint_plugin_prettier_recommended = __toESM(eslint_plugin_prettier_recommended);
46
+ eslint_plugin_prettier_recommended = __toESM(eslint_plugin_prettier_recommended, 1);
49
47
  let eslint_plugin_sonarjs = require("eslint-plugin-sonarjs");
50
- eslint_plugin_sonarjs = __toESM(eslint_plugin_sonarjs);
48
+ eslint_plugin_sonarjs = __toESM(eslint_plugin_sonarjs, 1);
51
49
  let eslint_plugin_security = require("eslint-plugin-security");
52
- eslint_plugin_security = __toESM(eslint_plugin_security);
50
+ eslint_plugin_security = __toESM(eslint_plugin_security, 1);
53
51
  let eslint_plugin_playwright = require("eslint-plugin-playwright");
54
- eslint_plugin_playwright = __toESM(eslint_plugin_playwright);
52
+ eslint_plugin_playwright = __toESM(eslint_plugin_playwright, 1);
55
53
  let eslint_plugin_testing_library = require("eslint-plugin-testing-library");
56
- eslint_plugin_testing_library = __toESM(eslint_plugin_testing_library);
54
+ eslint_plugin_testing_library = __toESM(eslint_plugin_testing_library, 1);
57
55
  let eslint_plugin_regexp = require("eslint-plugin-regexp");
58
- eslint_plugin_regexp = __toESM(eslint_plugin_regexp);
56
+ eslint_plugin_regexp = __toESM(eslint_plugin_regexp, 1);
59
57
  let eslint_plugin_import = require("eslint-plugin-import");
60
- eslint_plugin_import = __toESM(eslint_plugin_import);
58
+ eslint_plugin_import = __toESM(eslint_plugin_import, 1);
61
59
  let _eslint_markdown = require("@eslint/markdown");
62
- _eslint_markdown = __toESM(_eslint_markdown);
60
+ _eslint_markdown = __toESM(_eslint_markdown, 1);
63
61
  let _eslint_community_eslint_plugin_eslint_comments_configs = require("@eslint-community/eslint-plugin-eslint-comments/configs");
64
- _eslint_community_eslint_plugin_eslint_comments_configs = __toESM(_eslint_community_eslint_plugin_eslint_comments_configs);
62
+ _eslint_community_eslint_plugin_eslint_comments_configs = __toESM(_eslint_community_eslint_plugin_eslint_comments_configs, 1);
65
63
  let eslint_plugin_unicorn = require("eslint-plugin-unicorn");
66
- eslint_plugin_unicorn = __toESM(eslint_plugin_unicorn);
64
+ eslint_plugin_unicorn = __toESM(eslint_plugin_unicorn, 1);
67
65
  let eslint_plugin_de_morgan = require("eslint-plugin-de-morgan");
68
- eslint_plugin_de_morgan = __toESM(eslint_plugin_de_morgan);
66
+ eslint_plugin_de_morgan = __toESM(eslint_plugin_de_morgan, 1);
69
67
  let eslint_plugin_perfectionist = require("eslint-plugin-perfectionist");
70
- eslint_plugin_perfectionist = __toESM(eslint_plugin_perfectionist);
68
+ eslint_plugin_perfectionist = __toESM(eslint_plugin_perfectionist, 1);
71
69
  let eslint_plugin_jsdoc = require("eslint-plugin-jsdoc");
72
- eslint_plugin_jsdoc = __toESM(eslint_plugin_jsdoc);
70
+ eslint_plugin_jsdoc = __toESM(eslint_plugin_jsdoc, 1);
73
71
  let eslint_plugin_jsonc = require("eslint-plugin-jsonc");
74
- eslint_plugin_jsonc = __toESM(eslint_plugin_jsonc);
72
+ eslint_plugin_jsonc = __toESM(eslint_plugin_jsonc, 1);
75
73
  let jsonc_eslint_parser = require("jsonc-eslint-parser");
76
- jsonc_eslint_parser = __toESM(jsonc_eslint_parser);
77
74
  let eslint_plugin_yml = require("eslint-plugin-yml");
78
- eslint_plugin_yml = __toESM(eslint_plugin_yml);
75
+ eslint_plugin_yml = __toESM(eslint_plugin_yml, 1);
79
76
  let eslint_config = require("eslint/config");
80
-
81
77
  //#region configs/comments.ts
82
78
  const commentsConfigs = [{
83
79
  ..._eslint_community_eslint_plugin_eslint_comments_configs.default.recommended,
@@ -86,14 +82,12 @@ const commentsConfigs = [{
86
82
  name: "component-hook/comments",
87
83
  rules: { "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }] }
88
84
  }];
89
-
90
85
  //#endregion
91
86
  //#region configs/de-morgan.ts
92
87
  const deMorganConfig = {
93
88
  ...eslint_plugin_de_morgan.default.configs.recommended,
94
89
  name: "component-hook/de-morgan"
95
90
  };
96
-
97
91
  //#endregion
98
92
  //#region configs/ignores.ts
99
93
  const ignores = {
@@ -117,6 +111,7 @@ const ignores = {
117
111
  "**/.idea",
118
112
  "**/.output",
119
113
  "**/.vite-inspect",
114
+ "**/.context",
120
115
  "**/.nitro",
121
116
  "**/CHANGELOG*.md",
122
117
  "**/*.min.*",
@@ -130,17 +125,17 @@ const ignores = {
130
125
  "**/mockServiceWorker.js"
131
126
  ]
132
127
  };
133
-
134
128
  //#endregion
135
129
  //#region constants.ts
136
130
  const SRC = "**/*.?([cm])[jt]s?(x)";
137
131
  const SRC_EXT = "?([cm])[jt]s?(x)";
132
+ const JSX = "**/*.jsx";
133
+ const TSX = "**/*.tsx";
138
134
  const VUE = "**/*.vue";
139
135
  const BLOB_JSON = "**/*.json";
140
136
  const JSON5 = "**/*.json5";
141
137
  const JSONC = "**/*.jsonc";
142
138
  const RESTRICTED_SYNTAX = ["ForInStatement", "LabeledStatement"];
143
-
144
139
  //#endregion
145
140
  //#region configs/import.ts
146
141
  const plugins$2 = {
@@ -181,7 +176,6 @@ const importConfigs = [{
181
176
  languageOptions,
182
177
  rules: { "import/no-default-export": "off" }
183
178
  }];
184
-
185
179
  //#endregion
186
180
  //#region configs/javascript.ts
187
181
  const jsConfigs = [{
@@ -221,7 +215,6 @@ const jsConfigs = [{
221
215
  }
222
216
  }
223
217
  }];
224
-
225
218
  //#endregion
226
219
  //#region configs/jsdoc.ts
227
220
  const jsdocConfig = {
@@ -245,9 +238,12 @@ const jsdocConfig = {
245
238
  "jsdoc/require-yields-check": "warn"
246
239
  }
247
240
  };
248
-
249
241
  //#endregion
250
242
  //#region configs/jsonc.ts
243
+ const recommendedRules$1 = eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].map((config) => config.rules).reduce((acc, rules) => ({
244
+ ...acc,
245
+ ...rules
246
+ }), {});
251
247
  const jsoncConfigs = [
252
248
  {
253
249
  name: "component-hook/jsonc",
@@ -256,10 +252,11 @@ const jsoncConfigs = [
256
252
  JSON5,
257
253
  JSONC
258
254
  ],
255
+ language: "jsonc/x",
259
256
  plugins: { jsonc: eslint_plugin_jsonc.default },
260
- languageOptions: { parser: jsonc_eslint_parser.default },
257
+ languageOptions: { parser: jsonc_eslint_parser.parseForESLint },
261
258
  rules: {
262
- ...eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
259
+ ...recommendedRules$1,
263
260
  "jsonc/quote-props": "off",
264
261
  "jsonc/quotes": "off"
265
262
  }
@@ -312,6 +309,7 @@ const jsoncConfigs = [
312
309
  "peerDependencies",
313
310
  "peerDependenciesMeta",
314
311
  "dependencies",
312
+ "inlinedDependencies",
315
313
  "optionalDependencies",
316
314
  "devDependencies",
317
315
  "pnpm",
@@ -461,7 +459,6 @@ const jsoncConfigs = [
461
459
  ] }
462
460
  }
463
461
  ];
464
-
465
462
  //#endregion
466
463
  //#region configs/markdown.ts
467
464
  const markdownConfigs = [..._eslint_markdown.default.configs.processor.map((config) => ({
@@ -489,10 +486,10 @@ const markdownConfigs = [..._eslint_markdown.default.configs.processor.map((conf
489
486
  "sonarjs/unused-import": "off",
490
487
  "sonarjs/no-unused-vars": "off",
491
488
  "unicorn/no-useless-undefined": "off",
492
- "unicorn/no-anonymous-default-export": "off"
489
+ "unicorn/no-anonymous-default-export": "off",
490
+ "unicorn/no-top-level-side-effects": "off"
493
491
  }
494
492
  }];
495
-
496
493
  //#endregion
497
494
  //#region configs/perfectionist.ts
498
495
  const perfectionistConfig = {
@@ -527,18 +524,15 @@ const perfectionistConfig = {
527
524
  }]
528
525
  }
529
526
  };
530
-
531
527
  //#endregion
532
528
  //#region configs/playwright.ts
533
529
  const playwrightConfig = {
534
530
  ...eslint_plugin_playwright.default.configs["flat/recommended"],
535
531
  name: "component-hook/playwright"
536
532
  };
537
-
538
533
  //#endregion
539
534
  //#region configs/prettier.ts
540
- const rules$1 = { ...eslint_plugin_prettier_recommended.default.rules };
541
- delete rules$1["vue/html-self-closing"];
535
+ const rules$1 = Object.fromEntries(Object.entries(eslint_plugin_prettier_recommended.default.rules ?? {}).filter(([name]) => name !== "vue/html-self-closing"));
542
536
  const prettierConfig = {
543
537
  name: "component-hook/prettier",
544
538
  plugins: { prettier: eslint_plugin_prettier.default },
@@ -547,7 +541,6 @@ const prettierConfig = {
547
541
  "prettier/prettier": "warn"
548
542
  }
549
543
  };
550
-
551
544
  //#endregion
552
545
  //#region configs/react.ts
553
546
  const reactConfigs = [
@@ -569,16 +562,19 @@ const reactConfigs = [
569
562
  {
570
563
  ...eslint_plugin_jsx_a11y.default.flatConfigs.recommended,
571
564
  name: "component-hook/jsx-a11y"
565
+ },
566
+ {
567
+ name: "component-hook/react/components",
568
+ files: [TSX, JSX],
569
+ rules: { "unicorn/no-anonymous-default-export": "off" }
572
570
  }
573
571
  ];
574
-
575
572
  //#endregion
576
573
  //#region configs/regexp.ts
577
574
  const regexpConfig = {
578
575
  ...eslint_plugin_regexp.default.configs["flat/recommended"],
579
576
  name: "component-hook/regexp"
580
577
  };
581
-
582
578
  //#endregion
583
579
  //#region configs/security.ts
584
580
  const securityConfig = {
@@ -589,7 +585,6 @@ const securityConfig = {
589
585
  "security/detect-object-injection": "off"
590
586
  }
591
587
  };
592
-
593
588
  //#endregion
594
589
  //#region configs/sonarjs.ts
595
590
  const plugins$1 = { sonarjs: eslint_plugin_sonarjs.default };
@@ -613,7 +608,6 @@ const sonarjsConfigs = [{
613
608
  },
614
609
  settings
615
610
  }];
616
-
617
611
  //#endregion
618
612
  //#region configs/testing-library.ts
619
613
  const configs$1 = eslint_plugin_testing_library.default.configs;
@@ -643,7 +637,6 @@ const testingLibraryMarkoConfig = {
643
637
  plugins,
644
638
  rules: { ...configs$1["flat/marko"].rules }
645
639
  };
646
-
647
640
  //#endregion
648
641
  //#region configs/typescript.ts
649
642
  const typescriptCoreConfig = (0, eslint_config.defineConfig)({
@@ -691,7 +684,6 @@ const typescriptConfigs = [...typescriptCoreConfig, {
691
684
  "unused-imports/no-unused-vars": "off"
692
685
  }
693
686
  }];
694
-
695
687
  //#endregion
696
688
  //#region configs/unicorn.ts
697
689
  const unicornConfigs = [
@@ -702,21 +694,26 @@ const unicornConfigs = [
702
694
  {
703
695
  name: "component-hook/unicorn",
704
696
  rules: {
705
- "unicorn/catch-error-name": "error",
706
- "unicorn/consistent-empty-array-spread": "error",
697
+ "unicorn/consistent-arrow-return-style": "off",
707
698
  "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
708
- "unicorn/custom-error-definition": "error",
709
699
  "unicorn/filename-case": ["error", {
710
700
  cases: {
711
701
  kebabCase: true,
712
702
  pascalCase: true
713
703
  },
714
- ignore: [/^[A-Z]+\..*$/, /import_map\.json/]
704
+ ignore: [
705
+ /^[A-Z]+\..*$/,
706
+ /^[a-z]{2}-[A-Za-z]{2}(\.\w+)?$/,
707
+ /import_map\.json/
708
+ ]
715
709
  }],
716
710
  "unicorn/import-style": "off",
717
711
  "unicorn/no-abusive-eslint-disable": "off",
718
712
  "unicorn/no-array-for-each": "off",
713
+ "unicorn/no-barrel-files": "off",
714
+ "unicorn/no-duplicate-set-values": "error",
719
715
  "unicorn/no-empty-file": "off",
716
+ "unicorn/no-for-each": "off",
720
717
  "unicorn/no-for-loop": "error",
721
718
  "unicorn/no-process-exit": "off",
722
719
  "unicorn/no-this-assignment": "off",
@@ -726,6 +723,7 @@ const unicornConfigs = [
726
723
  checkArrowFunctionBody: false
727
724
  }],
728
725
  "unicorn/numeric-separators-style": "off",
726
+ "unicorn/prefer-await": "off",
729
727
  "unicorn/prefer-module": "off",
730
728
  "unicorn/prefer-query-selector": "error",
731
729
  "unicorn/prefer-ternary": "off",
@@ -734,12 +732,11 @@ const unicornConfigs = [
734
732
  }
735
733
  },
736
734
  {
737
- name: "component-hook/unicorn/locales",
738
- files: ["**/locales/**/*.json"],
735
+ name: "component-hook/unicorn/allow-filename-case",
736
+ files: ["**/ISSUE_TEMPLATE/**"],
739
737
  rules: { "unicorn/filename-case": "off" }
740
738
  }
741
739
  ];
742
-
743
740
  //#endregion
744
741
  //#region configs/vue.ts
745
742
  const recommendedRules = eslint_plugin_vue.default.configs["flat/recommended"].map((config) => config.rules).reduce((acc, rules) => ({
@@ -788,12 +785,11 @@ const rules = {
788
785
  "vue/no-setup-props-reactivity-loss": "off",
789
786
  "vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
790
787
  };
791
- const eslintVueTypescript = typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
788
+ const vueConfigs = [...typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
792
789
  ...config,
793
790
  files: [VUE],
794
791
  name: `component-hook/vue/${config.name?.replace("component-hook/", "")}`
795
- }));
796
- const vueConfigs = [...eslintVueTypescript, {
792
+ })), {
797
793
  name: "component-hook/vue",
798
794
  files: [VUE],
799
795
  plugins: {
@@ -816,26 +812,24 @@ const vueConfigs = [...eslintVueTypescript, {
816
812
  ...rules
817
813
  }
818
814
  }];
819
-
820
815
  //#endregion
821
816
  //#region configs/yaml.ts
822
817
  const initialRules = { rules: { "yml/no-empty-mapping-value": "off" } };
823
- const mergedConfig = Array.from(new Set([
824
- ...eslint_plugin_yml.default.configs.standard,
825
- ...eslint_plugin_yml.default.configs.prettier,
826
- initialRules
827
- ])).reduce((map, config) => {
828
- return {
829
- ...map,
830
- ...config,
831
- rules: {
832
- ...map.rules,
833
- ...config.rules
834
- }
835
- };
836
- }, {});
837
818
  const yamlConfigs = [{
838
- ...mergedConfig,
819
+ ...Array.from(/* @__PURE__ */ new Set([
820
+ ...eslint_plugin_yml.default.configs.standard,
821
+ ...eslint_plugin_yml.default.configs.prettier,
822
+ initialRules
823
+ ])).reduce((map, config) => {
824
+ return {
825
+ ...map,
826
+ ...config,
827
+ rules: {
828
+ ...map.rules,
829
+ ...config.rules
830
+ }
831
+ };
832
+ }, {}),
839
833
  name: "component-hook/yaml"
840
834
  }, {
841
835
  name: "component-hook/yaml/pnpm-workspace",
@@ -866,7 +860,6 @@ const yamlConfigs = [{
866
860
  }
867
861
  ] }
868
862
  }];
869
-
870
863
  //#endregion
871
864
  //#region index.ts
872
865
  const basicConfigs = [
@@ -883,7 +876,7 @@ const basicConfigs = [
883
876
  ...yamlConfigs,
884
877
  ignores
885
878
  ];
886
- const configs = {
879
+ var eslint_plugin_default = { configs: {
887
880
  basic: basicConfigs,
888
881
  react: reactConfigs,
889
882
  vue: vueConfigs,
@@ -897,8 +890,7 @@ const configs = {
897
890
  "testing-library/react": testingLibraryReactConfig,
898
891
  "testing-library/angular": testingLibraryAngularConfig,
899
892
  "testing-library/marko": testingLibraryMarkoConfig
900
- };
901
- var eslint_plugin_default = { configs };
893
+ } };
902
894
  const basicPreset = [
903
895
  prettierConfig,
904
896
  ...sonarjsConfigs,
@@ -915,8 +907,7 @@ const vuePreset = [
915
907
  ...vueConfigs,
916
908
  ...basicPreset
917
909
  ];
918
-
919
910
  //#endregion
920
911
  exports.default = eslint_plugin_default;
921
912
  exports.reactPreset = reactPreset;
922
- exports.vuePreset = vuePreset;
913
+ exports.vuePreset = vuePreset;