@component-hook/eslint-plugin 1.5.0 → 1.6.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.cjs DELETED
@@ -1,911 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- //#region \0rolldown/runtime.js
6
- var __create = Object.create;
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __getOwnPropNames = Object.getOwnPropertyNames;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __copyProps = (to, from, except, desc) => {
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
- });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
- //#endregion
27
- let globals = require("globals");
28
- globals = __toESM(globals, 1);
29
- let _eslint_js = require("@eslint/js");
30
- _eslint_js = __toESM(_eslint_js, 1);
31
- let typescript_eslint = require("typescript-eslint");
32
- typescript_eslint = __toESM(typescript_eslint, 1);
33
- let eslint_plugin_react = require("eslint-plugin-react");
34
- eslint_plugin_react = __toESM(eslint_plugin_react, 1);
35
- let eslint_plugin_react_hooks = require("eslint-plugin-react-hooks");
36
- eslint_plugin_react_hooks = __toESM(eslint_plugin_react_hooks, 1);
37
- let eslint_plugin_jsx_a11y = require("eslint-plugin-jsx-a11y");
38
- eslint_plugin_jsx_a11y = __toESM(eslint_plugin_jsx_a11y, 1);
39
- let eslint_plugin_vue = require("eslint-plugin-vue");
40
- eslint_plugin_vue = __toESM(eslint_plugin_vue, 1);
41
- let vue_eslint_parser = require("vue-eslint-parser");
42
- vue_eslint_parser = __toESM(vue_eslint_parser, 1);
43
- let eslint_plugin_prettier = require("eslint-plugin-prettier");
44
- eslint_plugin_prettier = __toESM(eslint_plugin_prettier, 1);
45
- let eslint_plugin_prettier_recommended = require("eslint-plugin-prettier/recommended");
46
- eslint_plugin_prettier_recommended = __toESM(eslint_plugin_prettier_recommended, 1);
47
- let eslint_plugin_sonarjs = require("eslint-plugin-sonarjs");
48
- eslint_plugin_sonarjs = __toESM(eslint_plugin_sonarjs, 1);
49
- let eslint_plugin_security = require("eslint-plugin-security");
50
- eslint_plugin_security = __toESM(eslint_plugin_security, 1);
51
- let eslint_plugin_playwright = require("eslint-plugin-playwright");
52
- eslint_plugin_playwright = __toESM(eslint_plugin_playwright, 1);
53
- let eslint_plugin_testing_library = require("eslint-plugin-testing-library");
54
- eslint_plugin_testing_library = __toESM(eslint_plugin_testing_library, 1);
55
- let eslint_plugin_regexp = require("eslint-plugin-regexp");
56
- eslint_plugin_regexp = __toESM(eslint_plugin_regexp, 1);
57
- let eslint_plugin_import = require("eslint-plugin-import");
58
- eslint_plugin_import = __toESM(eslint_plugin_import, 1);
59
- let _eslint_markdown = require("@eslint/markdown");
60
- _eslint_markdown = __toESM(_eslint_markdown, 1);
61
- let _eslint_community_eslint_plugin_eslint_comments_configs = require("@eslint-community/eslint-plugin-eslint-comments/configs");
62
- _eslint_community_eslint_plugin_eslint_comments_configs = __toESM(_eslint_community_eslint_plugin_eslint_comments_configs, 1);
63
- let eslint_plugin_unicorn = require("eslint-plugin-unicorn");
64
- eslint_plugin_unicorn = __toESM(eslint_plugin_unicorn, 1);
65
- let eslint_plugin_de_morgan = require("eslint-plugin-de-morgan");
66
- eslint_plugin_de_morgan = __toESM(eslint_plugin_de_morgan, 1);
67
- let eslint_plugin_perfectionist = require("eslint-plugin-perfectionist");
68
- eslint_plugin_perfectionist = __toESM(eslint_plugin_perfectionist, 1);
69
- let eslint_plugin_jsdoc = require("eslint-plugin-jsdoc");
70
- eslint_plugin_jsdoc = __toESM(eslint_plugin_jsdoc, 1);
71
- let eslint_plugin_jsonc = require("eslint-plugin-jsonc");
72
- eslint_plugin_jsonc = __toESM(eslint_plugin_jsonc, 1);
73
- let jsonc_eslint_parser = require("jsonc-eslint-parser");
74
- let eslint_plugin_yml = require("eslint-plugin-yml");
75
- eslint_plugin_yml = __toESM(eslint_plugin_yml, 1);
76
- let eslint_config = require("eslint/config");
77
- //#region configs/comments.ts
78
- const commentsConfigs = [{
79
- ..._eslint_community_eslint_plugin_eslint_comments_configs.default.recommended,
80
- name: "component-hook/comments/recommended"
81
- }, {
82
- name: "component-hook/comments",
83
- rules: { "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }] }
84
- }];
85
- //#endregion
86
- //#region configs/de-morgan.ts
87
- const deMorganConfig = {
88
- ...eslint_plugin_de_morgan.default.configs.recommended,
89
- name: "component-hook/de-morgan"
90
- };
91
- //#endregion
92
- //#region configs/ignores.ts
93
- const ignores = {
94
- name: "component-hook/ignores",
95
- ignores: [
96
- "**/node_modules",
97
- "**/dist",
98
- "**/pnpm-lock.yaml",
99
- "**/yarn.lock",
100
- "**/package-lock.json",
101
- "**/bun.lockb",
102
- "output",
103
- "**/coverage",
104
- "**/playwright-report",
105
- "**/temp",
106
- "**/fixtures",
107
- "**/.vitepress/cache",
108
- "**/.nuxt",
109
- "**/.vercel",
110
- "**/.changeset",
111
- "**/.idea",
112
- "**/.output",
113
- "**/.vite-inspect",
114
- "**/.context",
115
- "**/.nitro",
116
- "**/CHANGELOG*.md",
117
- "**/*.min.*",
118
- "**/LICENSE*",
119
- "**/__snapshots__",
120
- "**/auto-import?(s).d.ts",
121
- "**/components.d.ts",
122
- "**/vite-env.d.ts",
123
- "**/shims-vue.d.ts",
124
- "**/.turbo",
125
- "**/mockServiceWorker.js"
126
- ]
127
- };
128
- //#endregion
129
- //#region constants.ts
130
- const SRC = "**/*.?([cm])[jt]s?(x)";
131
- const SRC_EXT = "?([cm])[jt]s?(x)";
132
- const JSX = "**/*.jsx";
133
- const TSX = "**/*.tsx";
134
- const VUE = "**/*.vue";
135
- const BLOB_JSON = "**/*.json";
136
- const JSON5 = "**/*.json5";
137
- const JSONC = "**/*.jsonc";
138
- const RESTRICTED_SYNTAX = ["ForInStatement", "LabeledStatement"];
139
- //#endregion
140
- //#region configs/import.ts
141
- const plugins$2 = {
142
- import: eslint_plugin_import.default,
143
- "@typescript-eslint": typescript_eslint.default.plugin
144
- };
145
- const languageOptions = {
146
- parser: vue_eslint_parser.default,
147
- parserOptions: {
148
- parser: "@typescript-eslint/parser",
149
- sourceType: "module",
150
- ecmaVersion: "latest"
151
- }
152
- };
153
- const importConfigs = [{
154
- name: "component-hook/import",
155
- plugins: plugins$2,
156
- languageOptions,
157
- rules: {
158
- "import/first": "error",
159
- "import/no-default-export": "error",
160
- "import/no-duplicates": ["error", { "prefer-inline": true }],
161
- "import/no-mutable-exports": "error",
162
- "import/no-named-default": "error",
163
- "import/no-self-import": "error",
164
- "import/no-webpack-loader-syntax": "error"
165
- }
166
- }, {
167
- name: "component-hook/import/allow-default-export",
168
- files: [
169
- "**/*.d.ts",
170
- "**/*.md/**",
171
- `**/*config*.${SRC_EXT}`,
172
- `**/{views,pages,routes,middleware,plugins,api,modules}/**/*.${SRC_EXT}`,
173
- `**/{index,vite,esbuild,rollup,rolldown,webpack,rspack,farm,unloader,nuxt}.${SRC_EXT}`
174
- ],
175
- plugins: plugins$2,
176
- languageOptions,
177
- rules: { "import/no-default-export": "off" }
178
- }];
179
- //#endregion
180
- //#region configs/javascript.ts
181
- const jsConfigs = [{
182
- name: "component-hook/javascript",
183
- rules: {
184
- ..._eslint_js.default.configs.recommended.rules,
185
- "no-useless-call": "error",
186
- "no-useless-computed-key": "error",
187
- "no-useless-constructor": "error",
188
- "no-useless-rename": "error",
189
- "no-var": "error",
190
- "no-console": ["warn", { allow: [
191
- "warn",
192
- "error",
193
- "info",
194
- "clear"
195
- ] }],
196
- "no-debugger": "warn",
197
- "no-eval": "error",
198
- "no-loop-func": "error",
199
- "no-dupe-class-members": "error",
200
- "no-duplicate-imports": "error",
201
- "object-shorthand": "error",
202
- "prefer-const": "error",
203
- "prefer-template": "error",
204
- eqeqeq: "error",
205
- "no-restricted-syntax": ["error", ...RESTRICTED_SYNTAX]
206
- }
207
- }, {
208
- name: "component-hook/globals",
209
- languageOptions: {
210
- ecmaVersion: "latest",
211
- globals: {
212
- ...globals.default.node,
213
- ...globals.default.browser,
214
- ...globals.default.es2026
215
- }
216
- }
217
- }];
218
- //#endregion
219
- //#region configs/jsdoc.ts
220
- const jsdocConfig = {
221
- name: "component-hook/jsdoc",
222
- plugins: { jsdoc: eslint_plugin_jsdoc.default },
223
- rules: {
224
- "jsdoc/check-access": "warn",
225
- "jsdoc/check-param-names": "warn",
226
- "jsdoc/check-property-names": "warn",
227
- "jsdoc/check-types": "warn",
228
- "jsdoc/empty-tags": "warn",
229
- "jsdoc/implements-on-classes": "warn",
230
- "jsdoc/no-defaults": "warn",
231
- "jsdoc/no-multi-asterisks": "warn",
232
- "jsdoc/require-param-name": "warn",
233
- "jsdoc/require-property": "warn",
234
- "jsdoc/require-property-description": "warn",
235
- "jsdoc/require-property-name": "warn",
236
- "jsdoc/require-returns-check": "warn",
237
- "jsdoc/require-returns-description": "warn",
238
- "jsdoc/require-yields-check": "warn"
239
- }
240
- };
241
- //#endregion
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
- }), {});
247
- const jsoncConfigs = [
248
- {
249
- name: "component-hook/jsonc",
250
- files: [
251
- BLOB_JSON,
252
- JSON5,
253
- JSONC
254
- ],
255
- language: "jsonc/x",
256
- plugins: { jsonc: eslint_plugin_jsonc.default },
257
- languageOptions: { parser: jsonc_eslint_parser.parseForESLint },
258
- rules: {
259
- ...recommendedRules$1,
260
- "jsonc/quote-props": "off",
261
- "jsonc/quotes": "off"
262
- }
263
- },
264
- {
265
- name: "component-hook/jsonc/package-json",
266
- files: ["**/package.json"],
267
- rules: {
268
- "jsonc/sort-array-values": ["error", {
269
- order: { type: "asc" },
270
- pathPattern: "^files$"
271
- }],
272
- "jsonc/sort-keys": [
273
- "error",
274
- {
275
- order: [
276
- "publisher",
277
- "name",
278
- "displayName",
279
- "type",
280
- "version",
281
- "private",
282
- "packageManager",
283
- "description",
284
- "author",
285
- "contributors",
286
- "license",
287
- "funding",
288
- "homepage",
289
- "repository",
290
- "bugs",
291
- "keywords",
292
- "categories",
293
- "sideEffects",
294
- "imports",
295
- "exports",
296
- "main",
297
- "module",
298
- "unpkg",
299
- "jsdelivr",
300
- "types",
301
- "typesVersions",
302
- "bin",
303
- "icon",
304
- "files",
305
- "engines",
306
- "activationEvents",
307
- "contributes",
308
- "scripts",
309
- "peerDependencies",
310
- "peerDependenciesMeta",
311
- "dependencies",
312
- "inlinedDependencies",
313
- "optionalDependencies",
314
- "devDependencies",
315
- "pnpm",
316
- "overrides",
317
- "resolutions",
318
- "husky",
319
- "simple-git-hooks",
320
- "lint-staged",
321
- "eslintConfig",
322
- "prettier",
323
- "tsdown"
324
- ],
325
- pathPattern: "^$"
326
- },
327
- {
328
- order: { type: "asc" },
329
- pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
330
- },
331
- {
332
- order: [
333
- "types",
334
- "import",
335
- "require",
336
- "default"
337
- ],
338
- pathPattern: "^exports.*$"
339
- },
340
- {
341
- order: { type: "asc" },
342
- pathPattern: String.raw`^(?:resolutions|overrides|pnpm\.overrides)$`
343
- }
344
- ]
345
- }
346
- },
347
- {
348
- name: "component-hook/jsonc/tsconfig",
349
- files: ["**/[jt]sconfig.json", "**/[jt]sconfig.*.json"],
350
- rules: { "jsonc/sort-keys": [
351
- "error",
352
- {
353
- order: [
354
- "extends",
355
- "compilerOptions",
356
- "references",
357
- "files",
358
- "include",
359
- "exclude"
360
- ],
361
- pathPattern: "^$"
362
- },
363
- {
364
- order: [
365
- "incremental",
366
- "composite",
367
- "tsBuildInfoFile",
368
- "disableSourceOfProjectReferenceRedirect",
369
- "disableSolutionSearching",
370
- "disableReferencedProjectLoad",
371
- "target",
372
- "jsx",
373
- "jsxFactory",
374
- "jsxFragmentFactory",
375
- "jsxImportSource",
376
- "lib",
377
- "moduleDetection",
378
- "noLib",
379
- "reactNamespace",
380
- "useDefineForClassFields",
381
- "emitDecoratorMetadata",
382
- "experimentalDecorators",
383
- "libReplacement",
384
- "baseUrl",
385
- "rootDir",
386
- "rootDirs",
387
- "customConditions",
388
- "module",
389
- "moduleResolution",
390
- "moduleSuffixes",
391
- "noResolve",
392
- "paths",
393
- "resolveJsonModule",
394
- "resolvePackageJsonExports",
395
- "resolvePackageJsonImports",
396
- "typeRoots",
397
- "types",
398
- "allowArbitraryExtensions",
399
- "allowImportingTsExtensions",
400
- "allowUmdGlobalAccess",
401
- "allowJs",
402
- "checkJs",
403
- "maxNodeModuleJsDepth",
404
- "strict",
405
- "strictBindCallApply",
406
- "strictFunctionTypes",
407
- "strictNullChecks",
408
- "strictPropertyInitialization",
409
- "allowUnreachableCode",
410
- "allowUnusedLabels",
411
- "alwaysStrict",
412
- "exactOptionalPropertyTypes",
413
- "noFallthroughCasesInSwitch",
414
- "noImplicitAny",
415
- "noImplicitOverride",
416
- "noImplicitReturns",
417
- "noImplicitThis",
418
- "noPropertyAccessFromIndexSignature",
419
- "noUncheckedIndexedAccess",
420
- "noUnusedLocals",
421
- "noUnusedParameters",
422
- "useUnknownInCatchVariables",
423
- "declaration",
424
- "declarationDir",
425
- "declarationMap",
426
- "downlevelIteration",
427
- "emitBOM",
428
- "emitDeclarationOnly",
429
- "importHelpers",
430
- "importsNotUsedAsValues",
431
- "inlineSourceMap",
432
- "inlineSources",
433
- "mapRoot",
434
- "newLine",
435
- "noEmit",
436
- "noEmitHelpers",
437
- "noEmitOnError",
438
- "outDir",
439
- "outFile",
440
- "preserveConstEnums",
441
- "preserveValueImports",
442
- "removeComments",
443
- "sourceMap",
444
- "sourceRoot",
445
- "stripInternal",
446
- "allowSyntheticDefaultImports",
447
- "esModuleInterop",
448
- "forceConsistentCasingInFileNames",
449
- "isolatedDeclarations",
450
- "isolatedModules",
451
- "preserveSymlinks",
452
- "verbatimModuleSyntax",
453
- "erasableSyntaxOnly",
454
- "skipDefaultLibCheck",
455
- "skipLibCheck"
456
- ],
457
- pathPattern: "^compilerOptions$"
458
- }
459
- ] }
460
- }
461
- ];
462
- //#endregion
463
- //#region configs/markdown.ts
464
- const markdownConfigs = [..._eslint_markdown.default.configs.processor.map((config) => ({
465
- ...config,
466
- name: `component-hook/${config.name}`
467
- })), {
468
- files: [`**/*.md/${SRC}`, `**/*.md/${VUE}`],
469
- name: "component-hook/markdown-rules",
470
- rules: {
471
- "no-alert": "off",
472
- "no-console": "off",
473
- "no-restricted-imports": "off",
474
- "no-undef": "off",
475
- "no-unused-expressions": "off",
476
- "no-unused-vars": "off",
477
- "@typescript-eslint/consistent-type-imports": "off",
478
- "@typescript-eslint/no-extraneous-class": "off",
479
- "@typescript-eslint/no-namespace": "off",
480
- "@typescript-eslint/no-redeclare": "off",
481
- "@typescript-eslint/no-require-imports": "off",
482
- "@typescript-eslint/no-unused-expressions": "off",
483
- "@typescript-eslint/no-unused-vars": "off",
484
- "@typescript-eslint/no-use-before-define": "off",
485
- "sonarjs/no-dead-store": "off",
486
- "sonarjs/unused-import": "off",
487
- "sonarjs/no-unused-vars": "off",
488
- "unicorn/no-useless-undefined": "off",
489
- "unicorn/no-anonymous-default-export": "off"
490
- }
491
- }];
492
- //#endregion
493
- //#region configs/perfectionist.ts
494
- const perfectionistConfig = {
495
- name: "component-hook/perfectionist/imports",
496
- plugins: { perfectionist: eslint_plugin_perfectionist.default },
497
- rules: {
498
- "perfectionist/sort-imports": ["error", {
499
- groups: [
500
- "builtin",
501
- "external",
502
- "internal",
503
- "parent",
504
- "subpath",
505
- "sibling",
506
- "index",
507
- "style",
508
- "type",
509
- "side-effect",
510
- "side-effect-style"
511
- ],
512
- internalPattern: ["^[~@#]/.*"],
513
- newlinesBetween: "ignore",
514
- type: "natural"
515
- }],
516
- "perfectionist/sort-named-exports": ["warn", {
517
- groups: ["value-export", "type-export"],
518
- type: "natural"
519
- }],
520
- "perfectionist/sort-named-imports": ["warn", {
521
- groups: ["value-import", "type-import"],
522
- type: "natural"
523
- }]
524
- }
525
- };
526
- //#endregion
527
- //#region configs/playwright.ts
528
- const playwrightConfig = {
529
- ...eslint_plugin_playwright.default.configs["flat/recommended"],
530
- name: "component-hook/playwright"
531
- };
532
- //#endregion
533
- //#region configs/prettier.ts
534
- const rules$1 = Object.fromEntries(Object.entries(eslint_plugin_prettier_recommended.default.rules ?? {}).filter(([name]) => name !== "vue/html-self-closing"));
535
- const prettierConfig = {
536
- name: "component-hook/prettier",
537
- plugins: { prettier: eslint_plugin_prettier.default },
538
- rules: {
539
- ...rules$1,
540
- "prettier/prettier": "warn"
541
- }
542
- };
543
- //#endregion
544
- //#region configs/react.ts
545
- const reactConfigs = [
546
- {
547
- ...eslint_plugin_react.default.configs.flat.recommended,
548
- name: "component-hook/react",
549
- settings: { react: { version: "detect" } },
550
- rules: {
551
- ...eslint_plugin_react.default.configs.flat.recommended.rules,
552
- ...eslint_plugin_react.default.configs.flat["jsx-runtime"].rules
553
- }
554
- },
555
- {
556
- name: "component-hook/react-hooks",
557
- files: ["**/*.[jt]s?(x)"],
558
- plugins: { "react-hooks": eslint_plugin_react_hooks.default },
559
- rules: { ...eslint_plugin_react_hooks.default.configs.recommended.rules }
560
- },
561
- {
562
- ...eslint_plugin_jsx_a11y.default.flatConfigs.recommended,
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" }
569
- }
570
- ];
571
- //#endregion
572
- //#region configs/regexp.ts
573
- const regexpConfig = {
574
- ...eslint_plugin_regexp.default.configs["flat/recommended"],
575
- name: "component-hook/regexp"
576
- };
577
- //#endregion
578
- //#region configs/security.ts
579
- const securityConfig = {
580
- name: "component-hook/security",
581
- plugins: { security: eslint_plugin_security.default },
582
- rules: {
583
- ...eslint_plugin_security.default.configs.recommended.rules,
584
- "security/detect-object-injection": "off"
585
- }
586
- };
587
- //#endregion
588
- //#region configs/sonarjs.ts
589
- const plugins$1 = { sonarjs: eslint_plugin_sonarjs.default };
590
- const recommended = eslint_plugin_sonarjs.default.configs?.recommended;
591
- const { settings } = recommended;
592
- const sonarjsConfigs = [{
593
- name: "component-hook/sonarjs",
594
- plugins: plugins$1,
595
- rules: {
596
- ...recommended.rules,
597
- "sonarjs/no-commented-code": "warn"
598
- },
599
- settings
600
- }, {
601
- name: "component-hook/sonarjs/allow-in-markdown",
602
- files: ["**/*.md/**"],
603
- plugins: plugins$1,
604
- rules: {
605
- "sonarjs/unused-import": "off",
606
- "sonarjs/no-unused-vars": "off"
607
- },
608
- settings
609
- }];
610
- //#endregion
611
- //#region configs/testing-library.ts
612
- const configs$1 = eslint_plugin_testing_library.default.configs;
613
- const plugins = { "testing-library": eslint_plugin_testing_library.default };
614
- const testingLibraryDomConfig = {
615
- name: "component-hook/testing-library/dom",
616
- plugins,
617
- rules: { ...configs$1["flat/dom"].rules }
618
- };
619
- const testingLibraryAngularConfig = {
620
- name: "component-hook/testing-library/angular",
621
- plugins,
622
- rules: { ...configs$1["flat/angular"].rules }
623
- };
624
- const testingLibraryReactConfig = {
625
- name: "component-hook/testing-library/react",
626
- plugins,
627
- rules: { ...configs$1["flat/react"].rules }
628
- };
629
- const testingLibraryVueConfig = {
630
- name: "component-hook/testing-library/vue",
631
- plugins,
632
- rules: { ...configs$1["flat/vue"].rules }
633
- };
634
- const testingLibraryMarkoConfig = {
635
- name: "component-hook/testing-library/marko",
636
- plugins,
637
- rules: { ...configs$1["flat/marko"].rules }
638
- };
639
- //#endregion
640
- //#region configs/typescript.ts
641
- const typescriptCoreConfig = (0, eslint_config.defineConfig)({
642
- extends: [...typescript_eslint.default.configs.recommended],
643
- files: ["**/*.ts", "**/*.tsx"],
644
- name: "component-hook/typescript",
645
- rules: {
646
- "@typescript-eslint/ban-ts-comment": "off",
647
- "@typescript-eslint/no-explicit-any": "off",
648
- "@typescript-eslint/no-unsafe-function-type": "off",
649
- "@typescript-eslint/no-shadow": "error",
650
- "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "_" }],
651
- "@typescript-eslint/no-useless-constructor": "error",
652
- "@typescript-eslint/prefer-literal-enum-member": ["error", { allowBitwiseExpressions: true }],
653
- "@typescript-eslint/no-unused-expressions": ["error", {
654
- allowShortCircuit: true,
655
- allowTaggedTemplates: true,
656
- allowTernary: true
657
- }],
658
- "@typescript-eslint/consistent-type-assertions": ["error", {
659
- assertionStyle: "as",
660
- objectLiteralTypeAssertions: "allow-as-parameter"
661
- }],
662
- "@typescript-eslint/consistent-type-imports": ["error", {
663
- disallowTypeAnnotations: false,
664
- fixStyle: "inline-type-imports"
665
- }],
666
- "@typescript-eslint/method-signature-style": ["error", "property"],
667
- "@typescript-eslint/no-import-type-side-effects": "error",
668
- "@typescript-eslint/no-redeclare": "error",
669
- "no-restricted-syntax": [
670
- "error",
671
- "TSEnumDeclaration[const=true]",
672
- ...RESTRICTED_SYNTAX
673
- ]
674
- }
675
- });
676
- const typescriptConfigs = [...typescriptCoreConfig, {
677
- files: ["**/*.d.ts"],
678
- name: "component-hook/typescript/dts-rules",
679
- rules: {
680
- "eslint-comments/no-unlimited-disable": "off",
681
- "import/no-duplicates": "off",
682
- "no-restricted-syntax": "off",
683
- "unused-imports/no-unused-vars": "off"
684
- }
685
- }];
686
- //#endregion
687
- //#region configs/unicorn.ts
688
- const unicornConfigs = [
689
- {
690
- ...eslint_plugin_unicorn.default.configs.unopinionated,
691
- name: "component-hook/unicorn/unopinionated"
692
- },
693
- {
694
- name: "component-hook/unicorn",
695
- rules: {
696
- "unicorn/catch-error-name": "error",
697
- "unicorn/consistent-empty-array-spread": "error",
698
- "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
699
- "unicorn/custom-error-definition": "error",
700
- "unicorn/filename-case": ["error", {
701
- cases: {
702
- kebabCase: true,
703
- pascalCase: true
704
- },
705
- ignore: [
706
- /^[A-Z]+\..*$/,
707
- /^[a-z]{2}-[A-Za-z]{2}(\.\w+)?$/,
708
- /import_map\.json/
709
- ]
710
- }],
711
- "unicorn/import-style": "off",
712
- "unicorn/no-abusive-eslint-disable": "off",
713
- "unicorn/no-array-for-each": "off",
714
- "unicorn/no-duplicate-set-values": "error",
715
- "unicorn/no-empty-file": "off",
716
- "unicorn/no-for-loop": "error",
717
- "unicorn/no-process-exit": "off",
718
- "unicorn/no-this-assignment": "off",
719
- "unicorn/no-unreadable-array-destructuring": "off",
720
- "unicorn/no-useless-undefined": ["error", {
721
- checkArguments: false,
722
- checkArrowFunctionBody: false
723
- }],
724
- "unicorn/numeric-separators-style": "off",
725
- "unicorn/prefer-module": "off",
726
- "unicorn/prefer-query-selector": "error",
727
- "unicorn/prefer-ternary": "off",
728
- "unicorn/prefer-top-level-await": "off",
729
- "unicorn/require-module-specifiers": "off"
730
- }
731
- },
732
- {
733
- name: "component-hook/unicorn/allow-filename-case",
734
- files: ["**/ISSUE_TEMPLATE/**"],
735
- rules: { "unicorn/filename-case": "off" }
736
- }
737
- ];
738
- //#endregion
739
- //#region configs/vue.ts
740
- const recommendedRules = eslint_plugin_vue.default.configs["flat/recommended"].map((config) => config.rules).reduce((acc, rules) => ({
741
- ...acc,
742
- ...rules
743
- }), {});
744
- const rules = {
745
- "vue/block-order": ["error", { order: [
746
- "script",
747
- "template",
748
- "style"
749
- ] }],
750
- "vue/custom-event-name-casing": ["error", "camelCase"],
751
- "vue/eqeqeq": ["error", "smart"],
752
- "vue/html-self-closing": ["error", {
753
- html: {
754
- component: "always",
755
- normal: "never",
756
- void: "always"
757
- },
758
- math: "always",
759
- svg: "always"
760
- }],
761
- "vue/max-attributes-per-line": "off",
762
- "vue/multi-word-component-names": "off",
763
- "vue/no-constant-condition": "warn",
764
- "vue/no-empty-pattern": "error",
765
- "vue/no-loss-of-precision": "error",
766
- "vue/no-ref-as-operand": "off",
767
- "vue/no-unused-refs": "error",
768
- "vue/no-useless-v-bind": "error",
769
- "vue/no-v-html": "off",
770
- "vue/object-shorthand": [
771
- "error",
772
- "always",
773
- {
774
- avoidQuotes: true,
775
- ignoreConstructors: false
776
- }
777
- ],
778
- "vue/one-component-per-file": "off",
779
- "vue/padding-line-between-blocks": ["error", "always"],
780
- "vue/prefer-template": "error",
781
- "vue/require-default-prop": "off",
782
- "vue/require-prop-types": "off",
783
- "vue/no-setup-props-reactivity-loss": "off",
784
- "vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
785
- };
786
- const vueConfigs = [...typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
787
- ...config,
788
- files: [VUE],
789
- name: `component-hook/vue/${config.name?.replace("component-hook/", "")}`
790
- })), {
791
- name: "component-hook/vue",
792
- files: [VUE],
793
- plugins: {
794
- "@typescript-eslint": typescript_eslint.default.plugin,
795
- vue: eslint_plugin_vue.default
796
- },
797
- languageOptions: {
798
- parser: vue_eslint_parser.default,
799
- parserOptions: {
800
- parser: typescript_eslint.default.parser,
801
- extraFileExtensions: [".vue"],
802
- sourceType: "module",
803
- ecmaFeatures: { jsx: true }
804
- }
805
- },
806
- processor: eslint_plugin_vue.default.processors[".vue"],
807
- rules: {
808
- ...recommendedRules,
809
- "no-useless-assignment": "off",
810
- ...rules
811
- }
812
- }];
813
- //#endregion
814
- //#region configs/yaml.ts
815
- const initialRules = { rules: { "yml/no-empty-mapping-value": "off" } };
816
- const yamlConfigs = [{
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
- }, {}),
831
- name: "component-hook/yaml"
832
- }, {
833
- name: "component-hook/yaml/pnpm-workspace",
834
- files: ["**/pnpm-workspace.yaml"],
835
- rules: { "yml/sort-keys": [
836
- "error",
837
- {
838
- order: [
839
- "packages",
840
- "overrides",
841
- "patchedDependencies",
842
- "defines",
843
- "catalog",
844
- "catalogs",
845
- { order: { type: "asc" } }
846
- ],
847
- pathPattern: "^$"
848
- },
849
- {
850
- allowLineSeparatedGroups: true,
851
- order: { type: "asc" },
852
- pathPattern: "^(catalog|catalogs|overrides)$"
853
- },
854
- {
855
- allowLineSeparatedGroups: true,
856
- order: { type: "asc" },
857
- pathPattern: String.raw`^catalogs\..+$`
858
- }
859
- ] }
860
- }];
861
- //#endregion
862
- //#region index.ts
863
- const basicConfigs = [
864
- ...jsConfigs,
865
- ...typescriptConfigs,
866
- ...commentsConfigs,
867
- ...importConfigs,
868
- ...unicornConfigs,
869
- jsdocConfig,
870
- regexpConfig,
871
- deMorganConfig,
872
- perfectionistConfig,
873
- ...jsoncConfigs,
874
- ...yamlConfigs,
875
- ignores
876
- ];
877
- var eslint_plugin_default = { configs: {
878
- basic: basicConfigs,
879
- react: reactConfigs,
880
- vue: vueConfigs,
881
- markdown: markdownConfigs,
882
- prettier: prettierConfig,
883
- sonarjs: sonarjsConfigs,
884
- security: securityConfig,
885
- playwright: playwrightConfig,
886
- "testing-library/dom": testingLibraryDomConfig,
887
- "testing-library/vue": testingLibraryVueConfig,
888
- "testing-library/react": testingLibraryReactConfig,
889
- "testing-library/angular": testingLibraryAngularConfig,
890
- "testing-library/marko": testingLibraryMarkoConfig
891
- } };
892
- const basicPreset = [
893
- prettierConfig,
894
- ...sonarjsConfigs,
895
- securityConfig,
896
- ...markdownConfigs
897
- ];
898
- const reactPreset = [
899
- ...basicConfigs,
900
- ...reactConfigs,
901
- ...basicPreset
902
- ];
903
- const vuePreset = [
904
- ...basicConfigs,
905
- ...vueConfigs,
906
- ...basicPreset
907
- ];
908
- //#endregion
909
- exports.default = eslint_plugin_default;
910
- exports.reactPreset = reactPreset;
911
- exports.vuePreset = vuePreset;