@ivanmaxlogiudice/eslint-config 3.0.0-beta.3 → 3.0.0-beta.5
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/cli.js +18 -17
- package/dist/index.d.ts +88 -37
- package/dist/index.js +755 -673
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
// src/configs/comments.ts
|
|
2
2
|
import plugin from "@eslint-community/eslint-plugin-eslint-comments";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
function comments() {
|
|
4
|
+
return [
|
|
5
|
+
{
|
|
6
|
+
name: "ivanmaxlogiudice/comments/rules",
|
|
7
|
+
plugins: {
|
|
8
|
+
"eslint-comments": plugin
|
|
9
|
+
},
|
|
10
|
+
rules: {
|
|
11
|
+
"eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
12
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
13
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
14
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
15
|
+
"eslint-comments/no-unused-enable": "error"
|
|
16
|
+
}
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
];
|
|
19
|
+
}
|
|
18
20
|
|
|
19
21
|
// src/configs/ignores.ts
|
|
20
22
|
import { dedupe, parsePath, toFlatConfig } from "@ivanmaxlogiudice/gitignore";
|
|
@@ -83,7 +85,10 @@ import { spawn } from "node:child_process";
|
|
|
83
85
|
import fs from "node:fs";
|
|
84
86
|
import path from "node:path";
|
|
85
87
|
import process from "node:process";
|
|
86
|
-
|
|
88
|
+
import { fileURLToPath } from "node:url";
|
|
89
|
+
import { isPackageExists } from "local-pkg";
|
|
90
|
+
var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
91
|
+
var isCwdInScope = isPackageExists("@ivanmaxlogiudice/eslint-config");
|
|
87
92
|
async function combine(...configs) {
|
|
88
93
|
const resolved = await Promise.all(configs);
|
|
89
94
|
return resolved.flat();
|
|
@@ -99,11 +104,11 @@ function renameRules(rules, from, to) {
|
|
|
99
104
|
}
|
|
100
105
|
return renamed;
|
|
101
106
|
}
|
|
102
|
-
function clearPackageCache() {
|
|
103
|
-
cachePkg = void 0;
|
|
104
|
-
}
|
|
105
107
|
function hasSomePackage(names) {
|
|
106
|
-
return names.some((name) =>
|
|
108
|
+
return names.some((name) => isPackageInScope(name));
|
|
109
|
+
}
|
|
110
|
+
function isPackageInScope(name) {
|
|
111
|
+
return isPackageExists(name, { paths: [scopeUrl] });
|
|
107
112
|
}
|
|
108
113
|
function findUp(file, cwd = process.cwd(), depth = 3) {
|
|
109
114
|
let currentPath = cwd;
|
|
@@ -116,21 +121,10 @@ function findUp(file, cwd = process.cwd(), depth = 3) {
|
|
|
116
121
|
}
|
|
117
122
|
return null;
|
|
118
123
|
}
|
|
119
|
-
function packageExists(name) {
|
|
120
|
-
if (!cachePkg) {
|
|
121
|
-
const pkgPath = findUp("package.json");
|
|
122
|
-
if (!pkgPath) {
|
|
123
|
-
throw new Error('Can not found "package.json".');
|
|
124
|
-
}
|
|
125
|
-
const pkgContent = fs.readFileSync(pkgPath, "utf-8");
|
|
126
|
-
cachePkg = JSON.parse(pkgContent);
|
|
127
|
-
}
|
|
128
|
-
return cachePkg?.dependencies?.[name] !== void 0 || cachePkg?.devDependencies?.[name] !== void 0;
|
|
129
|
-
}
|
|
130
124
|
async function ensurePackages(packages) {
|
|
131
|
-
if (process.env.CI || process.stdout.isTTY === false)
|
|
125
|
+
if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false)
|
|
132
126
|
return;
|
|
133
|
-
const missingPackages = packages.filter((i) => i && !
|
|
127
|
+
const missingPackages = packages.filter((i) => i && !isPackageInScope(i));
|
|
134
128
|
if (missingPackages.length === 0)
|
|
135
129
|
return;
|
|
136
130
|
console.log(`
|
|
@@ -183,35 +177,37 @@ function ignores() {
|
|
|
183
177
|
|
|
184
178
|
// src/configs/imports.ts
|
|
185
179
|
import plugin2 from "eslint-plugin-import-x";
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
180
|
+
function imports() {
|
|
181
|
+
return [
|
|
182
|
+
{
|
|
183
|
+
name: "ivanmaxlogiudice/imports/rules",
|
|
184
|
+
plugins: {
|
|
185
|
+
import: plugin2
|
|
186
|
+
},
|
|
187
|
+
rules: {
|
|
188
|
+
"antfu/import-dedupe": "error",
|
|
189
|
+
"antfu/no-import-dist": "error",
|
|
190
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
191
|
+
"import/first": "error",
|
|
192
|
+
"import/no-duplicates": "error",
|
|
193
|
+
"import/no-mutable-exports": "error",
|
|
194
|
+
"import/no-named-default": "error",
|
|
195
|
+
"import/no-self-import": "error",
|
|
196
|
+
"import/no-webpack-loader-syntax": "error",
|
|
197
|
+
// Stylistic
|
|
198
|
+
"import/newline-after-import": ["error", { count: 1 }]
|
|
199
|
+
}
|
|
191
200
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
"import/no-named-default": "error",
|
|
200
|
-
"import/no-self-import": "error",
|
|
201
|
-
"import/no-webpack-loader-syntax": "error",
|
|
202
|
-
// Stylistic
|
|
203
|
-
"import/newline-after-import": ["error", { count: 1 }]
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
name: "ivanmaxlogiudice/imports/disables/bin",
|
|
208
|
-
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
209
|
-
rules: {
|
|
210
|
-
"antfu/no-import-dist": "off",
|
|
211
|
-
"antfu/no-import-node-modules-by-path": "off"
|
|
201
|
+
{
|
|
202
|
+
name: "ivanmaxlogiudice/imports/disables/bin",
|
|
203
|
+
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
204
|
+
rules: {
|
|
205
|
+
"antfu/no-import-dist": "off",
|
|
206
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
207
|
+
}
|
|
212
208
|
}
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
];
|
|
210
|
+
}
|
|
215
211
|
|
|
216
212
|
// src/configs/javascript.ts
|
|
217
213
|
import pluginAntfu from "eslint-plugin-antfu";
|
|
@@ -222,305 +218,323 @@ var restrictedSyntaxJs = [
|
|
|
222
218
|
"LabeledStatement",
|
|
223
219
|
"WithStatement"
|
|
224
220
|
];
|
|
225
|
-
|
|
226
|
-
{
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
document: "readonly",
|
|
235
|
-
navigator: "readonly",
|
|
236
|
-
window: "readonly"
|
|
237
|
-
},
|
|
238
|
-
parserOptions: {
|
|
239
|
-
ecmaFeatures: {
|
|
240
|
-
jsx: true
|
|
241
|
-
},
|
|
221
|
+
function javascript(options = {}) {
|
|
222
|
+
const {
|
|
223
|
+
isInEditor = false,
|
|
224
|
+
overrides = {}
|
|
225
|
+
} = options;
|
|
226
|
+
return [
|
|
227
|
+
{
|
|
228
|
+
name: "ivanmaxlogiudice/javascript/setup",
|
|
229
|
+
languageOptions: {
|
|
242
230
|
ecmaVersion: 2022,
|
|
231
|
+
globals: {
|
|
232
|
+
...globals.browser,
|
|
233
|
+
...globals.es2021,
|
|
234
|
+
...globals.node,
|
|
235
|
+
document: "readonly",
|
|
236
|
+
navigator: "readonly",
|
|
237
|
+
window: "readonly"
|
|
238
|
+
},
|
|
239
|
+
parserOptions: {
|
|
240
|
+
ecmaFeatures: {
|
|
241
|
+
jsx: true
|
|
242
|
+
},
|
|
243
|
+
ecmaVersion: 2022,
|
|
244
|
+
sourceType: "module"
|
|
245
|
+
},
|
|
243
246
|
sourceType: "module"
|
|
244
247
|
},
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
reportUnusedDisableDirectives: true
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
name: "ivanmaxlogiudice/javascript/rules",
|
|
253
|
-
plugins: {
|
|
254
|
-
"antfu": pluginAntfu,
|
|
255
|
-
"unused-imports": pluginUnused
|
|
248
|
+
linterOptions: {
|
|
249
|
+
reportUnusedDisableDirectives: true
|
|
250
|
+
}
|
|
256
251
|
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
"error",
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
"
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
"
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
"no-useless-catch": "error",
|
|
368
|
-
"no-useless-computed-key": "error",
|
|
369
|
-
"no-useless-constructor": "error",
|
|
370
|
-
"no-useless-rename": "error",
|
|
371
|
-
"no-useless-return": "error",
|
|
372
|
-
"no-var": "error",
|
|
373
|
-
"no-with": "error",
|
|
374
|
-
"object-shorthand": [
|
|
375
|
-
"error",
|
|
376
|
-
"always",
|
|
377
|
-
{
|
|
378
|
-
avoidQuotes: true,
|
|
379
|
-
ignoreConstructors: false
|
|
380
|
-
}
|
|
381
|
-
],
|
|
382
|
-
"one-var": ["error", { initialized: "never" }],
|
|
383
|
-
"prefer-arrow-callback": [
|
|
384
|
-
"error",
|
|
385
|
-
{
|
|
386
|
-
allowNamedFunctions: false,
|
|
387
|
-
allowUnboundThis: true
|
|
388
|
-
}
|
|
389
|
-
],
|
|
390
|
-
"prefer-const": [
|
|
391
|
-
"error",
|
|
392
|
-
{
|
|
393
|
-
destructuring: "all",
|
|
394
|
-
ignoreReadBeforeAssign: true
|
|
395
|
-
}
|
|
396
|
-
],
|
|
397
|
-
"prefer-exponentiation-operator": "error",
|
|
398
|
-
"prefer-promise-reject-errors": "error",
|
|
399
|
-
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
400
|
-
"prefer-rest-params": "error",
|
|
401
|
-
"prefer-spread": "error",
|
|
402
|
-
"prefer-template": "error",
|
|
403
|
-
"symbol-description": "error",
|
|
404
|
-
"unicode-bom": ["error", "never"],
|
|
405
|
-
"unused-imports/no-unused-imports": isInEditorEnv() ? "off" : "error",
|
|
406
|
-
"unused-imports/no-unused-vars": [
|
|
407
|
-
"error",
|
|
408
|
-
{
|
|
409
|
-
args: "after-used",
|
|
410
|
-
argsIgnorePattern: "^_",
|
|
252
|
+
{
|
|
253
|
+
name: "ivanmaxlogiudice/javascript/rules",
|
|
254
|
+
plugins: {
|
|
255
|
+
"antfu": pluginAntfu,
|
|
256
|
+
"unused-imports": pluginUnused
|
|
257
|
+
},
|
|
258
|
+
rules: {
|
|
259
|
+
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
260
|
+
"array-callback-return": "error",
|
|
261
|
+
"block-scoped-var": "error",
|
|
262
|
+
"constructor-super": "error",
|
|
263
|
+
"default-case-last": "error",
|
|
264
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
265
|
+
"eqeqeq": ["error", "smart"],
|
|
266
|
+
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
267
|
+
"no-alert": "error",
|
|
268
|
+
"no-array-constructor": "error",
|
|
269
|
+
"no-async-promise-executor": "error",
|
|
270
|
+
"no-caller": "error",
|
|
271
|
+
"no-case-declarations": "error",
|
|
272
|
+
"no-class-assign": "error",
|
|
273
|
+
"no-compare-neg-zero": "error",
|
|
274
|
+
"no-cond-assign": ["error", "always"],
|
|
275
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
276
|
+
"no-const-assign": "error",
|
|
277
|
+
"no-control-regex": "error",
|
|
278
|
+
"no-debugger": "error",
|
|
279
|
+
"no-delete-var": "error",
|
|
280
|
+
"no-dupe-args": "error",
|
|
281
|
+
"no-dupe-class-members": "error",
|
|
282
|
+
"no-dupe-keys": "error",
|
|
283
|
+
"no-duplicate-case": "error",
|
|
284
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
285
|
+
"no-empty-character-class": "error",
|
|
286
|
+
"no-empty-pattern": "error",
|
|
287
|
+
"no-eval": "error",
|
|
288
|
+
"no-ex-assign": "error",
|
|
289
|
+
"no-extend-native": "error",
|
|
290
|
+
"no-extra-bind": "error",
|
|
291
|
+
"no-extra-boolean-cast": "error",
|
|
292
|
+
"no-fallthrough": "error",
|
|
293
|
+
"no-func-assign": "error",
|
|
294
|
+
"no-global-assign": "error",
|
|
295
|
+
"no-implied-eval": "error",
|
|
296
|
+
"no-import-assign": "error",
|
|
297
|
+
"no-invalid-regexp": "error",
|
|
298
|
+
"no-irregular-whitespace": "error",
|
|
299
|
+
"no-iterator": "error",
|
|
300
|
+
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
301
|
+
"no-lone-blocks": "error",
|
|
302
|
+
"no-loss-of-precision": "error",
|
|
303
|
+
"no-misleading-character-class": "error",
|
|
304
|
+
"no-multi-str": "error",
|
|
305
|
+
"no-new": "error",
|
|
306
|
+
"no-new-func": "error",
|
|
307
|
+
"no-new-native-nonconstructor": "error",
|
|
308
|
+
"no-new-wrappers": "error",
|
|
309
|
+
"no-obj-calls": "error",
|
|
310
|
+
"no-octal": "error",
|
|
311
|
+
"no-octal-escape": "error",
|
|
312
|
+
"no-proto": "error",
|
|
313
|
+
"no-prototype-builtins": "error",
|
|
314
|
+
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
315
|
+
"no-regex-spaces": "error",
|
|
316
|
+
"no-restricted-globals": [
|
|
317
|
+
"error",
|
|
318
|
+
{ name: "global", message: "Use `globalThis` instead." },
|
|
319
|
+
{ name: "self", message: "Use `globalThis` instead." }
|
|
320
|
+
],
|
|
321
|
+
"no-restricted-properties": [
|
|
322
|
+
"error",
|
|
323
|
+
{ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.", property: "__proto__" },
|
|
324
|
+
{ message: "Use `Object.defineProperty` instead.", property: "__defineGetter__" },
|
|
325
|
+
{ message: "Use `Object.defineProperty` instead.", property: "__defineSetter__" },
|
|
326
|
+
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupGetter__" },
|
|
327
|
+
{ message: "Use `Object.getOwnPropertyDescriptor` instead.", property: "__lookupSetter__" }
|
|
328
|
+
],
|
|
329
|
+
"no-restricted-syntax": [
|
|
330
|
+
"error",
|
|
331
|
+
"DebuggerStatement",
|
|
332
|
+
"LabeledStatement",
|
|
333
|
+
"WithStatement",
|
|
334
|
+
"TSEnumDeclaration[const=true]",
|
|
335
|
+
"TSExportAssignment"
|
|
336
|
+
],
|
|
337
|
+
"no-self-assign": ["error", { props: true }],
|
|
338
|
+
"no-self-compare": "error",
|
|
339
|
+
"no-sequences": "error",
|
|
340
|
+
"no-shadow-restricted-names": "error",
|
|
341
|
+
"no-sparse-arrays": "error",
|
|
342
|
+
"no-template-curly-in-string": "error",
|
|
343
|
+
"no-this-before-super": "error",
|
|
344
|
+
"no-throw-literal": "error",
|
|
345
|
+
"no-undef": "error",
|
|
346
|
+
"no-undef-init": "error",
|
|
347
|
+
"no-unexpected-multiline": "error",
|
|
348
|
+
"no-unmodified-loop-condition": "error",
|
|
349
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
350
|
+
"no-unreachable": "error",
|
|
351
|
+
"no-unreachable-loop": "error",
|
|
352
|
+
"no-unsafe-finally": "error",
|
|
353
|
+
"no-unsafe-negation": "error",
|
|
354
|
+
"no-unused-expressions": ["error", {
|
|
355
|
+
allowShortCircuit: true,
|
|
356
|
+
allowTaggedTemplates: true,
|
|
357
|
+
allowTernary: true
|
|
358
|
+
}],
|
|
359
|
+
"no-unused-vars": ["error", {
|
|
360
|
+
args: "none",
|
|
361
|
+
caughtErrors: "none",
|
|
411
362
|
ignoreRestSiblings: true,
|
|
412
|
-
vars: "all"
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
363
|
+
vars: "all"
|
|
364
|
+
}],
|
|
365
|
+
"no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
366
|
+
"no-useless-backreference": "error",
|
|
367
|
+
"no-useless-call": "error",
|
|
368
|
+
"no-useless-catch": "error",
|
|
369
|
+
"no-useless-computed-key": "error",
|
|
370
|
+
"no-useless-constructor": "error",
|
|
371
|
+
"no-useless-rename": "error",
|
|
372
|
+
"no-useless-return": "error",
|
|
373
|
+
"no-var": "error",
|
|
374
|
+
"no-with": "error",
|
|
375
|
+
"object-shorthand": [
|
|
376
|
+
"error",
|
|
377
|
+
"always",
|
|
378
|
+
{
|
|
379
|
+
avoidQuotes: true,
|
|
380
|
+
ignoreConstructors: false
|
|
381
|
+
}
|
|
382
|
+
],
|
|
383
|
+
"one-var": ["error", { initialized: "never" }],
|
|
384
|
+
"prefer-arrow-callback": [
|
|
385
|
+
"error",
|
|
386
|
+
{
|
|
387
|
+
allowNamedFunctions: false,
|
|
388
|
+
allowUnboundThis: true
|
|
389
|
+
}
|
|
390
|
+
],
|
|
391
|
+
"prefer-const": [
|
|
392
|
+
"error",
|
|
393
|
+
{
|
|
394
|
+
destructuring: "all",
|
|
395
|
+
ignoreReadBeforeAssign: true
|
|
396
|
+
}
|
|
397
|
+
],
|
|
398
|
+
"prefer-exponentiation-operator": "error",
|
|
399
|
+
"prefer-promise-reject-errors": "error",
|
|
400
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
401
|
+
"prefer-rest-params": "error",
|
|
402
|
+
"prefer-spread": "error",
|
|
403
|
+
"prefer-template": "error",
|
|
404
|
+
"symbol-description": "error",
|
|
405
|
+
"unicode-bom": ["error", "never"],
|
|
406
|
+
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
407
|
+
"unused-imports/no-unused-vars": [
|
|
408
|
+
"error",
|
|
409
|
+
{
|
|
410
|
+
args: "after-used",
|
|
411
|
+
argsIgnorePattern: "^_",
|
|
412
|
+
ignoreRestSiblings: true,
|
|
413
|
+
vars: "all",
|
|
414
|
+
varsIgnorePattern: "^_"
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
418
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
419
|
+
"vars-on-top": "error",
|
|
420
|
+
"yoda": ["error", "never"],
|
|
421
|
+
...overrides
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
name: "ivanmaxlogiudice/javascript/disables/cli",
|
|
426
|
+
files: [`scripts/${GLOB_SRC}`, `**/cli/${GLOB_SRC}`],
|
|
427
|
+
rules: {
|
|
428
|
+
"no-console": "off"
|
|
429
|
+
}
|
|
427
430
|
}
|
|
428
|
-
|
|
429
|
-
|
|
431
|
+
];
|
|
432
|
+
}
|
|
430
433
|
|
|
431
434
|
// src/configs/jsdoc.ts
|
|
432
435
|
import plugin3 from "eslint-plugin-jsdoc";
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
436
|
+
function jsdoc() {
|
|
437
|
+
return [
|
|
438
|
+
{
|
|
439
|
+
name: "ivanmaxlogiudice/jsdoc/rules",
|
|
440
|
+
plugins: {
|
|
441
|
+
jsdoc: plugin3
|
|
442
|
+
},
|
|
443
|
+
rules: {
|
|
444
|
+
"jsdoc/check-access": "warn",
|
|
445
|
+
"jsdoc/check-param-names": "warn",
|
|
446
|
+
"jsdoc/check-property-names": "warn",
|
|
447
|
+
"jsdoc/check-types": "warn",
|
|
448
|
+
"jsdoc/empty-tags": "warn",
|
|
449
|
+
"jsdoc/implements-on-classes": "warn",
|
|
450
|
+
"jsdoc/no-defaults": "warn",
|
|
451
|
+
"jsdoc/no-multi-asterisks": "warn",
|
|
452
|
+
"jsdoc/require-param-name": "warn",
|
|
453
|
+
"jsdoc/require-property": "warn",
|
|
454
|
+
"jsdoc/require-property-description": "warn",
|
|
455
|
+
"jsdoc/require-property-name": "warn",
|
|
456
|
+
"jsdoc/require-returns-check": "warn",
|
|
457
|
+
"jsdoc/require-returns-description": "warn",
|
|
458
|
+
"jsdoc/require-yields-check": "warn",
|
|
459
|
+
// Stylistic
|
|
460
|
+
"jsdoc/check-alignment": "warn",
|
|
461
|
+
"jsdoc/multiline-blocks": "warn"
|
|
462
|
+
}
|
|
458
463
|
}
|
|
459
|
-
|
|
460
|
-
|
|
464
|
+
];
|
|
465
|
+
}
|
|
461
466
|
|
|
462
467
|
// src/configs/jsonc.ts
|
|
463
468
|
import plugin4 from "eslint-plugin-jsonc";
|
|
464
469
|
import parser from "jsonc-eslint-parser";
|
|
465
|
-
|
|
466
|
-
{
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
parser
|
|
470
|
+
function jsonc(options = {}) {
|
|
471
|
+
const {
|
|
472
|
+
files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
473
|
+
overrides = {}
|
|
474
|
+
} = options;
|
|
475
|
+
return [
|
|
476
|
+
{
|
|
477
|
+
name: "ivanmaxlogiudice/jsonc/setup",
|
|
478
|
+
plugins: {
|
|
479
|
+
jsonc: plugin4
|
|
480
|
+
}
|
|
477
481
|
},
|
|
478
|
-
|
|
479
|
-
"jsonc/
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
482
|
+
{
|
|
483
|
+
name: "ivanmaxlogiudice/jsonc/rules",
|
|
484
|
+
files,
|
|
485
|
+
languageOptions: {
|
|
486
|
+
parser
|
|
487
|
+
},
|
|
488
|
+
rules: {
|
|
489
|
+
"jsonc/no-bigint-literals": "error",
|
|
490
|
+
"jsonc/no-binary-expression": "error",
|
|
491
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
492
|
+
"jsonc/no-dupe-keys": "error",
|
|
493
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
494
|
+
"jsonc/no-floating-decimal": "error",
|
|
495
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
496
|
+
"jsonc/no-infinity": "error",
|
|
497
|
+
"jsonc/no-multi-str": "error",
|
|
498
|
+
"jsonc/no-nan": "error",
|
|
499
|
+
"jsonc/no-number-props": "error",
|
|
500
|
+
"jsonc/no-numeric-separators": "error",
|
|
501
|
+
"jsonc/no-octal": "error",
|
|
502
|
+
"jsonc/no-octal-escape": "error",
|
|
503
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
504
|
+
"jsonc/no-parenthesized": "error",
|
|
505
|
+
"jsonc/no-plus-sign": "error",
|
|
506
|
+
"jsonc/no-regexp-literals": "error",
|
|
507
|
+
"jsonc/no-sparse-arrays": "error",
|
|
508
|
+
"jsonc/no-template-literals": "error",
|
|
509
|
+
"jsonc/no-undefined-value": "error",
|
|
510
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
511
|
+
"jsonc/no-useless-escape": "error",
|
|
512
|
+
"jsonc/space-unary-ops": "error",
|
|
513
|
+
"jsonc/valid-json-number": "error",
|
|
514
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
515
|
+
// Stylistic
|
|
516
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
517
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
518
|
+
"jsonc/comma-style": ["error", "last"],
|
|
519
|
+
"jsonc/indent": ["error", 4],
|
|
520
|
+
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
521
|
+
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
522
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
523
|
+
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
524
|
+
"jsonc/quote-props": "error",
|
|
525
|
+
"jsonc/quotes": "error",
|
|
526
|
+
...overrides
|
|
527
|
+
}
|
|
516
528
|
}
|
|
517
|
-
|
|
518
|
-
|
|
529
|
+
];
|
|
530
|
+
}
|
|
519
531
|
|
|
520
532
|
// src/configs/markdown.ts
|
|
521
533
|
async function markdown(options = {}) {
|
|
522
534
|
const {
|
|
523
|
-
componentExts = []
|
|
535
|
+
componentExts = [],
|
|
536
|
+
files = [GLOB_MARKDOWN],
|
|
537
|
+
overrides = {}
|
|
524
538
|
} = options;
|
|
525
539
|
await ensurePackages(["eslint-plugin-markdown"]);
|
|
526
540
|
const plugin10 = await interopDefault(import("eslint-plugin-markdown"));
|
|
@@ -533,7 +547,7 @@ async function markdown(options = {}) {
|
|
|
533
547
|
},
|
|
534
548
|
{
|
|
535
549
|
name: "ivanmaxlogiudice/markdown/processor",
|
|
536
|
-
files
|
|
550
|
+
files,
|
|
537
551
|
processor: "markdown/markdown"
|
|
538
552
|
},
|
|
539
553
|
{
|
|
@@ -572,7 +586,8 @@ async function markdown(options = {}) {
|
|
|
572
586
|
"ts/no-use-before-define": "off",
|
|
573
587
|
"unicode-bom": "off",
|
|
574
588
|
"unused-imports/no-unused-imports": "off",
|
|
575
|
-
"unused-imports/no-unused-vars": "off"
|
|
589
|
+
"unused-imports/no-unused-vars": "off",
|
|
590
|
+
...overrides
|
|
576
591
|
}
|
|
577
592
|
}
|
|
578
593
|
];
|
|
@@ -580,63 +595,70 @@ async function markdown(options = {}) {
|
|
|
580
595
|
|
|
581
596
|
// src/configs/node.ts
|
|
582
597
|
import plugin5 from "eslint-plugin-n";
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
598
|
+
function node() {
|
|
599
|
+
return [
|
|
600
|
+
{
|
|
601
|
+
name: "ivanmaxlogiudice/node/rules",
|
|
602
|
+
plugins: {
|
|
603
|
+
node: plugin5
|
|
604
|
+
},
|
|
605
|
+
rules: {
|
|
606
|
+
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
607
|
+
"node/no-deprecated-api": "error",
|
|
608
|
+
"node/no-exports-assign": "error",
|
|
609
|
+
"node/no-new-require": "error",
|
|
610
|
+
"node/no-path-concat": "error",
|
|
611
|
+
"node/no-unsupported-features/es-builtins": "error",
|
|
612
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
613
|
+
"node/prefer-global/process": ["error", "never"],
|
|
614
|
+
"node/process-exit-as-throw": "error"
|
|
615
|
+
}
|
|
599
616
|
}
|
|
600
|
-
|
|
601
|
-
|
|
617
|
+
];
|
|
618
|
+
}
|
|
602
619
|
|
|
603
620
|
// src/configs/perfectionist.ts
|
|
604
621
|
import plugin6 from "eslint-plugin-perfectionist";
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
622
|
+
function perfectionist() {
|
|
623
|
+
return [
|
|
624
|
+
{
|
|
625
|
+
name: "ivanmaxlogiudice/perfectionist/rules",
|
|
626
|
+
plugins: {
|
|
627
|
+
perfectionist: plugin6
|
|
628
|
+
},
|
|
629
|
+
rules: {
|
|
630
|
+
"perfectionist/sort-imports": ["warn", {
|
|
631
|
+
groups: [
|
|
632
|
+
"builtin",
|
|
633
|
+
"external",
|
|
634
|
+
"internal",
|
|
635
|
+
"internal-type",
|
|
636
|
+
"parent",
|
|
637
|
+
"parent-type",
|
|
638
|
+
"sibling",
|
|
639
|
+
"sibling-type",
|
|
640
|
+
"index",
|
|
641
|
+
"index-type",
|
|
642
|
+
"object",
|
|
643
|
+
"type",
|
|
644
|
+
"side-effect",
|
|
645
|
+
"side-effect-style"
|
|
646
|
+
],
|
|
647
|
+
internalPattern: ["@/**"],
|
|
648
|
+
newlinesBetween: "ignore"
|
|
649
|
+
}],
|
|
650
|
+
"perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
|
|
651
|
+
"perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
|
|
652
|
+
}
|
|
634
653
|
}
|
|
635
|
-
|
|
636
|
-
|
|
654
|
+
];
|
|
655
|
+
}
|
|
637
656
|
|
|
638
657
|
// src/configs/regexp.ts
|
|
639
|
-
async function regexp() {
|
|
658
|
+
async function regexp(options = {}) {
|
|
659
|
+
const {
|
|
660
|
+
overrides = {}
|
|
661
|
+
} = options;
|
|
640
662
|
await ensurePackages(["eslint-plugin-regexp"]);
|
|
641
663
|
const plugin10 = await interopDefault(import("eslint-plugin-regexp"));
|
|
642
664
|
return [
|
|
@@ -646,214 +668,219 @@ async function regexp() {
|
|
|
646
668
|
regexp: plugin10
|
|
647
669
|
},
|
|
648
670
|
rules: {
|
|
649
|
-
...plugin10.configs["flat/recommended"].rules
|
|
671
|
+
...plugin10.configs["flat/recommended"].rules,
|
|
672
|
+
...overrides
|
|
650
673
|
}
|
|
651
674
|
}
|
|
652
675
|
];
|
|
653
676
|
}
|
|
654
677
|
|
|
655
678
|
// src/configs/sort.ts
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
"
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
"
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
679
|
+
function sortPackageJson() {
|
|
680
|
+
return [
|
|
681
|
+
{
|
|
682
|
+
name: "ivanmaxlogiudice/sort/packageJson",
|
|
683
|
+
files: ["**/package.json"],
|
|
684
|
+
rules: {
|
|
685
|
+
"jsonc/sort-array-values": [
|
|
686
|
+
"error",
|
|
687
|
+
{
|
|
688
|
+
order: { type: "asc" },
|
|
689
|
+
pathPattern: "^files$"
|
|
690
|
+
}
|
|
691
|
+
],
|
|
692
|
+
"jsonc/sort-keys": [
|
|
693
|
+
"error",
|
|
694
|
+
{
|
|
695
|
+
order: [
|
|
696
|
+
"name",
|
|
697
|
+
"version",
|
|
698
|
+
"private",
|
|
699
|
+
"packageManager",
|
|
700
|
+
"description",
|
|
701
|
+
"type",
|
|
702
|
+
"keywords",
|
|
703
|
+
"license",
|
|
704
|
+
"homepage",
|
|
705
|
+
"bugs",
|
|
706
|
+
"repository",
|
|
707
|
+
"author",
|
|
708
|
+
"contributors",
|
|
709
|
+
"funding",
|
|
710
|
+
"files",
|
|
711
|
+
"main",
|
|
712
|
+
"module",
|
|
713
|
+
"types",
|
|
714
|
+
"exports",
|
|
715
|
+
"typesVersions",
|
|
716
|
+
"sideEffects",
|
|
717
|
+
"unpkg",
|
|
718
|
+
"jsdelivr",
|
|
719
|
+
"browser",
|
|
720
|
+
"bin",
|
|
721
|
+
"man",
|
|
722
|
+
"directories",
|
|
723
|
+
"publishConfig",
|
|
724
|
+
"scripts",
|
|
725
|
+
"peerDependencies",
|
|
726
|
+
"peerDependenciesMeta",
|
|
727
|
+
"optionalDependencies",
|
|
728
|
+
"dependencies",
|
|
729
|
+
"devDependencies",
|
|
730
|
+
"engines",
|
|
731
|
+
"config",
|
|
732
|
+
"overrides",
|
|
733
|
+
"pnpm",
|
|
734
|
+
"husky",
|
|
735
|
+
"lint-staged",
|
|
736
|
+
"eslintConfig",
|
|
737
|
+
"prettier"
|
|
738
|
+
],
|
|
739
|
+
pathPattern: "^$"
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
order: { type: "asc" },
|
|
743
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
order: ["types", "require", "import", "default"],
|
|
747
|
+
pathPattern: "^exports.*$"
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
order: { type: "asc" },
|
|
751
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
752
|
+
}
|
|
753
|
+
]
|
|
754
|
+
}
|
|
730
755
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
"
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
756
|
+
];
|
|
757
|
+
}
|
|
758
|
+
function sortTsconfig() {
|
|
759
|
+
return [
|
|
760
|
+
{
|
|
761
|
+
name: "ivanmaxlogiudice/sort/tsconfig",
|
|
762
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
763
|
+
rules: {
|
|
764
|
+
"jsonc/sort-keys": [
|
|
765
|
+
"error",
|
|
766
|
+
{
|
|
767
|
+
order: [
|
|
768
|
+
"extends",
|
|
769
|
+
"compilerOptions",
|
|
770
|
+
"references",
|
|
771
|
+
"files",
|
|
772
|
+
"include",
|
|
773
|
+
"exclude"
|
|
774
|
+
],
|
|
775
|
+
pathPattern: "^$"
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
order: [
|
|
779
|
+
/* Projects */
|
|
780
|
+
"incremental",
|
|
781
|
+
"composite",
|
|
782
|
+
"tsBuildInfoFile",
|
|
783
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
784
|
+
"disableSolutionSearching",
|
|
785
|
+
"disableReferencedProjectLoad",
|
|
786
|
+
/* Language and Environment */
|
|
787
|
+
"target",
|
|
788
|
+
"jsx",
|
|
789
|
+
"jsxFactory",
|
|
790
|
+
"jsxFragmentFactory",
|
|
791
|
+
"jsxImportSource",
|
|
792
|
+
"lib",
|
|
793
|
+
"moduleDetection",
|
|
794
|
+
"noLib",
|
|
795
|
+
"reactNamespace",
|
|
796
|
+
"useDefineForClassFields",
|
|
797
|
+
"emitDecoratorMetadata",
|
|
798
|
+
"experimentalDecorators",
|
|
799
|
+
/* Modules */
|
|
800
|
+
"baseUrl",
|
|
801
|
+
"rootDir",
|
|
802
|
+
"rootDirs",
|
|
803
|
+
"customConditions",
|
|
804
|
+
"module",
|
|
805
|
+
"moduleResolution",
|
|
806
|
+
"moduleSuffixes",
|
|
807
|
+
"noResolve",
|
|
808
|
+
"paths",
|
|
809
|
+
"resolveJsonModule",
|
|
810
|
+
"resolvePackageJsonExports",
|
|
811
|
+
"resolvePackageJsonImports",
|
|
812
|
+
"typeRoots",
|
|
813
|
+
"types",
|
|
814
|
+
"allowArbitraryExtensions",
|
|
815
|
+
"allowImportingTsExtensions",
|
|
816
|
+
"allowUmdGlobalAccess",
|
|
817
|
+
/* JavaScript Support */
|
|
818
|
+
"allowJs",
|
|
819
|
+
"checkJs",
|
|
820
|
+
"maxNodeModuleJsDepth",
|
|
821
|
+
/* Type Checking */
|
|
822
|
+
"strict",
|
|
823
|
+
"strictBindCallApply",
|
|
824
|
+
"strictFunctionTypes",
|
|
825
|
+
"strictNullChecks",
|
|
826
|
+
"strictPropertyInitialization",
|
|
827
|
+
"allowUnreachableCode",
|
|
828
|
+
"allowUnusedLabels",
|
|
829
|
+
"alwaysStrict",
|
|
830
|
+
"exactOptionalPropertyTypes",
|
|
831
|
+
"noFallthroughCasesInSwitch",
|
|
832
|
+
"noImplicitAny",
|
|
833
|
+
"noImplicitOverride",
|
|
834
|
+
"noImplicitReturns",
|
|
835
|
+
"noImplicitThis",
|
|
836
|
+
"noPropertyAccessFromIndexSignature",
|
|
837
|
+
"noUncheckedIndexedAccess",
|
|
838
|
+
"noUnusedLocals",
|
|
839
|
+
"noUnusedParameters",
|
|
840
|
+
"useUnknownInCatchVariables",
|
|
841
|
+
/* Emit */
|
|
842
|
+
"declaration",
|
|
843
|
+
"declarationDir",
|
|
844
|
+
"declarationMap",
|
|
845
|
+
"downlevelIteration",
|
|
846
|
+
"emitBOM",
|
|
847
|
+
"emitDeclarationOnly",
|
|
848
|
+
"importHelpers",
|
|
849
|
+
"importsNotUsedAsValues",
|
|
850
|
+
"inlineSourceMap",
|
|
851
|
+
"inlineSources",
|
|
852
|
+
"isolatedDeclarations",
|
|
853
|
+
"mapRoot",
|
|
854
|
+
"newLine",
|
|
855
|
+
"noEmit",
|
|
856
|
+
"noEmitHelpers",
|
|
857
|
+
"noEmitOnError",
|
|
858
|
+
"outDir",
|
|
859
|
+
"outFile",
|
|
860
|
+
"preserveConstEnums",
|
|
861
|
+
"preserveValueImports",
|
|
862
|
+
"removeComments",
|
|
863
|
+
"sourceMap",
|
|
864
|
+
"sourceRoot",
|
|
865
|
+
"stripInternal",
|
|
866
|
+
/* Interop Constraints */
|
|
867
|
+
"allowSyntheticDefaultImports",
|
|
868
|
+
"esModuleInterop",
|
|
869
|
+
"forceConsistentCasingInFileNames",
|
|
870
|
+
"isolatedModules",
|
|
871
|
+
"preserveSymlinks",
|
|
872
|
+
"verbatimModuleSyntax",
|
|
873
|
+
/* Completeness */
|
|
874
|
+
"skipDefaultLibCheck",
|
|
875
|
+
"skipLibCheck"
|
|
876
|
+
],
|
|
877
|
+
pathPattern: "^compilerOptions$"
|
|
878
|
+
}
|
|
879
|
+
]
|
|
880
|
+
}
|
|
854
881
|
}
|
|
855
|
-
|
|
856
|
-
|
|
882
|
+
];
|
|
883
|
+
}
|
|
857
884
|
|
|
858
885
|
// src/configs/stylistic.ts
|
|
859
886
|
import plugin7 from "@stylistic/eslint-plugin";
|
|
@@ -866,26 +893,37 @@ var config = plugin7.configs.customize({
|
|
|
866
893
|
semi: false
|
|
867
894
|
});
|
|
868
895
|
config.rules["style/indent"][2].offsetTernaryExpressions = false;
|
|
869
|
-
|
|
870
|
-
{
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
896
|
+
function stylistic(options = {}) {
|
|
897
|
+
const {
|
|
898
|
+
overrides = {}
|
|
899
|
+
} = options;
|
|
900
|
+
return [
|
|
901
|
+
{
|
|
902
|
+
name: "ivanmaxlogiudice/stylistic/rules",
|
|
903
|
+
plugins: {
|
|
904
|
+
style: plugin7
|
|
905
|
+
},
|
|
906
|
+
rules: {
|
|
907
|
+
...config.rules,
|
|
908
|
+
"antfu/consistent-list-newline": "error",
|
|
909
|
+
"antfu/curly": "error",
|
|
910
|
+
"antfu/if-newline": "error",
|
|
911
|
+
"antfu/top-level-function": "error",
|
|
912
|
+
"style/function-call-spacing": ["error", "never"],
|
|
913
|
+
...overrides
|
|
914
|
+
}
|
|
882
915
|
}
|
|
883
|
-
|
|
884
|
-
|
|
916
|
+
];
|
|
917
|
+
}
|
|
885
918
|
|
|
886
919
|
// src/configs/test.ts
|
|
887
920
|
var _pluginTest;
|
|
888
|
-
async function test() {
|
|
921
|
+
async function test(options = {}) {
|
|
922
|
+
const {
|
|
923
|
+
files = GLOB_TESTS,
|
|
924
|
+
isInEditor = false,
|
|
925
|
+
overrides = {}
|
|
926
|
+
} = options;
|
|
889
927
|
const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
|
|
890
928
|
interopDefault(import("@vitest/eslint-plugin")),
|
|
891
929
|
// @ts-expect-error missing types
|
|
@@ -908,16 +946,17 @@ async function test() {
|
|
|
908
946
|
},
|
|
909
947
|
{
|
|
910
948
|
name: "ivanmaxlogiudice/test/rules",
|
|
911
|
-
files
|
|
949
|
+
files,
|
|
912
950
|
rules: {
|
|
913
951
|
"node/prefer-global/process": "off",
|
|
914
952
|
"test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
915
953
|
"test/no-identical-title": "error",
|
|
916
954
|
"test/no-import-node-test": "error",
|
|
917
|
-
"test/no-only-tests":
|
|
955
|
+
"test/no-only-tests": isInEditor ? "off" : "error",
|
|
918
956
|
"test/prefer-hooks-in-order": "error",
|
|
919
957
|
"test/prefer-lowercase-title": "error",
|
|
920
|
-
"ts/explicit-function-return-type": "off"
|
|
958
|
+
"ts/explicit-function-return-type": "off",
|
|
959
|
+
...overrides
|
|
921
960
|
}
|
|
922
961
|
}
|
|
923
962
|
];
|
|
@@ -929,9 +968,10 @@ import parser2 from "@typescript-eslint/parser";
|
|
|
929
968
|
function typescript(options = {}) {
|
|
930
969
|
const {
|
|
931
970
|
componentExts = [],
|
|
971
|
+
overrides = {},
|
|
932
972
|
type = "app"
|
|
933
973
|
} = options;
|
|
934
|
-
const files = [GLOB_TS, ...componentExts.map((ext) => `**/*.${ext}`)];
|
|
974
|
+
const files = options.files ?? [GLOB_TS, ...componentExts.map((ext) => `**/*.${ext}`)];
|
|
935
975
|
return [
|
|
936
976
|
{
|
|
937
977
|
name: "ivanmaxlogiudice/typescript/setup",
|
|
@@ -991,7 +1031,8 @@ function typescript(options = {}) {
|
|
|
991
1031
|
allowHigherOrderFunctions: true,
|
|
992
1032
|
allowIIFEs: true
|
|
993
1033
|
}]
|
|
994
|
-
} : {}
|
|
1034
|
+
} : {},
|
|
1035
|
+
...overrides
|
|
995
1036
|
}
|
|
996
1037
|
},
|
|
997
1038
|
{
|
|
@@ -1023,47 +1064,50 @@ function typescript(options = {}) {
|
|
|
1023
1064
|
|
|
1024
1065
|
// src/configs/unicorn.ts
|
|
1025
1066
|
import plugin9 from "eslint-plugin-unicorn";
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1067
|
+
function unicorn() {
|
|
1068
|
+
return [
|
|
1069
|
+
{
|
|
1070
|
+
name: "ivanmaxlogiudice/unicorn/rules",
|
|
1071
|
+
plugins: {
|
|
1072
|
+
unicorn: plugin9
|
|
1073
|
+
},
|
|
1074
|
+
rules: {
|
|
1075
|
+
// Pass error message when throwing errors
|
|
1076
|
+
"unicorn/error-message": "error",
|
|
1077
|
+
// Uppercase regex escapes
|
|
1078
|
+
"unicorn/escape-case": "error",
|
|
1079
|
+
// Array.isArray instead of instanceof
|
|
1080
|
+
"unicorn/no-instanceof-array": "error",
|
|
1081
|
+
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1082
|
+
"unicorn/no-new-array": "error",
|
|
1083
|
+
// Prevent deprecated `new Buffer()`
|
|
1084
|
+
"unicorn/no-new-buffer": "error",
|
|
1085
|
+
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1086
|
+
"unicorn/number-literal-case": "error",
|
|
1087
|
+
// textContent instead of innerText
|
|
1088
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1089
|
+
// includes over indexOf when checking for existence
|
|
1090
|
+
"unicorn/prefer-includes": "error",
|
|
1091
|
+
// Prefer using the node: protocol
|
|
1092
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1093
|
+
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1094
|
+
"unicorn/prefer-number-properties": "error",
|
|
1095
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1096
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1097
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
1098
|
+
"unicorn/prefer-type-error": "error",
|
|
1099
|
+
// Use new when throwing error
|
|
1100
|
+
"unicorn/throw-new-error": "error"
|
|
1101
|
+
}
|
|
1059
1102
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1103
|
+
];
|
|
1104
|
+
}
|
|
1062
1105
|
|
|
1063
1106
|
// src/configs/unocss.ts
|
|
1064
1107
|
async function unocss(options = {}) {
|
|
1065
1108
|
const {
|
|
1066
1109
|
attributify = true,
|
|
1110
|
+
overrides = {},
|
|
1067
1111
|
strict = false
|
|
1068
1112
|
} = options;
|
|
1069
1113
|
await ensurePackages(["@unocss/eslint-plugin"]);
|
|
@@ -1079,7 +1123,8 @@ async function unocss(options = {}) {
|
|
|
1079
1123
|
rules: {
|
|
1080
1124
|
"unocss/order": "warn",
|
|
1081
1125
|
...attributify ? { "unocss/order-attributify": "warn" } : {},
|
|
1082
|
-
...strict ? { "unocss/blocklist": "error" } : {}
|
|
1126
|
+
...strict ? { "unocss/blocklist": "error" } : {},
|
|
1127
|
+
...overrides
|
|
1083
1128
|
}
|
|
1084
1129
|
}
|
|
1085
1130
|
];
|
|
@@ -1087,6 +1132,10 @@ async function unocss(options = {}) {
|
|
|
1087
1132
|
|
|
1088
1133
|
// src/configs/vue.ts
|
|
1089
1134
|
async function vue(options = {}) {
|
|
1135
|
+
const {
|
|
1136
|
+
files = [GLOB_VUE],
|
|
1137
|
+
overrides = {}
|
|
1138
|
+
} = options;
|
|
1090
1139
|
await ensurePackages(["eslint-plugin-vue", "vue-eslint-parser"]);
|
|
1091
1140
|
const [plugin10, parser3] = await Promise.all([
|
|
1092
1141
|
// @ts-expect-error missing types
|
|
@@ -1122,7 +1171,7 @@ async function vue(options = {}) {
|
|
|
1122
1171
|
},
|
|
1123
1172
|
{
|
|
1124
1173
|
name: "ivanmaxlogiudice/vue/rules",
|
|
1125
|
-
files
|
|
1174
|
+
files,
|
|
1126
1175
|
languageOptions: {
|
|
1127
1176
|
parser: parser3,
|
|
1128
1177
|
parserOptions: {
|
|
@@ -1214,14 +1263,19 @@ async function vue(options = {}) {
|
|
|
1214
1263
|
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1215
1264
|
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1216
1265
|
"vue/space-in-parens": ["error", "never"],
|
|
1217
|
-
"vue/template-curly-spacing": "error"
|
|
1266
|
+
"vue/template-curly-spacing": "error",
|
|
1267
|
+
...overrides
|
|
1218
1268
|
}
|
|
1219
1269
|
}
|
|
1220
1270
|
];
|
|
1221
1271
|
}
|
|
1222
1272
|
|
|
1223
1273
|
// src/configs/yaml.ts
|
|
1224
|
-
async function yaml() {
|
|
1274
|
+
async function yaml(options = {}) {
|
|
1275
|
+
const {
|
|
1276
|
+
files = [GLOB_YAML],
|
|
1277
|
+
overrides = {}
|
|
1278
|
+
} = options;
|
|
1225
1279
|
await ensurePackages(["eslint-plugin-yml", "yaml-eslint-parser"]);
|
|
1226
1280
|
const [plugin10, parser3] = await Promise.all([
|
|
1227
1281
|
interopDefault(import("eslint-plugin-yml")),
|
|
@@ -1236,7 +1290,7 @@ async function yaml() {
|
|
|
1236
1290
|
},
|
|
1237
1291
|
{
|
|
1238
1292
|
name: "ivanmaxlogiudice/yaml/rules",
|
|
1239
|
-
files
|
|
1293
|
+
files,
|
|
1240
1294
|
languageOptions: {
|
|
1241
1295
|
parser: parser3
|
|
1242
1296
|
},
|
|
@@ -1261,7 +1315,8 @@ async function yaml() {
|
|
|
1261
1315
|
"yaml/key-spacing": "error",
|
|
1262
1316
|
"yaml/no-tab-indent": "error",
|
|
1263
1317
|
"yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1264
|
-
"yaml/spaced-comment": "error"
|
|
1318
|
+
"yaml/spaced-comment": "error",
|
|
1319
|
+
...overrides
|
|
1265
1320
|
}
|
|
1266
1321
|
}
|
|
1267
1322
|
];
|
|
@@ -1269,28 +1324,35 @@ async function yaml() {
|
|
|
1269
1324
|
|
|
1270
1325
|
// src/factory.ts
|
|
1271
1326
|
async function config2(options = {}, ...userConfigs) {
|
|
1272
|
-
clearPackageCache();
|
|
1273
1327
|
const {
|
|
1274
1328
|
componentExts = [],
|
|
1329
|
+
isInEditor = isInEditorEnv(),
|
|
1275
1330
|
regexp: enableRegexp = false,
|
|
1276
|
-
typescript: enableTypeScript =
|
|
1331
|
+
typescript: enableTypeScript = isPackageInScope("typescript"),
|
|
1277
1332
|
unocss: enableUnoCSS = hasSomePackage(["unocss", "@unocss/nuxt"]),
|
|
1278
1333
|
vue: enableVue = hasSomePackage(["vue", "nuxt", "vitepress", "@slidev/cli"])
|
|
1279
1334
|
} = options;
|
|
1280
1335
|
const configs = [
|
|
1281
|
-
comments,
|
|
1336
|
+
comments(),
|
|
1282
1337
|
ignores(),
|
|
1283
|
-
imports,
|
|
1284
|
-
javascript
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1338
|
+
imports(),
|
|
1339
|
+
javascript({
|
|
1340
|
+
isInEditor,
|
|
1341
|
+
overrides: getOverrides(options, "javascript")
|
|
1342
|
+
}),
|
|
1343
|
+
jsdoc(),
|
|
1344
|
+
node(),
|
|
1345
|
+
perfectionist(),
|
|
1346
|
+
stylistic({
|
|
1347
|
+
overrides: getOverrides(options, "stylistic")
|
|
1348
|
+
}),
|
|
1349
|
+
unicorn(),
|
|
1290
1350
|
// Basic json(c) file support and sorting json keys
|
|
1291
|
-
jsonc
|
|
1292
|
-
|
|
1293
|
-
|
|
1351
|
+
jsonc({
|
|
1352
|
+
overrides: getOverrides(options, "jsonc")
|
|
1353
|
+
}),
|
|
1354
|
+
sortPackageJson(),
|
|
1355
|
+
sortTsconfig()
|
|
1294
1356
|
];
|
|
1295
1357
|
if (enableVue) {
|
|
1296
1358
|
componentExts.push("vue");
|
|
@@ -1298,31 +1360,44 @@ async function config2(options = {}, ...userConfigs) {
|
|
|
1298
1360
|
if (enableTypeScript) {
|
|
1299
1361
|
configs.push(typescript({
|
|
1300
1362
|
componentExts,
|
|
1363
|
+
overrides: getOverrides(options, "typescript"),
|
|
1301
1364
|
type: options.type
|
|
1302
1365
|
}));
|
|
1303
1366
|
}
|
|
1304
1367
|
if (enableRegexp) {
|
|
1305
|
-
configs.push(regexp(
|
|
1368
|
+
configs.push(regexp({
|
|
1369
|
+
overrides: getOverrides(options, "regexp")
|
|
1370
|
+
}));
|
|
1306
1371
|
}
|
|
1307
1372
|
if (options.test ?? true) {
|
|
1308
|
-
configs.push(test(
|
|
1373
|
+
configs.push(test({
|
|
1374
|
+
isInEditor,
|
|
1375
|
+
overrides: getOverrides(options, "test")
|
|
1376
|
+
}));
|
|
1309
1377
|
}
|
|
1310
1378
|
if (enableVue) {
|
|
1311
1379
|
configs.push(vue({
|
|
1312
|
-
|
|
1380
|
+
...resolveSubOptions(options, "vue"),
|
|
1381
|
+
overrides: getOverrides(options, "vue"),
|
|
1382
|
+
typescript: !!enableTypeScript
|
|
1313
1383
|
}));
|
|
1314
1384
|
}
|
|
1315
1385
|
if (enableUnoCSS) {
|
|
1316
1386
|
configs.push(unocss({
|
|
1317
|
-
...resolveSubOptions(options, "unocss")
|
|
1387
|
+
...resolveSubOptions(options, "unocss"),
|
|
1388
|
+
overrides: getOverrides(options, "unocss")
|
|
1318
1389
|
}));
|
|
1319
1390
|
}
|
|
1320
1391
|
if (options.yaml) {
|
|
1321
|
-
configs.push(yaml(
|
|
1392
|
+
configs.push(yaml({
|
|
1393
|
+
overrides: getOverrides(options, "yaml")
|
|
1394
|
+
}));
|
|
1322
1395
|
}
|
|
1323
1396
|
if (options.markdown) {
|
|
1324
1397
|
configs.push(markdown({
|
|
1325
|
-
componentExts
|
|
1398
|
+
componentExts,
|
|
1399
|
+
...resolveSubOptions(options, "markdown"),
|
|
1400
|
+
overrides: getOverrides(options, "markdown")
|
|
1326
1401
|
}));
|
|
1327
1402
|
}
|
|
1328
1403
|
const merged = await combine(
|
|
@@ -1334,6 +1409,13 @@ async function config2(options = {}, ...userConfigs) {
|
|
|
1334
1409
|
function resolveSubOptions(options, key) {
|
|
1335
1410
|
return typeof options[key] === "boolean" ? {} : options[key] || {};
|
|
1336
1411
|
}
|
|
1412
|
+
function getOverrides(options, key) {
|
|
1413
|
+
const sub = resolveSubOptions(options, key);
|
|
1414
|
+
return {
|
|
1415
|
+
...options.overrides?.[key],
|
|
1416
|
+
..."overrides" in sub ? sub.overrides : {}
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1337
1419
|
|
|
1338
1420
|
// src/index.ts
|
|
1339
1421
|
var src_default = config2;
|
|
@@ -1352,24 +1434,24 @@ export {
|
|
|
1352
1434
|
GLOB_TS,
|
|
1353
1435
|
GLOB_VUE,
|
|
1354
1436
|
GLOB_YAML,
|
|
1355
|
-
clearPackageCache,
|
|
1356
1437
|
combine,
|
|
1357
1438
|
comments,
|
|
1358
1439
|
config2 as config,
|
|
1359
1440
|
src_default as default,
|
|
1360
1441
|
ensurePackages,
|
|
1361
1442
|
findUp,
|
|
1443
|
+
getOverrides,
|
|
1362
1444
|
hasSomePackage,
|
|
1363
1445
|
ignores,
|
|
1364
1446
|
imports,
|
|
1365
1447
|
interopDefault,
|
|
1366
1448
|
isInEditorEnv,
|
|
1449
|
+
isPackageInScope,
|
|
1367
1450
|
javascript,
|
|
1368
1451
|
jsdoc,
|
|
1369
1452
|
jsonc,
|
|
1370
1453
|
markdown,
|
|
1371
1454
|
node,
|
|
1372
|
-
packageExists,
|
|
1373
1455
|
perfectionist,
|
|
1374
1456
|
regexp,
|
|
1375
1457
|
renameRules,
|