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