@component-hook/eslint-plugin 1.4.3 → 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/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,16 +10,12 @@ 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
  };
@@ -24,60 +23,57 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
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) => ({
@@ -492,7 +489,6 @@ const markdownConfigs = [..._eslint_markdown.default.configs.processor.map((conf
492
489
  "unicorn/no-anonymous-default-export": "off"
493
490
  }
494
491
  }];
495
-
496
492
  //#endregion
497
493
  //#region configs/perfectionist.ts
498
494
  const perfectionistConfig = {
@@ -527,18 +523,15 @@ const perfectionistConfig = {
527
523
  }]
528
524
  }
529
525
  };
530
-
531
526
  //#endregion
532
527
  //#region configs/playwright.ts
533
528
  const playwrightConfig = {
534
529
  ...eslint_plugin_playwright.default.configs["flat/recommended"],
535
530
  name: "component-hook/playwright"
536
531
  };
537
-
538
532
  //#endregion
539
533
  //#region configs/prettier.ts
540
- const rules$1 = { ...eslint_plugin_prettier_recommended.default.rules };
541
- delete rules$1["vue/html-self-closing"];
534
+ const rules$1 = Object.fromEntries(Object.entries(eslint_plugin_prettier_recommended.default.rules ?? {}).filter(([name]) => name !== "vue/html-self-closing"));
542
535
  const prettierConfig = {
543
536
  name: "component-hook/prettier",
544
537
  plugins: { prettier: eslint_plugin_prettier.default },
@@ -547,7 +540,6 @@ const prettierConfig = {
547
540
  "prettier/prettier": "warn"
548
541
  }
549
542
  };
550
-
551
543
  //#endregion
552
544
  //#region configs/react.ts
553
545
  const reactConfigs = [
@@ -569,16 +561,19 @@ const reactConfigs = [
569
561
  {
570
562
  ...eslint_plugin_jsx_a11y.default.flatConfigs.recommended,
571
563
  name: "component-hook/jsx-a11y"
564
+ },
565
+ {
566
+ name: "component-hook/react/components",
567
+ files: [TSX, JSX],
568
+ rules: { "unicorn/no-anonymous-default-export": "off" }
572
569
  }
573
570
  ];
574
-
575
571
  //#endregion
576
572
  //#region configs/regexp.ts
577
573
  const regexpConfig = {
578
574
  ...eslint_plugin_regexp.default.configs["flat/recommended"],
579
575
  name: "component-hook/regexp"
580
576
  };
581
-
582
577
  //#endregion
583
578
  //#region configs/security.ts
584
579
  const securityConfig = {
@@ -589,7 +584,6 @@ const securityConfig = {
589
584
  "security/detect-object-injection": "off"
590
585
  }
591
586
  };
592
-
593
587
  //#endregion
594
588
  //#region configs/sonarjs.ts
595
589
  const plugins$1 = { sonarjs: eslint_plugin_sonarjs.default };
@@ -613,7 +607,6 @@ const sonarjsConfigs = [{
613
607
  },
614
608
  settings
615
609
  }];
616
-
617
610
  //#endregion
618
611
  //#region configs/testing-library.ts
619
612
  const configs$1 = eslint_plugin_testing_library.default.configs;
@@ -643,7 +636,6 @@ const testingLibraryMarkoConfig = {
643
636
  plugins,
644
637
  rules: { ...configs$1["flat/marko"].rules }
645
638
  };
646
-
647
639
  //#endregion
648
640
  //#region configs/typescript.ts
649
641
  const typescriptCoreConfig = (0, eslint_config.defineConfig)({
@@ -691,7 +683,6 @@ const typescriptConfigs = [...typescriptCoreConfig, {
691
683
  "unused-imports/no-unused-vars": "off"
692
684
  }
693
685
  }];
694
-
695
686
  //#endregion
696
687
  //#region configs/unicorn.ts
697
688
  const unicornConfigs = [
@@ -711,11 +702,16 @@ const unicornConfigs = [
711
702
  kebabCase: true,
712
703
  pascalCase: true
713
704
  },
714
- ignore: [/^[A-Z]+\..*$/, /import_map\.json/]
705
+ ignore: [
706
+ /^[A-Z]+\..*$/,
707
+ /^[a-z]{2}-[A-Za-z]{2}(\.\w+)?$/,
708
+ /import_map\.json/
709
+ ]
715
710
  }],
