@component-hook/eslint-plugin 1.5.1 → 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,913 +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 || !__hasOwnProp.call(mod, "default") ? __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
- "unicorn/no-top-level-side-effects": "off"
491
- }
492
- }];
493
- //#endregion
494
- //#region configs/perfectionist.ts
495
- const perfectionistConfig = {
496
- name: "component-hook/perfectionist/imports",
497
- plugins: { perfectionist: eslint_plugin_perfectionist.default },
498
- rules: {
499
- "perfectionist/sort-imports": ["error", {
500
- groups: [
501
- "builtin",
502
- "external",
503
- "internal",
504
- "parent",
505
- "subpath",
506
- "sibling",
507
- "index",
508
- "style",
509
- "type",
510
- "side-effect",
511
- "side-effect-style"
512
- ],
513
- internalPattern: ["^[~@#]/.*"],
514
- newlinesBetween: "ignore",
515
- type: "natural"
516
- }],
517
- "perfectionist/sort-named-exports": ["warn", {
518
- groups: ["value-export", "type-export"],
519
- type: "natural"
520
- }],
521
- "perfectionist/sort-named-imports": ["warn", {
522
- groups: ["value-import", "type-import"],
523
- type: "natural"
524
- }]
525
- }
526
- };
527
- //#endregion
528
- //#region configs/playwright.ts
529
- const playwrightConfig = {
530
- ...eslint_plugin_playwright.default.configs["flat/recommended"],
531
- name: "component-hook/playwright"
532
- };
533
- //#endregion
534
- //#region configs/prettier.ts
535
- const rules$1 = Object.fromEntries(Object.entries(eslint_plugin_prettier_recommended.default.rules ?? {}).filter(([name]) => name !== "vue/html-self-closing"));
536
- const prettierConfig = {
537
- name: "component-hook/prettier",
538
- plugins: { prettier: eslint_plugin_prettier.default },
539
- rules: {
540
- ...rules$1,
541
- "prettier/prettier": "warn"
542
- }
543
- };
544
- //#endregion
545
- //#region configs/react.ts
546
- const reactConfigs = [
547
- {
548
- ...eslint_plugin_react.default.configs.flat.recommended,
549
- name: "component-hook/react",
550
- settings: { react: { version: "detect" } },
551
- rules: {
552
- ...eslint_plugin_react.default.configs.flat.recommended.rules,
553
- ...eslint_plugin_react.default.configs.flat["jsx-runtime"].rules
554
- }
555
- },
556
- {
557
- name: "component-hook/react-hooks",
558
- files: ["**/*.[jt]s?(x)"],
559
- plugins: { "react-hooks": eslint_plugin_react_hooks.default },
560
- rules: { ...eslint_plugin_react_hooks.default.configs.recommended.rules }
561
- },
562
- {
563
- ...eslint_plugin_jsx_a11y.default.flatConfigs.recommended,
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" }
570
- }
571
- ];
572
- //#endregion
573
- //#region configs/regexp.ts
574
- const regexpConfig = {
575
- ...eslint_plugin_regexp.default.configs["flat/recommended"],
576
- name: "component-hook/regexp"
577
- };
578
- //#endregion
579
- //#region configs/security.ts
580
- const securityConfig = {
581
- name: "component-hook/security",
582
- plugins: { security: eslint_plugin_security.default },
583
- rules: {
584
- ...eslint_plugin_security.default.configs.recommended.rules,
585
- "security/detect-object-injection": "off"
586
- }
587
- };
588
- //#endregion
589
- //#region configs/sonarjs.ts
590
- const plugins$1 = { sonarjs: eslint_plugin_sonarjs.default };
591
- const recommended = eslint_plugin_sonarjs.default.configs?.recommended;
592
- const { settings } = recommended;
593
- const sonarjsConfigs = [{
594
- name: "component-hook/sonarjs",
595
- plugins: plugins$1,
596
- rules: {
597
- ...recommended.rules,
598
- "sonarjs/no-commented-code": "warn"
599
- },
600
- settings
601
- }, {
602
- name: "component-hook/sonarjs/allow-in-markdown",
603
- files: ["**/*.md/**"],
604
- plugins: plugins$1,
605
- rules: {
606
- "sonarjs/unused-import": "off",
607
- "sonarjs/no-unused-vars": "off"
608
- },
609
- settings
610
- }];
611
- //#endregion
612
- //#region configs/testing-library.ts
613
- const configs$1 = eslint_plugin_testing_library.default.configs;
614
- const plugins = { "testing-library": eslint_plugin_testing_library.default };
615
- const testingLibraryDomConfig = {
616
- name: "component-hook/testing-library/dom",
617
- plugins,
618
- rules: { ...configs$1["flat/dom"].rules }
619
- };
620
- const testingLibraryAngularConfig = {
621
- name: "component-hook/testing-library/angular",
622
- plugins,
623
- rules: { ...configs$1["flat/angular"].rules }
624
- };
625
- const testingLibraryReactConfig = {
626
- name: "component-hook/testing-library/react",
627
- plugins,
628
- rules: { ...configs$1["flat/react"].rules }
629
- };
630
- const testingLibraryVueConfig = {
631
- name: "component-hook/testing-library/vue",
632
- plugins,
633
- rules: { ...configs$1["flat/vue"].rules }
634
- };
635
- const testingLibraryMarkoConfig = {
636
- name: "component-hook/testing-library/marko",
637
- plugins,
638
- rules: { ...configs$1["flat/marko"].rules }
639
- };
640
- //#endregion
641
- //#region configs/typescript.ts
642
- const typescriptCoreConfig = (0, eslint_config.defineConfig)({
643
- extends: [...typescript_eslint.default.configs.recommended],
644
- files: ["**/*.ts", "**/*.tsx"],
645
- name: "component-hook/typescript",
646
- rules: {
647
- "@typescript-eslint/ban-ts-comment": "off",
648
- "@typescript-eslint/no-explicit-any": "off",
649
- "@typescript-eslint/no-unsafe-function-type": "off",
650
- "@typescript-eslint/no-shadow": "error",
651
- "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "_" }],
652
- "@typescript-eslint/no-useless-constructor": "error",
653
- "@typescript-eslint/prefer-literal-enum-member": ["error", { allowBitwiseExpressions: true }],
654
- "@typescript-eslint/no-unused-expressions": ["error", {
655
- allowShortCircuit: true,
656
- allowTaggedTemplates: true,
657
- allowTernary: true
658
- }],
659
- "@typescript-eslint/consistent-type-assertions": ["error", {
660
- assertionStyle: "as",
661
- objectLiteralTypeAssertions: "allow-as-parameter"
662
- }],
663
- "@typescript-eslint/consistent-type-imports": ["error", {
664
- disallowTypeAnnotations: false,
665
- fixStyle: "inline-type-imports"
666
- }],
667
- "@typescript-eslint/method-signature-style": ["error", "property"],
668
- "@typescript-eslint/no-import-type-side-effects": "error",
669
- "@typescript-eslint/no-redeclare": "error",
670
- "no-restricted-syntax": [
671
- "error",
672
- "TSEnumDeclaration[const=true]",
673
- ...RESTRICTED_SYNTAX
674
- ]
675
- }
676
- });
677
- const typescriptConfigs = [...typescriptCoreConfig, {
678
- files: ["**/*.d.ts"],
679
- name: "component-hook/typescript/dts-rules",
680
- rules: {
681
- "eslint-comments/no-unlimited-disable": "off",
682
- "import/no-duplicates": "off",
683
- "no-restricted-syntax": "off",
684
- "unused-imports/no-unused-vars": "off"
685
- }
686
- }];
687
- //#endregion
688
- //#region configs/unicorn.ts
689
- const unicornConfigs = [
690
- {
691
- ...eslint_plugin_unicorn.default.configs.unopinionated,
692
- name: "component-hook/unicorn/unopinionated"
693
- },
694
- {
695
- name: "component-hook/unicorn",
696
- rules: {
697
- "unicorn/consistent-arrow-return-style": "off",
698
- "unicorn/consistent-function-scoping": ["error", { checkArrowFunctions: false }],
699
- "unicorn/filename-case": ["error", {
700
- cases: {
701
- kebabCase: true,
702
- pascalCase: true
703
- },
704
- ignore: [
705
- /^[A-Z]+\..*$/,
706
- /^[a-z]{2}-[A-Za-z]{2}(\.\w+)?$/,
707
- /import_map\.json/
708
- ]
709
- }],
710
- "unicorn/import-style": "off",
711
- "unicorn/no-abusive-eslint-disable": "off",
712
- "unicorn/no-array-for-each": "off",
713
- "unicorn/no-barrel-files": "off",
714
- "unicorn/no-duplicate-set-values": "error",
715
- "unicorn/no-empty-file": "off",
716
- "unicorn/no-for-each": "off",
717
- "unicorn/no-for-loop": "error",
718
- "unicorn/no-process-exit": "off",
719
- "unicorn/no-this-assignment": "off",
720
- "unicorn/no-unreadable-array-destructuring": "off",
721
- "unicorn/no-useless-undefined": ["error", {
722
- checkArguments: false,
723
- checkArrowFunctionBody: false
724
- }],
725
- "unicorn/numeric-separators-style": "off",
726
- "unicorn/prefer-await": "off",
727
- "unicorn/prefer-module": "off",
728
- "unicorn/prefer-query-selector": "error",
729
- "unicorn/prefer-ternary": "off",
730
- "unicorn/prefer-top-level-await": "off",
731
- "unicorn/require-module-specifiers": "off"
732
- }
733
- },
734
- {
735
- name: "component-hook/unicorn/allow-filename-case",
736
- files: ["**/ISSUE_TEMPLATE/**"],
737
- rules: { "unicorn/filename-case": "off" }
738
- }
739
- ];
740
- //#endregion
741
- //#region configs/vue.ts
742
- const recommendedRules = eslint_plugin_vue.default.configs["flat/recommended"].map((config) => config.rules).reduce((acc, rules) => ({
743
- ...acc,
744
- ...rules
745
- }), {});
746
- const rules = {
747
- "vue/block-order": ["error", { order: [
748
- "script",
749
- "template",
750
- "style"
751
- ] }],
752
- "vue/custom-event-name-casing": ["error", "camelCase"],
753
- "vue/eqeqeq": ["error", "smart"],
754
- "vue/html-self-closing": ["error", {
755
- html: {
756
- component: "always",
757
- normal: "never",
758
- void: "always"
759
- },
760
- math: "always",
761
- svg: "always"
762
- }],
763
- "vue/max-attributes-per-line": "off",
764
- "vue/multi-word-component-names": "off",
765
- "vue/no-constant-condition": "warn",
766
- "vue/no-empty-pattern": "error",
767
- "vue/no-loss-of-precision": "error",
768
- "vue/no-ref-as-operand": "off",
769
- "vue/no-unused-refs": "error",
770
- "vue/no-useless-v-bind": "error",
771
- "vue/no-v-html": "off",
772
- "vue/object-shorthand": [
773
- "error",
774
- "always",
775
- {
776
- avoidQuotes: true,
777
- ignoreConstructors: false
778
- }
779
- ],
780
- "vue/one-component-per-file": "off",
781
- "vue/padding-line-between-blocks": ["error", "always"],
782
- "vue/prefer-template": "error",
783
- "vue/require-default-prop": "off",
784
- "vue/require-prop-types": "off",
785
- "vue/no-setup-props-reactivity-loss": "off",
786
- "vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
787
- };
788
- const vueConfigs = [...typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
789
- ...config,
790
- files: [VUE],
791
- name: `component-hook/vue/${config.name?.replace("component-hook/", "")}`
792
- })), {
793
- name: "component-hook/vue",
794
- files: [VUE],
795
- plugins: {
796
- "@typescript-eslint": typescript_eslint.default.plugin,
797
- vue: eslint_plugin_vue.default
798
- },
799
- languageOptions: {
800
- parser: vue_eslint_parser.default,
801
- parserOptions: {
802
- parser: typescript_eslint.default.parser,
803
- extraFileExtensions: [".vue"],
804
- sourceType: "module",
805
- ecmaFeatures: { jsx: true }
806
- }
807
- },
808
- processor: eslint_plugin_vue.default.processors[".vue"],
809
- rules: {
810
- ...recommendedRules,
811
- "no-useless-assignment": "off",
812
- ...rules
813
- }
814
- }];
815
- //#endregion
816
- //#region configs/yaml.ts
817
- const initialRules = { rules: { "yml/no-empty-mapping-value": "off" } };
818
- const yamlConfigs = [{
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
- }, {}),
833
- name: "component-hook/yaml"
834
- }, {
835
- name: "component-hook/yaml/pnpm-workspace",
836
- files: ["**/pnpm-workspace.yaml"],
837
- rules: { "yml/sort-keys": [
838
- "error",
839
- {
840
- order: [
841
- "packages",
842
- "overrides",
843
- "patchedDependencies",
844
- "defines",
845
- "catalog",
846
- "catalogs",
847
- { order: { type: "asc" } }
848
- ],
849
- pathPattern: "^$"
850
- },
851
- {
852
- allowLineSeparatedGroups: true,
853
- order: { type: "asc" },
854
- pathPattern: "^(catalog|catalogs|overrides)$"
855
- },
856
- {
857
- allowLineSeparatedGroups: true,
858
- order: { type: "asc" },
859
- pathPattern: String.raw`^catalogs\..+$`
860
- }
861
- ] }
862
- }];
863
- //#endregion
864
- //#region index.ts
865
- const basicConfigs = [
866
- ...jsConfigs,
867
- ...typescriptConfigs,
868
- ...commentsConfigs,
869
- ...importConfigs,
870
- ...unicornConfigs,
871
- jsdocConfig,
872
- regexpConfig,
873
- deMorganConfig,
874
- perfectionistConfig,
875
- ...jsoncConfigs,
876
- ...yamlConfigs,
877
- ignores
878
- ];
879
- var eslint_plugin_default = { configs: {
880
- basic: basicConfigs,
881
- react: reactConfigs,
882
- vue: vueConfigs,
883
- markdown: markdownConfigs,
884
- prettier: prettierConfig,
885
- sonarjs: sonarjsConfigs,
886
- security: securityConfig,
887
- playwright: playwrightConfig,
888
- "testing-library/dom": testingLibraryDomConfig,
889
- "testing-library/vue": testingLibraryVueConfig,
890
- "testing-library/react": testingLibraryReactConfig,
891
- "testing-library/angular": testingLibraryAngularConfig,
892
- "testing-library/marko": testingLibraryMarkoConfig
893
- } };
894
- const basicPreset = [
895
- prettierConfig,
896
- ...sonarjsConfigs,
897
- securityConfig,
898
- ...markdownConfigs
899
- ];
900
- const reactPreset = [
901
- ...basicConfigs,
902
- ...reactConfigs,
903
- ...basicPreset
904
- ];
905
- const vuePreset = [
906
- ...basicConfigs,
907
- ...vueConfigs,
908
- ...basicPreset
909
- ];
910
- //#endregion
911
- exports.default = eslint_plugin_default;
912
- exports.reactPreset = reactPreset;
913
- exports.vuePreset = vuePreset;