@component-hook/eslint-plugin 1.1.5 → 1.2.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.js DELETED
@@ -1,642 +0,0 @@
1
- // plugins.ts
2
- import { default as default2 } from "globals";
3
- import { default as default3 } from "@eslint/js";
4
- import { fixupPluginRules } from "@eslint/compat";
5
- import { default as default4 } from "typescript-eslint";
6
- import { default as default5 } from "eslint-plugin-react";
7
- import { default as default6 } from "eslint-plugin-react-hooks";
8
- import { default as default7 } from "eslint-plugin-jsx-a11y";
9
- import { default as default8 } from "eslint-plugin-vue";
10
- import { default as default9 } from "vue-eslint-parser";
11
- import { default as default10 } from "eslint-plugin-prettier";
12
- import { default as default11 } from "eslint-plugin-prettier/recommended";
13
- import { default as default12 } from "eslint-plugin-sonarjs";
14
- import { default as default13 } from "eslint-plugin-security";
15
- import { default as default14 } from "eslint-plugin-playwright";
16
- import { default as default15 } from "eslint-plugin-testing-library";
17
- import { default as default16 } from "eslint-plugin-regexp";
18
- import { default as default17 } from "eslint-plugin-import";
19
- import { default as default18 } from "@eslint/markdown";
20
- import { default as default19 } from "@eslint-community/eslint-plugin-eslint-comments/configs";
21
- import { default as default20 } from "eslint-plugin-unicorn";
22
- import { default as default21 } from "eslint-plugin-de-morgan";
23
- import { default as default22 } from "eslint-plugin-perfectionist";
24
- import { default as default23 } from "eslint-plugin-jsdoc";
25
-
26
- // configs/comments.ts
27
- var commentsConfigs = [
28
- {
29
- ...default19.recommended,
30
- name: "component-hook/comments/recommended"
31
- },
32
- {
33
- name: "component-hook/comments",
34
- rules: {
35
- "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
36
- }
37
- }
38
- ];
39
-
40
- // configs/de-morgan.ts
41
- var deMorganConfig = {
42
- ...default21.configs.recommended,
43
- name: "component-hook/de-morgan"
44
- };
45
-
46
- // configs/ignores.ts
47
- var ignores = {
48
- name: "component-hook/ignores",
49
- ignores: [
50
- "**/node_modules",
51
- "**/dist",
52
- "**/pnpm-lock.yaml",
53
- "**/yarn.lock",
54
- "**/package-lock.json",
55
- "**/bun.lockb",
56
- "output",
57
- "**/coverage",
58
- "**/playwright-report",
59
- "**/temp",
60
- "**/fixtures",
61
- "**/.vitepress/cache",
62
- "**/.nuxt",
63
- "**/.vercel",
64
- "**/.changeset",
65
- "**/.idea",
66
- "**/.output",
67
- "**/.vite-inspect",
68
- "**/.nitro",
69
- "**/CHANGELOG*.md",
70
- "**/*.min.*",
71
- "**/LICENSE*",
72
- "**/__snapshots__",
73
- "**/auto-import?(s).d.ts",
74
- "**/components.d.ts",
75
- "**/vite-env.d.ts",
76
- "**/shims-vue.d.ts",
77
- "**/.turbo",
78
- "**/mockServiceWorker.js"
79
- ]
80
- };
81
-
82
- // constants.ts
83
- var SRC = "**/*.?([cm])[jt]s?(x)";
84
- var SRC_EXT = "?([cm])[jt]s?(x)";
85
- var VUE = "**/*.vue";
86
-
87
- // configs/import.ts
88
- var plugins = {
89
- import: fixupPluginRules(default17),
90
- "@typescript-eslint": default4.plugin
91
- };
92
- var languageOptions = {
93
- parser: default9,
94
- parserOptions: {
95
- parser: "@typescript-eslint/parser",
96
- sourceType: "module",
97
- ecmaVersion: "latest"
98
- }
99
- };
100
- var importConfigs = [
101
- {
102
- name: "component-hook/import",
103
- plugins,
104
- languageOptions,
105
- rules: {
106
- "import/first": "error",
107
- "import/no-default-export": "error",
108
- "import/no-duplicates": "error",
109
- "import/no-mutable-exports": "error",
110
- "import/no-named-default": "error",
111
- "import/no-self-import": "error",
112
- "import/no-webpack-loader-syntax": "error"
113
- }
114
- },
115
- {
116
- name: "component-hook/import/allow-default-export",
117
- files: [
118
- "**/*.d.ts",
119
- "**/*.md/**",
120
- `**/*config*.${SRC_EXT}`,
121
- `**/{views,pages,routes,middleware,plugins,api}/**/*.${SRC_EXT}`,
122
- `**/{index,vite,esbuild,rollup,rolldown,webpack,rspack,farm,unloader}.${SRC_EXT}`
123
- ],
124
- plugins,
125
- languageOptions,
126
- rules: {
127
- "import/no-default-export": "off"
128
- }
129
- }
130
- ];
131
-
132
- // configs/javascript.ts
133
- var isProduction = process.env.NODE_ENV === "production";
134
- var rules = {
135
- "no-useless-call": "error",
136
- "no-useless-computed-key": "error",
137
- "no-useless-constructor": "error",
138
- "no-useless-rename": "error",
139
- "no-var": "error",
140
- "no-console": isProduction ? "warn" : "off",
141
- "no-debugger": isProduction ? "warn" : "off",
142
- "no-eval": "error",
143
- "no-loop-func": "error",
144
- "no-dupe-class-members": "error",
145
- "no-duplicate-imports": "error",
146
- "object-shorthand": "error",
147
- "prefer-const": "error",
148
- "prefer-template": "error",
149
- eqeqeq: "error"
150
- };
151
- var jsConfigs = [
152
- {
153
- name: "component-hook/javascript",
154
- rules: {
155
- ...default3.configs.recommended.rules,
156
- ...rules
157
- }
158
- }
159
- ];
160
-
161
- // configs/jsdoc.ts
162
- var jsdocConfig = {
163
- name: "component-hook/jsdoc",
164
- plugins: {
165
- jsdoc: default23
166
- },
167
- rules: {
168
- "jsdoc/check-access": "warn",
169
- "jsdoc/check-param-names": "warn",
170
- "jsdoc/check-property-names": "warn",
171
- "jsdoc/check-types": "warn",
172
- "jsdoc/empty-tags": "warn",
173
- "jsdoc/implements-on-classes": "warn",
174
- "jsdoc/no-defaults": "warn",
175
- "jsdoc/no-multi-asterisks": "warn",
176
- "jsdoc/require-param-name": "warn",
177
- "jsdoc/require-property": "warn",
178
- "jsdoc/require-property-description": "warn",
179
- "jsdoc/require-property-name": "warn",
180
- "jsdoc/require-returns-check": "warn",
181
- "jsdoc/require-returns-description": "warn",
182
- "jsdoc/require-yields-check": "warn"
183
- }
184
- };
185
-
186
- // configs/markdown.ts
187
- var markdownConfigs = [
188
- ...default18.configs.processor.map((config) => ({
189
- ...config,
190
- name: `component-hook/${config.name}`
191
- })),
192
- {
193
- files: [`**/*.md/${SRC}`, `**/*.md/${VUE}`],
194
- name: "component-hook/markdown-rules",
195
- rules: {
196
- "no-alert": "off",
197
- "no-console": "off",
198
- "no-restricted-imports": "off",
199
- "no-undef": "off",
200
- "no-unused-expressions": "off",
201
- "no-unused-vars": "off",
202
- "@typescript-eslint/consistent-type-imports": "off",
203
- "@typescript-eslint/no-extraneous-class": "off",
204
- "@typescript-eslint/no-namespace": "off",
205
- "@typescript-eslint/no-redeclare": "off",
206
- "@typescript-eslint/no-require-imports": "off",
207
- "@typescript-eslint/no-unused-expressions": "off",
208
- "@typescript-eslint/no-unused-vars": "off",
209
- "@typescript-eslint/no-use-before-define": "off",
210
- "import/no-default-export": "off",
211
- "sonarjs/no-dead-store": "off",
212
- "sonarjs/unused-import": "off",
213
- "sonarjs/no-unused-vars": "off"
214
- }
215
- }
216
- ];
217
-
218
- // configs/perfectionist.ts
219
- var perfectionistConfig = {
220
- name: "component-hook/perfectionist/import",
221
- plugins: {
222
- perfectionist: default22
223
- },
224
- rules: {
225
- "perfectionist/sort-imports": [
226
- "error",
227
- {
228
- groups: [
229
- "builtin",
230
- "external",
231
- "internal",
232
- "internal-type",
233
- "parent",
234
- "parent-type",
235
- "sibling",
236
- "sibling-type",
237
- "index",
238
- "index-type",
239
- "object",
240
- "type",
241
- "side-effect",
242
- "side-effect-style"
243
- ],
244
- internalPattern: ["^[~@#]/.*"],
245
- newlinesBetween: "ignore"
246
- }
247
- ],
248
- "perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
249
- "perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
250
- }
251
- };
252
-
253
- // configs/playwright.ts
254
- var playwrightConfig = {
255
- ...default14.configs["flat/recommended"],
256
- name: "component-hook/playwright"
257
- };
258
-
259
- // configs/prettier.ts
260
- var rules2 = { ...default11.rules };
261
- delete rules2["vue/html-self-closing"];
262
- var prettierConfig = {
263
- name: "component-hook/prettier",
264
- plugins: {
265
- prettier: default10
266
- },
267
- rules: {
268
- ...rules2,
269
- "prettier/prettier": "warn"
270
- }
271
- };
272
-
273
- // configs/react.ts
274
- var reactConfigs = [
275
- {
276
- ...default5.configs.flat?.recommended,
277
- name: "component-hook/react",
278
- settings: {
279
- react: {
280
- version: "detect"
281
- }
282
- },
283
- rules: {
284
- ...default5.configs.flat?.recommended.rules,
285
- ...default5.configs.flat?.["jsx-runtime"].rules
286
- }
287
- },
288
- {
289
- name: "component-hook/react-hooks",
290
- files: ["**/*.[jt]s?(x)"],
291
- plugins: {
292
- "react-hooks": default6
293
- },
294
- rules: {
295
- ...default6.configs.recommended.rules
296
- }
297
- },
298
- {
299
- ...default7.flatConfigs.recommended,
300
- name: "component-hook/jsx-a11y"
301
- }
302
- ];
303
-
304
- // configs/regexp.ts
305
- var regexpConfig = {
306
- ...default16.configs["flat/recommended"],
307
- name: "component-hook/regexp"
308
- };
309
-
310
- // configs/security.ts
311
- var securityConfig = {
312
- name: "component-hook/security",
313
- plugins: {
314
- security: default13
315
- },
316
- rules: {
317
- ...default13.configs.recommended.rules,
318
- "security/detect-object-injection": "off"
319
- }
320
- };
321
-
322
- // configs/sonarjs.ts
323
- var plugins2 = {
324
- sonarjs: default12
325
- };
326
- var { settings } = default12.configs.recommended;
327
- var sonarjsConfigs = [
328
- {
329
- name: "component-hook/sonarjs",
330
- plugins: plugins2,
331
- rules: {
332
- ...default12.configs.recommended.rules,
333
- "sonarjs/no-commented-code": "warn"
334
- },
335
- settings
336
- },
337
- {
338
- name: "component-hook/sonarjs/allow-in-markdown",
339
- files: ["**/*.md/**"],
340
- plugins: plugins2,
341
- rules: {
342
- "sonarjs/unused-import": "off",
343
- "sonarjs/no-unused-vars": "off"
344
- },
345
- settings
346
- }
347
- ];
348
-
349
- // configs/testing-library.ts
350
- var configs = default15.configs;
351
- var plugins3 = {
352
- "testing-library": default15
353
- };
354
- var testingLibraryDomConfig = {
355
- name: "component-hook/testing-library/dom",
356
- plugins: plugins3,
357
- rules: {
358
- ...configs["flat/dom"].rules
359
- }
360
- };
361
- var testingLibraryAngularConfig = {
362
- name: "component-hook/testing-library/angular",
363
- plugins: plugins3,
364
- rules: {
365
- ...configs["flat/angular"].rules
366
- }
367
- };
368
- var testingLibraryReactConfig = {
369
- name: "component-hook/testing-library/react",
370
- plugins: plugins3,
371
- rules: {
372
- ...configs["flat/react"].rules
373
- }
374
- };
375
- var testingLibraryVueConfig = {
376
- name: "component-hook/testing-library/vue",
377
- plugins: plugins3,
378
- rules: {
379
- ...configs["flat/vue"].rules
380
- }
381
- };
382
- var testingLibraryMarkoConfig = {
383
- name: "component-hook/testing-library/marko",
384
- plugins: plugins3,
385
- rules: {
386
- ...configs["flat/marko"].rules
387
- }
388
- };
389
-
390
- // configs/typescript.ts
391
- var rules3 = {
392
- "@typescript-eslint/ban-ts-comment": "off",
393
- "@typescript-eslint/no-explicit-any": "off",
394
- "@typescript-eslint/no-unsafe-function-type": "off",
395
- "@typescript-eslint/no-shadow": "error",
396
- "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "_" }],
397
- "@typescript-eslint/no-useless-constructor": "error",
398
- "@typescript-eslint/prefer-literal-enum-member": ["error", { allowBitwiseExpressions: true }],
399
- "@typescript-eslint/no-unused-expressions": [
400
- "error",
401
- {
402
- allowShortCircuit: true,
403
- allowTaggedTemplates: true,
404
- allowTernary: true
405
- }
406
- ]
407
- };
408
- var typescriptConfigs = default4.config({
409
- extends: [...default4.configs.recommended],
410
- files: ["**/*.ts", "**/*.tsx"],
411
- name: "component-hook/typescript",
412
- rules: rules3
413
- });
414
-
415
- // configs/unicorn.ts
416
- var unicornConfig = {
417
- name: "component-hook/unicorn",
418
- plugins: {
419
- unicorn: default20
420
- },
421
- rules: {
422
- "unicorn/catch-error-name": "error",
423
- "unicorn/consistent-empty-array-spread": "error",
424
- "unicorn/consistent-existence-index-check": "error",
425
- "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
426
- "unicorn/consistent-date-clone": "error",
427
- "unicorn/custom-error-definition": "error",
428
- "unicorn/error-message": "error",
429
- "unicorn/escape-case": "error",
430
- "unicorn/filename-case": [
431
- "error",
432
- {
433
- cases: { kebabCase: true, pascalCase: true },
434
- ignore: [/^[A-Z]+\..*$/, /import_map\.json/]
435
- }
436
- ],
437
- "unicorn/new-for-builtins": "error",
438
- "unicorn/no-array-method-this-argument": "error",
439
- // Browser compatibility issues
440
- // 'unicorn/no-array-reverse': 'error',
441
- "unicorn/no-await-in-promise-methods": "error",
442
- "unicorn/no-console-spaces": "error",
443
- "unicorn/no-for-loop": "error",
444
- "unicorn/no-hex-escape": "error",
445
- "unicorn/no-instanceof-builtins": "error",
446
- "unicorn/no-invalid-remove-event-listener": "error",
447
- "unicorn/no-lonely-if": "error",
448
- "unicorn/no-negation-in-equality-check": "error",
449
- "unicorn/no-new-array": "error",
450
- "unicorn/no-new-buffer": "error",
451
- "unicorn/no-single-promise-in-promise-methods": "error",
452
- "unicorn/no-static-only-class": "error",
453
- "unicorn/no-unnecessary-array-flat-depth": "error",
454
- "unicorn/no-unnecessary-array-splice-count": "error",
455
- "unicorn/no-unnecessary-await": "error",
456
- "unicorn/no-unnecessary-slice-end": "error",
457
- "unicorn/no-useless-error-capture-stack-trace": "error",
458
- "unicorn/no-zero-fractions": `error`,
459
- "unicorn/prefer-add-event-listener": "error",
460
- "unicorn/prefer-array-find": "error",
461
- "unicorn/prefer-array-flat-map": "error",
462
- "unicorn/prefer-array-index-of": "error",
463
- "unicorn/prefer-array-some": "error",
464
- "unicorn/prefer-at": "error",
465
- "unicorn/prefer-blob-reading-methods": "error",
466
- "unicorn/prefer-class-fields": "error",
467
- "unicorn/prefer-date-now": "error",
468
- "unicorn/prefer-dom-node-append": "error",
469
- "unicorn/prefer-dom-node-dataset": "error",
470
- "unicorn/prefer-dom-node-remove": "error",
471
- "unicorn/prefer-dom-node-text-content": "error",
472
- "unicorn/prefer-includes": "error",
473
- "unicorn/prefer-keyboard-event-key": "error",
474
- "unicorn/prefer-math-min-max": "error",
475
- "unicorn/prefer-math-trunc": "error",
476
- "unicorn/prefer-modern-dom-apis": "error",
477
- "unicorn/prefer-modern-math-apis": "error",
478
- "unicorn/prefer-negative-index": "error",
479
- "unicorn/prefer-node-protocol": "error",
480
- "unicorn/prefer-number-properties": "error",
481
- "unicorn/prefer-optional-catch-binding": "error",
482
- "unicorn/prefer-prototype-methods": "error",
483
- "unicorn/prefer-query-selector": "error",
484
- "unicorn/prefer-reflect-apply": "error",
485
- "unicorn/prefer-regexp-test": "error",
486
- "unicorn/prefer-single-call": "error",
487
- "unicorn/prefer-string-raw": "error",
488
- "unicorn/prefer-string-replace-all": "error",
489
- "unicorn/prefer-string-slice": "error",
490
- "unicorn/prefer-string-starts-ends-with": "error",
491
- "unicorn/prefer-string-trim-start-end": "error",
492
- "unicorn/prefer-type-error": "error",
493
- // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2710
494
- // 'unicorn/require-module-specifiers': 'error',
495
- "unicorn/throw-new-error": "error"
496
- }
497
- };
498
-
499
- // configs/vue.ts
500
- var recommendedRules = default8.configs["flat/recommended"].map((config) => config.rules).reduce((acc, rules5) => ({ ...acc, ...rules5 }), {});
501
- var rules4 = {
502
- "vue/block-order": ["error", { order: ["script", "template", "style"] }],
503
- "vue/custom-event-name-casing": ["error", "camelCase"],
504
- "vue/eqeqeq": ["error", "smart"],
505
- "vue/html-self-closing": [
506
- "error",
507
- {
508
- html: {
509
- component: "always",
510
- normal: "never",
511
- void: "always"
512
- },
513
- math: "always",
514
- svg: "always"
515
- }
516
- ],
517
- "vue/max-attributes-per-line": "off",
518
- "vue/multi-word-component-names": "off",
519
- "vue/no-constant-condition": "warn",
520
- "vue/no-empty-pattern": "error",
521
- "vue/no-loss-of-precision": "error",
522
- "vue/no-ref-as-operand": "off",
523
- "vue/no-unused-refs": "error",
524
- "vue/no-useless-v-bind": "error",
525
- "vue/no-v-html": "off",
526
- "vue/object-shorthand": [
527
- "error",
528
- "always",
529
- {
530
- avoidQuotes: true,
531
- ignoreConstructors: false
532
- }
533
- ],
534
- "vue/one-component-per-file": "off",
535
- "vue/padding-line-between-blocks": ["error", "always"],
536
- "vue/prefer-template": "error",
537
- "vue/require-default-prop": "off",
538
- "vue/require-prop-types": "off",
539
- "vue/no-setup-props-reactivity-loss": "off"
540
- };
541
- var extendsTypescript = default4.configs.recommended.filter(({ name }) => name !== "typescript-eslint/base").map((config) => ({ ...config, name: `component-hook/vue/${config.name}` }));
542
- var eslintConfigTypescript = default4.config({
543
- extends: extendsTypescript,
544
- files: [VUE],
545
- name: "component-hook/vue/typescript",
546
- rules: rules3
547
- });
548
- var vueConfigs = [
549
- ...eslintConfigTypescript,
550
- {
551
- name: "component-hook/vue/globals",
552
- files: [VUE],
553
- languageOptions: {
554
- globals: {
555
- defineProps: "readonly",
556
- defineEmits: "readonly",
557
- defineExpose: "readonly",
558
- defineModel: "readonly",
559
- withDefaults: "readonly",
560
- $: "readonly",
561
- $$: "readonly",
562
- $computed: "readonly",
563
- $customRef: "readonly",
564
- $ref: "readonly",
565
- $shallowRef: "readonly",
566
- $toRef: "readonly"
567
- }
568
- }
569
- },
570
- {
571
- name: "component-hook/vue",
572
- files: [VUE],
573
- plugins: {
574
- "@typescript-eslint": default4.plugin,
575
- vue: default8
576
- },
577
- languageOptions: {
578
- parser: default9,
579
- parserOptions: {
580
- parser: "@typescript-eslint/parser",
581
- extraFileExtensions: [".vue"],
582
- sourceType: "module",
583
- ecmaFeatures: {
584
- jsx: true
585
- }
586
- }
587
- },
588
- processor: default8.processors[".vue"],
589
- rules: {
590
- ...recommendedRules,
591
- ...rules4
592
- }
593
- }
594
- ];
595
-
596
- // index.ts
597
- var basicConfigs = [
598
- ...jsConfigs,
599
- ...typescriptConfigs,
600
- ...commentsConfigs,
601
- ...importConfigs,
602
- unicornConfig,
603
- jsdocConfig,
604
- regexpConfig,
605
- deMorganConfig,
606
- perfectionistConfig,
607
- {
608
- name: "component-hook/globals",
609
- languageOptions: {
610
- ecmaVersion: "latest",
611
- globals: {
612
- ...default2.node,
613
- ...default2.browser
614
- }
615
- }
616
- },
617
- ignores
618
- ];
619
- var configs2 = {
620
- basic: basicConfigs,
621
- react: reactConfigs,
622
- vue: vueConfigs,
623
- markdown: markdownConfigs,
624
- prettier: prettierConfig,
625
- sonarjs: sonarjsConfigs,
626
- security: securityConfig,
627
- playwright: playwrightConfig,
628
- "testing-library/dom": testingLibraryDomConfig,
629
- "testing-library/vue": testingLibraryVueConfig,
630
- "testing-library/react": testingLibraryReactConfig,
631
- "testing-library/angular": testingLibraryAngularConfig,
632
- "testing-library/marko": testingLibraryMarkoConfig
633
- };
634
- var index_default = { configs: configs2 };
635
- var basicPreset = [prettierConfig, ...sonarjsConfigs, securityConfig, ...markdownConfigs];
636
- var reactPreset = [...basicConfigs, ...reactConfigs, ...basicPreset];
637
- var vuePreset = [...basicConfigs, ...vueConfigs, ...basicPreset];
638
- export {
639
- index_default as default,
640
- reactPreset,
641
- vuePreset
642
- };