716
711
  "unicorn/import-style": "off",
717
712
  "unicorn/no-abusive-eslint-disable": "off",
718
713
  "unicorn/no-array-for-each": "off",
714
+ "unicorn/no-duplicate-set-values": "error",
719
715
  "unicorn/no-empty-file": "off",
720
716
  "unicorn/no-for-loop": "error",
721
717
  "unicorn/no-process-exit": "off",
@@ -734,12 +730,11 @@ const unicornConfigs = [
734
730
  }
735
731
  },
736
732
  {
737
- name: "component-hook/unicorn/locales",
738
- files: ["**/locales/**/*.json"],
733
+ name: "component-hook/unicorn/allow-filename-case",
734
+ files: ["**/ISSUE_TEMPLATE/**"],
739
735
  rules: { "unicorn/filename-case": "off" }
740
736
  }
741
737
  ];
742
-
743
738
  //#endregion
744
739
  //#region configs/vue.ts
745
740
  const recommendedRules = eslint_plugin_vue.default.configs["flat/recommended"].map((config) => config.rules).reduce((acc, rules) => ({
@@ -788,12 +783,11 @@ const rules = {
788
783
  "vue/no-setup-props-reactivity-loss": "off",
789
784
  "vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
790
785
  };
791
- const eslintVueTypescript = typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
786
+ const vueConfigs = [...typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
792
787
  ...config,
793
788
  files: [VUE],
794
789
  name: `component-hook/vue/${config.name?.replace("component-hook/", "")}`
795
- }));
796
- const vueConfigs = [...eslintVueTypescript, {
790
+ })), {
797
791
  name: "component-hook/vue",
798
792
  files: [VUE],
799
793
  plugins: {
@@ -816,26 +810,24 @@ const vueConfigs = [...eslintVueTypescript, {
816
810
  ...rules
817
811
  }
818
812
  }];
819
-
820
813
  //#endregion
821
814
  //#region configs/yaml.ts
822
815
  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
816
  const yamlConfigs = [{
838
- ...mergedConfig,
817
+ ...Array.from(/* @__PURE__ */ new Set([
818
+ ...eslint_plugin_yml.default.configs.standard,
819
+ ...eslint_plugin_yml.default.configs.prettier,
820
+ initialRules
821
+ ])).reduce((map, config) => {
822
+ return {
823
+ ...map,
824
+ ...config,
825
+ rules: {
826
+ ...map.rules,
827
+ ...config.rules
828
+ }
829
+ };
830
+ }, {}),
839
831
  name: "component-hook/yaml"
840
832
  }, {
841
833
  name: "component-hook/yaml/pnpm-workspace",
@@ -866,7 +858,6 @@ const yamlConfigs = [{
866
858
  }
867
859
  ] }
868
860
  }];
869
-
870
861
  //#endregion
871
862
  //#region index.ts
872
863
  const basicConfigs = [
@@ -883,7 +874,7 @@ const basicConfigs = [
883
874
  ...yamlConfigs,
884
875
  ignores
885
876
  ];
886
- const configs = {
877
+ var eslint_plugin_default = { configs: {
887
878
  basic: basicConfigs,
888
879
  react: reactConfigs,
889
880
  vue: vueConfigs,
@@ -897,8 +888,7 @@ const configs = {
897
888
  "testing-library/react": testingLibraryReactConfig,
898
889
  "testing-library/angular": testingLibraryAngularConfig,
899
890
  "testing-library/marko": testingLibraryMarkoConfig
900
- };
901
- var eslint_plugin_default = { configs };
891
+ } };
902
892
  const basicPreset = [
903
893
  prettierConfig,
904
894
  ...sonarjsConfigs,
@@ -915,8 +905,7 @@ const vuePreset = [
915
905
  ...vueConfigs,
916
906
  ...basicPreset
917
907
  ];
918
-
919
908
  //#endregion
920
909
  exports.default = eslint_plugin_default;
921
910
  exports.reactPreset = reactPreset;
922
- exports.vuePreset = vuePreset;
911
+ exports.vuePreset = vuePreset;