@exbotanical/eslint-config 1.1.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +290 -20
- package/dist/index.js +1981 -2426
- package/package.json +39 -17
package/dist/index.js
CHANGED
|
@@ -1,833 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
|
-
var __esm = (fn, res) => function __init() {
|
|
14
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
15
|
-
};
|
|
16
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
17
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
-
for (let key of __getOwnPropNames(from))
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
-
}
|
|
25
|
-
return to;
|
|
26
|
-
};
|
|
27
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
28
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
29
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
30
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
31
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
32
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
33
|
-
mod
|
|
34
|
-
));
|
|
35
|
-
|
|
36
|
-
// node_modules/tsup/assets/esm_shims.js
|
|
37
|
-
import { fileURLToPath } from "url";
|
|
38
|
-
import path from "path";
|
|
39
|
-
var getFilename, getDirname, __dirname;
|
|
40
|
-
var init_esm_shims = __esm({
|
|
41
|
-
"node_modules/tsup/assets/esm_shims.js"() {
|
|
42
|
-
"use strict";
|
|
43
|
-
getFilename = () => fileURLToPath(import.meta.url);
|
|
44
|
-
getDirname = () => path.dirname(getFilename());
|
|
45
|
-
__dirname = /* @__PURE__ */ getDirname();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// node_modules/eslint-plugin-cypress/package.json
|
|
50
|
-
var require_package = __commonJS({
|
|
51
|
-
"node_modules/eslint-plugin-cypress/package.json"(exports, module) {
|
|
52
|
-
module.exports = {
|
|
53
|
-
name: "eslint-plugin-cypress",
|
|
54
|
-
version: "4.2.0",
|
|
55
|
-
description: "An ESLint plugin for projects using Cypress",
|
|
56
|
-
main: "legacy.js",
|
|
57
|
-
exports: {
|
|
58
|
-
".": "./legacy.js",
|
|
59
|
-
"./flat": "./lib/flat.js"
|
|
60
|
-
},
|
|
61
|
-
author: "Cypress-io",
|
|
62
|
-
license: "MIT",
|
|
63
|
-
keywords: [
|
|
64
|
-
"eslint",
|
|
65
|
-
"eslintplugin",
|
|
66
|
-
"cypress"
|
|
67
|
-
],
|
|
68
|
-
repository: {
|
|
69
|
-
type: "git",
|
|
70
|
-
url: "git+https://github.com/cypress-io/eslint-plugin-cypress.git"
|
|
71
|
-
},
|
|
72
|
-
bugs: {
|
|
73
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/issues"
|
|
74
|
-
},
|
|
75
|
-
homepage: "https://github.com/cypress-io/eslint-plugin-cypress#readme",
|
|
76
|
-
peerDependencies: {
|
|
77
|
-
eslint: ">=9"
|
|
78
|
-
},
|
|
79
|
-
dependencies: {
|
|
80
|
-
globals: "^15.11.0"
|
|
81
|
-
},
|
|
82
|
-
devDependencies: {
|
|
83
|
-
eslint: "^9.13.0",
|
|
84
|
-
"eslint-plugin-eslint-plugin": "^6.3.1",
|
|
85
|
-
"eslint-plugin-mocha": "^10.5.0",
|
|
86
|
-
husky: "^9.1.6",
|
|
87
|
-
jest: "^29.7.0",
|
|
88
|
-
"semantic-release": "24.2.0"
|
|
89
|
-
},
|
|
90
|
-
scripts: {
|
|
91
|
-
lint: 'eslint "*.js" "**/**/*.js"',
|
|
92
|
-
"lint-fix": "npm run lint -- --fix",
|
|
93
|
-
"semantic-release": "semantic-release",
|
|
94
|
-
start: "npm run test-watch",
|
|
95
|
-
test: "jest",
|
|
96
|
-
"test:legacy": "jest --config jest.config-legacy.js",
|
|
97
|
-
"test-watch": "jest --watchAll",
|
|
98
|
-
prepare: "husky"
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// node_modules/eslint-plugin-cypress/lib/rules/no-assigning-return-values.js
|
|
105
|
-
var require_no_assigning_return_values = __commonJS({
|
|
106
|
-
"node_modules/eslint-plugin-cypress/lib/rules/no-assigning-return-values.js"(exports, module) {
|
|
107
|
-
"use strict";
|
|
108
|
-
init_esm_shims();
|
|
109
|
-
function get(obj, propertyString = "") {
|
|
110
|
-
const properties = propertyString.split(".");
|
|
111
|
-
for (let i = 0; i < properties.length; i++) {
|
|
112
|
-
const value = (obj || {})[properties[i]];
|
|
113
|
-
if (value == null) return value;
|
|
114
|
-
obj = value;
|
|
115
|
-
}
|
|
116
|
-
return obj;
|
|
117
|
-
}
|
|
118
|
-
module.exports = {
|
|
119
|
-
meta: {
|
|
120
|
-
type: "problem",
|
|
121
|
-
docs: {
|
|
122
|
-
description: "disallow assigning return values of `cy` calls",
|
|
123
|
-
category: "Possible Errors",
|
|
124
|
-
recommended: true,
|
|
125
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-assigning-return-values.md"
|
|
126
|
-
},
|
|
127
|
-
schema: [],
|
|
128
|
-
messages: {
|
|
129
|
-
unexpected: "Do not assign the return value of a Cypress command"
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
create(context) {
|
|
133
|
-
return {
|
|
134
|
-
VariableDeclaration(node2) {
|
|
135
|
-
if (node2.declarations.some(isCypressCommandDeclaration)) {
|
|
136
|
-
context.report({ node: node2, messageId: "unexpected" });
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
var allowedCommands = {
|
|
143
|
-
now: true,
|
|
144
|
-
spy: true,
|
|
145
|
-
state: true,
|
|
146
|
-
stub: true
|
|
147
|
-
};
|
|
148
|
-
function isCypressCommandDeclaration(declarator) {
|
|
149
|
-
let object = get(declarator, "init.callee.object");
|
|
150
|
-
if (!object) return;
|
|
151
|
-
while (object.callee) {
|
|
152
|
-
object = object.callee.object;
|
|
153
|
-
if (!object) return;
|
|
154
|
-
}
|
|
155
|
-
const commandName = get(declarator, "init.callee.property.name");
|
|
156
|
-
const parent = get(object, "parent.property.name") || get(declarator, "id.name");
|
|
157
|
-
if (commandName && (allowedCommands[commandName] || allowedCommands[parent])) return;
|
|
158
|
-
return object.name === "cy";
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
// node_modules/eslint-plugin-cypress/lib/rules/unsafe-to-chain-command.js
|
|
164
|
-
var require_unsafe_to_chain_command = __commonJS({
|
|
165
|
-
"node_modules/eslint-plugin-cypress/lib/rules/unsafe-to-chain-command.js"(exports, module) {
|
|
166
|
-
"use strict";
|
|
167
|
-
init_esm_shims();
|
|
168
|
-
var { basename } = __require("path");
|
|
169
|
-
var NAME = basename(__dirname);
|
|
170
|
-
var DESCRIPTION = "disallow actions within chains";
|
|
171
|
-
var unsafeToChainActions = [
|
|
172
|
-
"blur",
|
|
173
|
-
"clear",
|
|
174
|
-
"click",
|
|
175
|
-
"check",
|
|
176
|
-
"dblclick",
|
|
177
|
-
"each",
|
|
178
|
-
"focus",
|
|
179
|
-
"rightclick",
|
|
180
|
-
"screenshot",
|
|
181
|
-
"scrollIntoView",
|
|
182
|
-
"scrollTo",
|
|
183
|
-
"select",
|
|
184
|
-
"selectFile",
|
|
185
|
-
"spread",
|
|
186
|
-
"submit",
|
|
187
|
-
"type",
|
|
188
|
-
"trigger",
|
|
189
|
-
"uncheck",
|
|
190
|
-
"within"
|
|
191
|
-
];
|
|
192
|
-
var schema = {
|
|
193
|
-
title: NAME,
|
|
194
|
-
description: DESCRIPTION,
|
|
195
|
-
type: "object",
|
|
196
|
-
properties: {
|
|
197
|
-
methods: {
|
|
198
|
-
type: "array",
|
|
199
|
-
description: "An additional list of methods to check for unsafe chaining.",
|
|
200
|
-
default: []
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
var getDefaultOptions = (context) => {
|
|
205
|
-
return Object.entries(schema.properties).reduce((acc, [key, value]) => {
|
|
206
|
-
if (!(value.default in value)) return acc;
|
|
207
|
-
return {
|
|
208
|
-
...acc,
|
|
209
|
-
[key]: value.default
|
|
210
|
-
};
|
|
211
|
-
}, context.options[0] || {});
|
|
212
|
-
};
|
|
213
|
-
module.exports = {
|
|
214
|
-
meta: {
|
|
215
|
-
type: "problem",
|
|
216
|
-
docs: {
|
|
217
|
-
description: DESCRIPTION,
|
|
218
|
-
category: "Possible Errors",
|
|
219
|
-
recommended: true,
|
|
220
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/unsafe-to-chain-command.md"
|
|
221
|
-
},
|
|
222
|
-
schema: [schema],
|
|
223
|
-
messages: {
|
|
224
|
-
unexpected: "It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from `cy.` in a next command line."
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
create(context) {
|
|
228
|
-
const { methods } = getDefaultOptions(context);
|
|
229
|
-
return {
|
|
230
|
-
CallExpression(node2) {
|
|
231
|
-
if (isRootCypress(node2) && isActionUnsafeToChain(node2, methods) && node2.parent.type === "MemberExpression") {
|
|
232
|
-
context.report({
|
|
233
|
-
node: node2,
|
|
234
|
-
messageId: "unexpected"
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
var isRootCypress = (node2) => {
|
|
242
|
-
if (node2.type !== "CallExpression" || node2.callee.type !== "MemberExpression") {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
if (node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy") {
|
|
246
|
-
return true;
|
|
247
|
-
}
|
|
248
|
-
return isRootCypress(node2.callee.object);
|
|
249
|
-
};
|
|
250
|
-
var isActionUnsafeToChain = (node2, additionalMethods = []) => {
|
|
251
|
-
const unsafeActionsRegex = new RegExp([
|
|
252
|
-
...unsafeToChainActions.map((action) => `^${action}$`),
|
|
253
|
-
...additionalMethods.map((method) => method instanceof RegExp ? method.source : method)
|
|
254
|
-
].join("|"));
|
|
255
|
-
return node2.callee && node2.callee.property && node2.callee.property.type === "Identifier" && unsafeActionsRegex.test(node2.callee.property.name);
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
// node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js
|
|
261
|
-
var require_no_unnecessary_waiting = __commonJS({
|
|
262
|
-
"node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js"(exports, module) {
|
|
263
|
-
"use strict";
|
|
264
|
-
init_esm_shims();
|
|
265
|
-
module.exports = {
|
|
266
|
-
meta: {
|
|
267
|
-
type: "problem",
|
|
268
|
-
docs: {
|
|
269
|
-
description: "disallow waiting for arbitrary time periods",
|
|
270
|
-
category: "Possible Errors",
|
|
271
|
-
recommended: true,
|
|
272
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-unnecessary-waiting.md"
|
|
273
|
-
},
|
|
274
|
-
schema: [],
|
|
275
|
-
messages: {
|
|
276
|
-
unexpected: "Do not wait for arbitrary time periods"
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
create(context) {
|
|
280
|
-
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
281
|
-
return {
|
|
282
|
-
CallExpression(node2) {
|
|
283
|
-
if (isCallingCyWait(node2)) {
|
|
284
|
-
const scope = sourceCode.getScope ? sourceCode.getScope(node2) : context.getScope();
|
|
285
|
-
if (isIdentifierNumberConstArgument(node2, scope) || isNumberArgument(node2)) {
|
|
286
|
-
context.report({ node: node2, messageId: "unexpected" });
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
function nodeIsCalledByCy(node2) {
|
|
294
|
-
if (node2.type === "Identifier" && node2.name === "cy") return true;
|
|
295
|
-
if (typeof node2.callee === "undefined" || typeof node2.callee.object === "undefined") {
|
|
296
|
-
return false;
|
|
297
|
-
}
|
|
298
|
-
return nodeIsCalledByCy(node2.callee.object);
|
|
299
|
-
}
|
|
300
|
-
function isCallingCyWait(node2) {
|
|
301
|
-
return node2.callee.type === "MemberExpression" && nodeIsCalledByCy(node2) && node2.callee.property.type === "Identifier" && node2.callee.property.name === "wait";
|
|
302
|
-
}
|
|
303
|
-
function isNumberArgument(node2) {
|
|
304
|
-
return node2.arguments.length > 0 && node2.arguments[0].type === "Literal" && typeof node2.arguments[0].value === "number";
|
|
305
|
-
}
|
|
306
|
-
function isIdentifierNumberConstArgument(node2, scope) {
|
|
307
|
-
if (node2.arguments.length === 0) return false;
|
|
308
|
-
if (node2.arguments[0].type !== "Identifier") return false;
|
|
309
|
-
const identifier = node2.arguments[0];
|
|
310
|
-
const resolvedIdentifier = scope.references.find((ref) => ref.identifier === identifier).resolved;
|
|
311
|
-
const definition = resolvedIdentifier.defs[0];
|
|
312
|
-
const isVariable = definition.type === "Variable";
|
|
313
|
-
if (isVariable) {
|
|
314
|
-
if (!definition.node.init) return false;
|
|
315
|
-
return typeof definition.node.init.value === "number";
|
|
316
|
-
}
|
|
317
|
-
if (definition.type === "ImportBinding") return false;
|
|
318
|
-
const param = definition.node.params[definition.index];
|
|
319
|
-
if (!param || param.type !== "AssignmentPattern") return false;
|
|
320
|
-
return typeof param.right.value === "number";
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
// node_modules/eslint-plugin-cypress/lib/rules/no-async-before.js
|
|
326
|
-
var require_no_async_before = __commonJS({
|
|
327
|
-
"node_modules/eslint-plugin-cypress/lib/rules/no-async-before.js"(exports, module) {
|
|
328
|
-
"use strict";
|
|
329
|
-
init_esm_shims();
|
|
330
|
-
module.exports = {
|
|
331
|
-
meta: {
|
|
332
|
-
type: "problem",
|
|
333
|
-
docs: {
|
|
334
|
-
description: "disallow using `async`/`await` in Cypress `before` methods",
|
|
335
|
-
category: "Possible Errors",
|
|
336
|
-
recommended: true,
|
|
337
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-async-before.md"
|
|
338
|
-
},
|
|
339
|
-
schema: [],
|
|
340
|
-
messages: {
|
|
341
|
-
unexpected: "Avoid using async functions with Cypress before / beforeEach functions"
|
|
342
|
-
}
|
|
343
|
-
},
|
|
344
|
-
create(context) {
|
|
345
|
-
function isBeforeBlock(callExpressionNode) {
|
|
346
|
-
const { type, name } = callExpressionNode.callee;
|
|
347
|
-
return type === "Identifier" && name === "before" || name === "beforeEach";
|
|
348
|
-
}
|
|
349
|
-
function isBeforeAsync(node2) {
|
|
350
|
-
return node2.arguments && node2.arguments.length >= 2 && node2.arguments[1].async === true;
|
|
351
|
-
}
|
|
352
|
-
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
353
|
-
return {
|
|
354
|
-
Identifier(node2) {
|
|
355
|
-
if (node2.name === "cy" || node2.name === "Cypress") {
|
|
356
|
-
const ancestors = sourceCode.getAncestors ? sourceCode.getAncestors(node2) : context.getAncestors();
|
|
357
|
-
const asyncTestBlocks = ancestors.filter((n) => n.type === "CallExpression").filter(isBeforeBlock).filter(isBeforeAsync);
|
|
358
|
-
if (asyncTestBlocks.length >= 1) {
|
|
359
|
-
asyncTestBlocks.forEach((node3) => {
|
|
360
|
-
context.report({ node: node3, messageId: "unexpected" });
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
// node_modules/eslint-plugin-cypress/lib/rules/no-async-tests.js
|
|
372
|
-
var require_no_async_tests = __commonJS({
|
|
373
|
-
"node_modules/eslint-plugin-cypress/lib/rules/no-async-tests.js"(exports, module) {
|
|
374
|
-
"use strict";
|
|
375
|
-
init_esm_shims();
|
|
376
|
-
module.exports = {
|
|
377
|
-
meta: {
|
|
378
|
-
type: "problem",
|
|
379
|
-
docs: {
|
|
380
|
-
description: "disallow using `async`/`await` in Cypress test cases",
|
|
381
|
-
category: "Possible Errors",
|
|
382
|
-
recommended: true,
|
|
383
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-async-tests.md"
|
|
384
|
-
},
|
|
385
|
-
schema: [],
|
|
386
|
-
messages: {
|
|
387
|
-
unexpected: "Avoid using async functions with Cypress tests"
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
create(context) {
|
|
391
|
-
function isTestBlock(callExpressionNode) {
|
|
392
|
-
const { type, name } = callExpressionNode.callee;
|
|
393
|
-
return type === "Identifier" && name === "it" || name === "test";
|
|
394
|
-
}
|
|
395
|
-
function isTestAsync(node2) {
|
|
396
|
-
return node2.arguments && node2.arguments.length >= 2 && node2.arguments[1].async === true;
|
|
397
|
-
}
|
|
398
|
-
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
399
|
-
return {
|
|
400
|
-
Identifier(node2) {
|
|
401
|
-
if (node2.name === "cy" || node2.name === "Cypress") {
|
|
402
|
-
const ancestors = sourceCode.getAncestors ? sourceCode.getAncestors(node2) : context.getAncestors();
|
|
403
|
-
const asyncTestBlocks = ancestors.filter((n) => n.type === "CallExpression").filter(isTestBlock).filter(isTestAsync);
|
|
404
|
-
if (asyncTestBlocks.length >= 1) {
|
|
405
|
-
asyncTestBlocks.forEach((node3) => {
|
|
406
|
-
context.report({ node: node3, messageId: "unexpected" });
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
// node_modules/eslint-plugin-cypress/lib/rules/assertion-before-screenshot.js
|
|
418
|
-
var require_assertion_before_screenshot = __commonJS({
|
|
419
|
-
"node_modules/eslint-plugin-cypress/lib/rules/assertion-before-screenshot.js"(exports, module) {
|
|
420
|
-
"use strict";
|
|
421
|
-
init_esm_shims();
|
|
422
|
-
var assertionCommands = [
|
|
423
|
-
// assertions
|
|
424
|
-
"should",
|
|
425
|
-
"and",
|
|
426
|
-
"contains",
|
|
427
|
-
// retries until it gets something
|
|
428
|
-
"get",
|
|
429
|
-
// not an assertion, but unlikely to require waiting for render
|
|
430
|
-
"scrollIntoView",
|
|
431
|
-
"scrollTo"
|
|
432
|
-
];
|
|
433
|
-
module.exports = {
|
|
434
|
-
meta: {
|
|
435
|
-
type: "problem",
|
|
436
|
-
docs: {
|
|
437
|
-
description: "require screenshots to be preceded by an assertion",
|
|
438
|
-
category: "Possible Errors",
|
|
439
|
-
recommended: false,
|
|
440
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/assertion-before-screenshot.md"
|
|
441
|
-
},
|
|
442
|
-
schema: [],
|
|
443
|
-
messages: {
|
|
444
|
-
unexpected: "Make an assertion on the page state before taking a screenshot"
|
|
445
|
-
}
|
|
446
|
-
},
|
|
447
|
-
create(context) {
|
|
448
|
-
return {
|
|
449
|
-
CallExpression(node2) {
|
|
450
|
-
if (isCallingCyScreenshot(node2) && !isPreviousAnAssertion(node2)) {
|
|
451
|
-
context.report({ node: node2, messageId: "unexpected" });
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
function isRootCypress(node2) {
|
|
458
|
-
while (node2.type === "CallExpression") {
|
|
459
|
-
if (node2.callee.type !== "MemberExpression") return false;
|
|
460
|
-
if (node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy") {
|
|
461
|
-
return true;
|
|
462
|
-
}
|
|
463
|
-
node2 = node2.callee.object;
|
|
464
|
-
}
|
|
465
|
-
return false;
|
|
466
|
-
}
|
|
467
|
-
function getPreviousInChain(node2) {
|
|
468
|
-
return node2.type === "CallExpression" && node2.callee.type === "MemberExpression" && node2.callee.object.type === "CallExpression" && node2.callee.object.callee.type === "MemberExpression" && node2.callee.object.callee.property.type === "Identifier" && node2.callee.object.callee.property.name;
|
|
469
|
-
}
|
|
470
|
-
function getCallExpressionCypressCommand(node2) {
|
|
471
|
-
return isRootCypress(node2) && node2.callee.property.type === "Identifier" && node2.callee.property.name;
|
|
472
|
-
}
|
|
473
|
-
function isCallingCyScreenshot(node2) {
|
|
474
|
-
return getCallExpressionCypressCommand(node2) === "screenshot";
|
|
475
|
-
}
|
|
476
|
-
function getPreviousCypressCommand(node2) {
|
|
477
|
-
const previousInChain = getPreviousInChain(node2);
|
|
478
|
-
if (previousInChain) {
|
|
479
|
-
return previousInChain;
|
|
480
|
-
}
|
|
481
|
-
while (node2.parent && !node2.parent.body) {
|
|
482
|
-
node2 = node2.parent;
|
|
483
|
-
}
|
|
484
|
-
if (!node2.parent || !node2.parent.body) return null;
|
|
485
|
-
const body = node2.parent.body.type === "BlockStatement" ? node2.parent.body.body : node2.parent.body;
|
|
486
|
-
const index = body.indexOf(node2);
|
|
487
|
-
if (index < 0) return null;
|
|
488
|
-
if (index === 0) return getPreviousCypressCommand(node2.parent);
|
|
489
|
-
const previousStatement = body[index - 1];
|
|
490
|
-
if (previousStatement.type !== "ExpressionStatement" || previousStatement.expression.type !== "CallExpression") {
|
|
491
|
-
return null;
|
|
492
|
-
}
|
|
493
|
-
return getCallExpressionCypressCommand(previousStatement.expression);
|
|
494
|
-
}
|
|
495
|
-
function isPreviousAnAssertion(node2) {
|
|
496
|
-
const previousCypressCommand = getPreviousCypressCommand(node2);
|
|
497
|
-
return assertionCommands.indexOf(previousCypressCommand) >= 0;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
|
|
502
|
-
// node_modules/eslint-plugin-cypress/lib/rules/require-data-selectors.js
|
|
503
|
-
var require_require_data_selectors = __commonJS({
|
|
504
|
-
"node_modules/eslint-plugin-cypress/lib/rules/require-data-selectors.js"(exports, module) {
|
|
505
|
-
"use strict";
|
|
506
|
-
init_esm_shims();
|
|
507
|
-
module.exports = {
|
|
508
|
-
meta: {
|
|
509
|
-
type: "suggestion",
|
|
510
|
-
docs: {
|
|
511
|
-
description: "require `data-*` attribute selectors",
|
|
512
|
-
category: "Possible Errors",
|
|
513
|
-
recommended: false,
|
|
514
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/require-data-selectors.md"
|
|
515
|
-
},
|
|
516
|
-
schema: [],
|
|
517
|
-
messages: {
|
|
518
|
-
unexpected: "use data-* attribute selectors instead of classes or tag names"
|
|
519
|
-
}
|
|
520
|
-
},
|
|
521
|
-
create(context) {
|
|
522
|
-
return {
|
|
523
|
-
CallExpression(node2) {
|
|
524
|
-
if (isCallingCyGet(node2) && !isDataArgument(node2)) {
|
|
525
|
-
context.report({ node: node2, messageId: "unexpected" });
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
function isCallingCyGet(node2) {
|
|
532
|
-
return node2.callee.type === "MemberExpression" && node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy" && node2.callee.property.type === "Identifier" && node2.callee.property.name === "get";
|
|
533
|
-
}
|
|
534
|
-
function isDataArgument(node2) {
|
|
535
|
-
return node2.arguments.length > 0 && (node2.arguments[0].type === "Literal" && isAliasOrDataSelector(String(node2.arguments[0].value)) || node2.arguments[0].type === "TemplateLiteral" && isAliasOrDataSelector(String(node2.arguments[0].quasis[0].value.cooked)));
|
|
536
|
-
}
|
|
537
|
-
function isAliasOrDataSelector(selector) {
|
|
538
|
-
return ["[data-", "@"].some(function(validValue) {
|
|
539
|
-
return selector.startsWith(validValue);
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
|
|
545
|
-
// node_modules/eslint-plugin-cypress/lib/rules/no-force.js
|
|
546
|
-
var require_no_force = __commonJS({
|
|
547
|
-
"node_modules/eslint-plugin-cypress/lib/rules/no-force.js"(exports, module) {
|
|
548
|
-
"use strict";
|
|
549
|
-
init_esm_shims();
|
|
550
|
-
module.exports = {
|
|
551
|
-
meta: {
|
|
552
|
-
type: "suggestion",
|
|
553
|
-
docs: {
|
|
554
|
-
description: "disallow using `force: true` with action commands",
|
|
555
|
-
category: "Possible Errors",
|
|
556
|
-
recommended: false,
|
|
557
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-force.md"
|
|
558
|
-
},
|
|
559
|
-
fixable: null,
|
|
560
|
-
// or "code" or "whitespace"
|
|
561
|
-
schema: [],
|
|
562
|
-
messages: {
|
|
563
|
-
unexpected: "Do not use force on click and type calls"
|
|
564
|
-
}
|
|
565
|
-
},
|
|
566
|
-
create(context) {
|
|
567
|
-
function isCallingClickOrType(node2) {
|
|
568
|
-
const allowedMethods = ["click", "dblclick", "type", "trigger", "check", "rightclick", "focus", "select"];
|
|
569
|
-
return node2.property && node2.property.type === "Identifier" && allowedMethods.includes(node2.property.name);
|
|
570
|
-
}
|
|
571
|
-
function isCypressCall(node2) {
|
|
572
|
-
return node2.callee.type === "MemberExpression" && node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy";
|
|
573
|
-
}
|
|
574
|
-
function hasOptionForce(node2) {
|
|
575
|
-
return node2.arguments && node2.arguments.length && node2.arguments.some((arg) => {
|
|
576
|
-
return arg.type === "ObjectExpression" && arg.properties.some((propNode) => propNode.key && propNode.key.name === "force");
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
function deepCheck(node2, checkFunc) {
|
|
580
|
-
let currentNode = node2;
|
|
581
|
-
while (currentNode.parent) {
|
|
582
|
-
if (checkFunc(currentNode.parent)) {
|
|
583
|
-
return true;
|
|
584
|
-
}
|
|
585
|
-
currentNode = currentNode.parent;
|
|
586
|
-
}
|
|
587
|
-
return false;
|
|
588
|
-
}
|
|
589
|
-
return {
|
|
590
|
-
CallExpression(node2) {
|
|
591
|
-
if (isCypressCall(node2) && deepCheck(node2, isCallingClickOrType) && deepCheck(node2, hasOptionForce)) {
|
|
592
|
-
context.report({ node: node2, messageId: "unexpected" });
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
});
|
|
1
|
+
// src/factory.ts
|
|
2
|
+
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
600
3
|
|
|
601
|
-
//
|
|
602
|
-
|
|
603
|
-
"node_modules/eslint-plugin-cypress/lib/rules/no-pause.js"(exports, module) {
|
|
604
|
-
"use strict";
|
|
605
|
-
init_esm_shims();
|
|
606
|
-
module.exports = {
|
|
607
|
-
meta: {
|
|
608
|
-
type: "suggestion",
|
|
609
|
-
docs: {
|
|
610
|
-
description: "disallow using `cy.pause()` calls",
|
|
611
|
-
category: "Possible Errors",
|
|
612
|
-
recommended: false,
|
|
613
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-pause.md"
|
|
614
|
-
},
|
|
615
|
-
fixable: null,
|
|
616
|
-
// or "code" or "whitespace"
|
|
617
|
-
schema: [],
|
|
618
|
-
messages: {
|
|
619
|
-
unexpected: "Do not use cy.pause command"
|
|
620
|
-
}
|
|
621
|
-
},
|
|
622
|
-
create(context) {
|
|
623
|
-
function isCallingPause(node2) {
|
|
624
|
-
return node2.callee && node2.callee.property && node2.callee.property.type === "Identifier" && node2.callee.property.name === "pause";
|
|
625
|
-
}
|
|
626
|
-
function isCypressCall(node2) {
|
|
627
|
-
if (!node2.callee || node2.callee.type !== "MemberExpression") {
|
|
628
|
-
return false;
|
|
629
|
-
}
|
|
630
|
-
if (node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy") {
|
|
631
|
-
return true;
|
|
632
|
-
}
|
|
633
|
-
return isCypressCall(node2.callee.object);
|
|
634
|
-
}
|
|
635
|
-
return {
|
|
636
|
-
CallExpression(node2) {
|
|
637
|
-
if (isCypressCall(node2) && isCallingPause(node2)) {
|
|
638
|
-
context.report({ node: node2, messageId: "unexpected" });
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
});
|
|
4
|
+
// src/configs/comments.ts
|
|
5
|
+
import plugin from "@eslint-community/eslint-plugin-eslint-comments";
|
|
646
6
|
|
|
647
|
-
//
|
|
648
|
-
var
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
docs: {
|
|
656
|
-
description: "disallow using `cy.debug()` calls",
|
|
657
|
-
category: "Possible Errors",
|
|
658
|
-
recommended: false,
|
|
659
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-debug.md"
|
|
660
|
-
},
|
|
661
|
-
fixable: null,
|
|
662
|
-
// or "code" or "whitespace"
|
|
663
|
-
schema: [],
|
|
664
|
-
messages: {
|
|
665
|
-
unexpected: "Do not use cy.debug command"
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
create(context) {
|
|
669
|
-
function isCallingDebug(node2) {
|
|
670
|
-
return node2.callee && node2.callee.property && node2.callee.property.type === "Identifier" && node2.callee.property.name === "debug";
|
|
671
|
-
}
|
|
672
|
-
function isCypressCall(node2) {
|
|
673
|
-
if (!node2.callee || node2.callee.type !== "MemberExpression") {
|
|
674
|
-
return false;
|
|
675
|
-
}
|
|
676
|
-
if (node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy") {
|
|
677
|
-
return true;
|
|
678
|
-
}
|
|
679
|
-
return isCypressCall(node2.callee.object);
|
|
680
|
-
}
|
|
681
|
-
return {
|
|
682
|
-
CallExpression(node2) {
|
|
683
|
-
if (isCypressCall(node2) && isCallingDebug(node2)) {
|
|
684
|
-
context.report({ node: node2, messageId: "unexpected" });
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
}
|
|
7
|
+
// src/base-config.ts
|
|
8
|
+
var CustomConfig = class {
|
|
9
|
+
options;
|
|
10
|
+
constructor({ type = "app", overrides = {}, ...rest }) {
|
|
11
|
+
this.options = {
|
|
12
|
+
type,
|
|
13
|
+
overrides,
|
|
14
|
+
...rest
|
|
689
15
|
};
|
|
690
16
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
"node_modules/eslint-plugin-cypress/lib/rules/no-xpath.js"(exports, module) {
|
|
696
|
-
"use strict";
|
|
697
|
-
init_esm_shims();
|
|
698
|
-
module.exports = {
|
|
699
|
-
meta: {
|
|
700
|
-
type: "suggestion",
|
|
701
|
-
docs: {
|
|
702
|
-
description: "disallow using `cy.xpath()` calls",
|
|
703
|
-
recommended: false,
|
|
704
|
-
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-xpath.md"
|
|
705
|
-
},
|
|
706
|
-
fixable: null,
|
|
707
|
-
// Or `code` or `whitespace`
|
|
708
|
-
schema: [],
|
|
709
|
-
// Add a schema if the rule has options
|
|
710
|
-
messages: {
|
|
711
|
-
unexpected: "Avoid using cy.xpath command"
|
|
712
|
-
}
|
|
713
|
-
},
|
|
714
|
-
create(context) {
|
|
715
|
-
return {
|
|
716
|
-
CallExpression(node2) {
|
|
717
|
-
if (isCallingCyXpath(node2)) {
|
|
718
|
-
context.report({ node: node2, messageId: "unexpected" });
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
};
|
|
722
|
-
}
|
|
17
|
+
createRuleConfig(feature, config) {
|
|
18
|
+
return {
|
|
19
|
+
name: `exbotanical/${this.namespace}/${feature}`,
|
|
20
|
+
...config
|
|
723
21
|
};
|
|
724
|
-
function isCallingCyXpath(node2) {
|
|
725
|
-
return node2.callee.type === "MemberExpression" && node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy" && node2.callee.property.type === "Identifier" && node2.callee.property.name === "xpath";
|
|
726
|
-
}
|
|
727
22
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
// node_modules/eslint-plugin-cypress/lib/flat.js
|
|
731
|
-
var require_flat = __commonJS({
|
|
732
|
-
"node_modules/eslint-plugin-cypress/lib/flat.js"(exports, module) {
|
|
733
|
-
"use strict";
|
|
734
|
-
init_esm_shims();
|
|
735
|
-
var globals2 = __require("globals");
|
|
736
|
-
var { name, version } = require_package();
|
|
737
|
-
var plugin4 = {
|
|
738
|
-
meta: { name, version },
|
|
739
|
-
configs: {},
|
|
740
|
-
rules: {
|
|
741
|
-
"no-assigning-return-values": require_no_assigning_return_values(),
|
|
742
|
-
"unsafe-to-chain-command": require_unsafe_to_chain_command(),
|
|
743
|
-
"no-unnecessary-waiting": require_no_unnecessary_waiting(),
|
|
744
|
-
"no-async-before": require_no_async_before(),
|
|
745
|
-
"no-async-tests": require_no_async_tests(),
|
|
746
|
-
"assertion-before-screenshot": require_assertion_before_screenshot(),
|
|
747
|
-
"require-data-selectors": require_require_data_selectors(),
|
|
748
|
-
"no-force": require_no_force(),
|
|
749
|
-
"no-pause": require_no_pause(),
|
|
750
|
-
"no-debug": require_no_debug(),
|
|
751
|
-
"no-xpath": require_no_xpath()
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
var commonGlobals = Object.assign({
|
|
755
|
-
cy: false,
|
|
756
|
-
Cypress: false,
|
|
757
|
-
expect: false,
|
|
758
|
-
assert: false,
|
|
759
|
-
chai: false
|
|
760
|
-
}, globals2.browser, globals2.mocha);
|
|
761
|
-
Object.assign(plugin4.configs, {
|
|
762
|
-
globals: {
|
|
763
|
-
name: "cypress/globals",
|
|
764
|
-
plugins: {
|
|
765
|
-
cypress: plugin4
|
|
766
|
-
},
|
|
767
|
-
languageOptions: {
|
|
768
|
-
globals: commonGlobals
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
});
|
|
772
|
-
Object.assign(plugin4.configs, {
|
|
773
|
-
recommended: {
|
|
774
|
-
name: "cypress/recommended",
|
|
775
|
-
plugins: {
|
|
776
|
-
cypress: plugin4
|
|
777
|
-
},
|
|
778
|
-
rules: {
|
|
779
|
-
"cypress/no-assigning-return-values": "error",
|
|
780
|
-
"cypress/no-unnecessary-waiting": "error",
|
|
781
|
-
"cypress/no-async-tests": "error",
|
|
782
|
-
"cypress/unsafe-to-chain-command": "error"
|
|
783
|
-
},
|
|
784
|
-
languageOptions: {
|
|
785
|
-
globals: commonGlobals
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
});
|
|
789
|
-
module.exports = plugin4;
|
|
23
|
+
async rules() {
|
|
24
|
+
return [...await this._rules()];
|
|
790
25
|
}
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
// src/index.ts
|
|
794
|
-
init_esm_shims();
|
|
795
|
-
|
|
796
|
-
// src/factory.ts
|
|
797
|
-
init_esm_shims();
|
|
798
|
-
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
799
|
-
|
|
800
|
-
// src/configs/index.ts
|
|
801
|
-
init_esm_shims();
|
|
802
|
-
|
|
803
|
-
// src/configs/comments.ts
|
|
804
|
-
init_esm_shims();
|
|
805
|
-
import plugin from "@eslint-community/eslint-plugin-eslint-comments";
|
|
806
|
-
var NAMESPACE = "exbotanical/comments";
|
|
807
|
-
async function comments() {
|
|
808
|
-
return [
|
|
809
|
-
{
|
|
810
|
-
name: `${NAMESPACE}/rules`,
|
|
811
|
-
plugins: {
|
|
812
|
-
comments: plugin
|
|
813
|
-
},
|
|
814
|
-
rules: {
|
|
815
|
-
"comments/no-aggregating-enable": ["error"],
|
|
816
|
-
"comments/no-duplicate-disable": ["error"],
|
|
817
|
-
"comments/no-unlimited-disable": ["error"],
|
|
818
|
-
"comments/no-unused-enable": ["error"],
|
|
819
|
-
"comments/no-unused-disable": ["error"],
|
|
820
|
-
"comments/require-description": ["warn"]
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
];
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
// src/configs/disables.ts
|
|
827
|
-
init_esm_shims();
|
|
26
|
+
};
|
|
828
27
|
|
|
829
28
|
// src/filepaths.ts
|
|
830
|
-
init_esm_shims();
|
|
831
29
|
var GLOB_JS = "**/*.?([cm])js";
|
|
832
30
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
833
31
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
@@ -845,12 +43,14 @@ var GLOB_XML = "**/*.xml";
|
|
|
845
43
|
var GLOB_SVG = "**/*.svg";
|
|
846
44
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
847
45
|
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
46
|
+
var GLOB_GITHUB_WORKFLOW = "**/.github/workflows/*.y?(a)ml";
|
|
848
47
|
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
849
48
|
var GLOB_CSS = "**/*.css";
|
|
850
49
|
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
851
50
|
var GLOB_LESS = "**/*.less";
|
|
852
51
|
var GLOB_SCSS = "**/*.scss";
|
|
853
52
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
53
|
+
var GLOB_SCRIPTS = [GLOB_SRC, GLOB_VUE, GLOB_MARKDOWN_CODE];
|
|
854
54
|
var GLOB_TESTS = [
|
|
855
55
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
856
56
|
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
@@ -886,77 +86,38 @@ var GLOB_EXCLUDES = [
|
|
|
886
86
|
"**/__snapshots__"
|
|
887
87
|
];
|
|
888
88
|
|
|
889
|
-
// src/configs/
|
|
890
|
-
var
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
files: ["**/*.js", "**/*.cjs"],
|
|
918
|
-
rules: {
|
|
919
|
-
"ts/no-require-imports": "off"
|
|
920
|
-
}
|
|
921
|
-
},
|
|
922
|
-
{
|
|
923
|
-
name: `${NAMESPACE2}/config-files`,
|
|
924
|
-
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
925
|
-
rules: {
|
|
926
|
-
"no-console": "off",
|
|
927
|
-
"ts/explicit-function-return-type": "off"
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
];
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
// src/configs/graphql.ts
|
|
934
|
-
init_esm_shims();
|
|
89
|
+
// src/configs/comments.ts
|
|
90
|
+
var COMMENTS_RULES = {
|
|
91
|
+
"comments/no-aggregating-enable": ["error"],
|
|
92
|
+
"comments/no-duplicate-disable": ["error"],
|
|
93
|
+
"comments/no-unlimited-disable": ["error"],
|
|
94
|
+
"comments/no-unused-enable": ["error"],
|
|
95
|
+
"comments/no-unused-disable": ["error"],
|
|
96
|
+
"comments/require-description": ["warn"]
|
|
97
|
+
};
|
|
98
|
+
var CommentsConfig = class extends CustomConfig {
|
|
99
|
+
namespace = "comments";
|
|
100
|
+
constructor(options = {}) {
|
|
101
|
+
super(options);
|
|
102
|
+
}
|
|
103
|
+
async _rules() {
|
|
104
|
+
return [
|
|
105
|
+
this.createRuleConfig("rules", {
|
|
106
|
+
files: GLOB_SCRIPTS,
|
|
107
|
+
plugins: {
|
|
108
|
+
comments: plugin
|
|
109
|
+
},
|
|
110
|
+
rules: {
|
|
111
|
+
...COMMENTS_RULES
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
};
|
|
935
117
|
|
|
936
118
|
// src/utils.ts
|
|
937
|
-
|
|
938
|
-
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
119
|
+
import { fileURLToPath } from "node:url";
|
|
939
120
|
import { isPackageExists } from "local-pkg";
|
|
940
|
-
var parserPlain = {
|
|
941
|
-
meta: {
|
|
942
|
-
name: "parser-plain"
|
|
943
|
-
},
|
|
944
|
-
parseForESLint: (code) => ({
|
|
945
|
-
ast: {
|
|
946
|
-
body: [],
|
|
947
|
-
comments: [],
|
|
948
|
-
loc: { end: code.length, start: 0 },
|
|
949
|
-
range: [0, code.length],
|
|
950
|
-
tokens: [],
|
|
951
|
-
type: "Program"
|
|
952
|
-
},
|
|
953
|
-
scopeManager: null,
|
|
954
|
-
services: { isPlain: true },
|
|
955
|
-
visitorKeys: {
|
|
956
|
-
Program: []
|
|
957
|
-
}
|
|
958
|
-
})
|
|
959
|
-
};
|
|
960
121
|
async function interopDefault(module) {
|
|
961
122
|
const resolved = await module;
|
|
962
123
|
return resolved.default || resolved;
|
|
@@ -965,8 +126,7 @@ function renameRules(rules, map) {
|
|
|
965
126
|
return Object.fromEntries(
|
|
966
127
|
Object.entries(rules).map(([key, value]) => {
|
|
967
128
|
for (const [from, to] of Object.entries(map)) {
|
|
968
|
-
if (key.startsWith(`${from}/`))
|
|
969
|
-
return [to + key.slice(from.length), value];
|
|
129
|
+
if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
|
|
970
130
|
}
|
|
971
131
|
return [key, value];
|
|
972
132
|
})
|
|
@@ -1011,429 +171,606 @@ var processorPassThrough = {
|
|
|
1011
171
|
return messages[0];
|
|
1012
172
|
}
|
|
1013
173
|
};
|
|
1014
|
-
var scopeUrl =
|
|
174
|
+
var scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
1015
175
|
|
|
1016
|
-
// src/configs/
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
176
|
+
// src/configs/css.ts
|
|
177
|
+
var CssConfig = class extends CustomConfig {
|
|
178
|
+
namespace = "css";
|
|
179
|
+
constructor({ files = [GLOB_CSS], ...rest } = {}) {
|
|
180
|
+
super({
|
|
181
|
+
files,
|
|
182
|
+
...rest
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
async _rules() {
|
|
186
|
+
const { files, overrides = {} } = this.options;
|
|
187
|
+
const plugin4 = await interopDefault(import("@eslint/css"));
|
|
188
|
+
return [
|
|
189
|
+
this.createRuleConfig("rules", {
|
|
190
|
+
files,
|
|
191
|
+
language: "css/css",
|
|
192
|
+
plugins: {
|
|
193
|
+
css: plugin4
|
|
194
|
+
},
|
|
195
|
+
rules: {
|
|
196
|
+
...plugin4.configs.recommended.rules,
|
|
197
|
+
...overrides
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
};
|
|
1041
203
|
|
|
1042
|
-
// src/configs/
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
204
|
+
// src/configs/data-files.ts
|
|
205
|
+
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
206
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
207
|
+
var DataFilesConfig = class extends CustomConfig {
|
|
208
|
+
namespace = "data-files";
|
|
209
|
+
constructor(options = {}) {
|
|
210
|
+
super(options);
|
|
211
|
+
}
|
|
212
|
+
async _rules() {
|
|
213
|
+
const { files = [] } = this.options;
|
|
214
|
+
if (files.length === 0) return [];
|
|
215
|
+
return [
|
|
216
|
+
this.createRuleConfig("rules", {
|
|
217
|
+
files,
|
|
218
|
+
linterOptions: {
|
|
219
|
+
reportUnusedDisableDirectives: "error",
|
|
220
|
+
reportUnusedInlineConfigs: "error"
|
|
221
|
+
},
|
|
222
|
+
plugins: {
|
|
223
|
+
comments: pluginComments,
|
|
224
|
+
unicorn: pluginUnicorn
|
|
225
|
+
},
|
|
226
|
+
rules: {
|
|
227
|
+
...COMMENTS_RULES,
|
|
228
|
+
"unicode-bom": ["error", "never"],
|
|
229
|
+
"unicorn/no-abusive-eslint-disable": "error"
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
];
|
|
233
|
+
}
|
|
234
|
+
};
|
|
1053
235
|
|
|
1054
|
-
// src/configs/
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
236
|
+
// src/configs/disables.ts
|
|
237
|
+
var DisablesConfig = class extends CustomConfig {
|
|
238
|
+
namespace = "disables";
|
|
239
|
+
constructor(options = {}) {
|
|
240
|
+
super(options);
|
|
241
|
+
}
|
|
242
|
+
async _rules() {
|
|
243
|
+
return [
|
|
244
|
+
this.createRuleConfig("scripts", {
|
|
245
|
+
files: [`**/scripts/${GLOB_SRC}`, "**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
246
|
+
rules: {
|
|
247
|
+
"no-console": "off",
|
|
248
|
+
"ts/explicit-function-return-type": "off"
|
|
249
|
+
}
|
|
250
|
+
}),
|
|
251
|
+
this.createRuleConfig("dts", {
|
|
252
|
+
files: ["**/*.d.?([cm])ts"],
|
|
253
|
+
rules: {
|
|
254
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
255
|
+
"import/no-duplicates": "off",
|
|
256
|
+
"no-restricted-syntax": "off",
|
|
257
|
+
"unused-imports/no-unused-vars": "off"
|
|
258
|
+
}
|
|
259
|
+
}),
|
|
260
|
+
this.createRuleConfig("cjs", {
|
|
261
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
262
|
+
rules: {
|
|
263
|
+
"ts/no-require-imports": "off"
|
|
264
|
+
}
|
|
265
|
+
}),
|
|
266
|
+
this.createRuleConfig("config-files", {
|
|
267
|
+
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
268
|
+
rules: {
|
|
269
|
+
"no-console": "off",
|
|
270
|
+
"ts/explicit-function-return-type": "off"
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
];
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// src/configs/github-action.ts
|
|
278
|
+
var GithubActionConfig = class extends CustomConfig {
|
|
279
|
+
namespace = "github-action";
|
|
280
|
+
constructor({ files = [GLOB_GITHUB_WORKFLOW], ...rest } = {}) {
|
|
281
|
+
super({
|
|
282
|
+
files,
|
|
283
|
+
...rest
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
async _rules() {
|
|
287
|
+
const { files, overrides = {} } = this.options;
|
|
288
|
+
const plugin4 = await interopDefault(import("eslint-plugin-github-action"));
|
|
289
|
+
const [recommended] = plugin4.configs.recommended;
|
|
290
|
+
return [
|
|
291
|
+
this.createRuleConfig("rules", {
|
|
292
|
+
...recommended,
|
|
293
|
+
files,
|
|
294
|
+
rules: {
|
|
295
|
+
...recommended.rules,
|
|
296
|
+
...overrides
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
];
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// src/configs/graphql.ts
|
|
304
|
+
var GraphqlConfig = class extends CustomConfig {
|
|
305
|
+
namespace = "graphql";
|
|
306
|
+
constructor(options = {}) {
|
|
307
|
+
super(options);
|
|
308
|
+
}
|
|
309
|
+
async _rules() {
|
|
310
|
+
const graphqlPlugin = await interopDefault(import("@graphql-eslint/eslint-plugin"));
|
|
311
|
+
const rules = {
|
|
312
|
+
...graphqlPlugin.configs["flat/operations-recommended"].rules,
|
|
313
|
+
...graphqlPlugin.configs["flat/schema-recommended"].rules
|
|
314
|
+
};
|
|
315
|
+
return [
|
|
316
|
+
this.createRuleConfig("setup", {
|
|
317
|
+
files: [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
|
|
318
|
+
processor: graphqlPlugin.processor
|
|
319
|
+
}),
|
|
320
|
+
this.createRuleConfig("rules", {
|
|
321
|
+
files: [GLOB_GRAPHQL],
|
|
322
|
+
languageOptions: {
|
|
323
|
+
parser: graphqlPlugin.parser
|
|
324
|
+
},
|
|
325
|
+
plugins: {
|
|
326
|
+
"@graphql-eslint": graphqlPlugin
|
|
327
|
+
},
|
|
328
|
+
// @ts-expect-error weird rule types in gql plugin
|
|
329
|
+
rules
|
|
330
|
+
})
|
|
331
|
+
];
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// src/configs/ignores.ts
|
|
336
|
+
var IgnoresConfig = class extends CustomConfig {
|
|
337
|
+
namespace = "ignores";
|
|
338
|
+
constructor(options = {}) {
|
|
339
|
+
super(options);
|
|
340
|
+
}
|
|
341
|
+
async _rules() {
|
|
342
|
+
return [
|
|
343
|
+
this.createRuleConfig("setup", {
|
|
344
|
+
ignores: [...GLOB_EXCLUDES, ...this.options.files ?? []]
|
|
345
|
+
})
|
|
346
|
+
];
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// src/configs/imports.ts
|
|
351
|
+
import plugin2 from "eslint-plugin-import";
|
|
352
|
+
var ImportsConfig = class extends CustomConfig {
|
|
353
|
+
namespace = "imports";
|
|
354
|
+
constructor(options = {}) {
|
|
355
|
+
super(options);
|
|
356
|
+
}
|
|
357
|
+
async _rules() {
|
|
358
|
+
return [
|
|
359
|
+
this.createRuleConfig("rules", {
|
|
360
|
+
files: GLOB_SCRIPTS,
|
|
361
|
+
plugins: {
|
|
362
|
+
import: plugin2
|
|
363
|
+
},
|
|
364
|
+
rules: {
|
|
365
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
366
|
+
"import/first": "error",
|
|
367
|
+
"import/no-duplicates": "error",
|
|
368
|
+
"import/no-mutable-exports": "error",
|
|
369
|
+
"import/no-named-default": "error",
|
|
370
|
+
"import/no-self-import": "error",
|
|
371
|
+
"import/no-webpack-loader-syntax": "error",
|
|
372
|
+
"import/no-absolute-path": "error",
|
|
373
|
+
"import/no-empty-named-blocks": "error",
|
|
374
|
+
"import/no-useless-path-segments": "error",
|
|
375
|
+
"import/newline-after-import": ["error", { count: 1 }],
|
|
376
|
+
"import/no-unresolved": "off",
|
|
377
|
+
"import/order": [
|
|
378
|
+
"error",
|
|
379
|
+
{
|
|
380
|
+
"alphabetize": {
|
|
381
|
+
caseInsensitive: true,
|
|
382
|
+
order: "asc"
|
|
1108
383
|
},
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
384
|
+
"groups": [
|
|
385
|
+
"builtin",
|
|
386
|
+
"external",
|
|
387
|
+
"internal",
|
|
388
|
+
"parent",
|
|
389
|
+
"sibling",
|
|
390
|
+
"index",
|
|
391
|
+
"object",
|
|
392
|
+
"type"
|
|
393
|
+
],
|
|
394
|
+
"newlines-between": "always",
|
|
395
|
+
"pathGroups": [
|
|
396
|
+
{
|
|
397
|
+
group: "external",
|
|
398
|
+
pattern: "{vue,@vue/**}",
|
|
399
|
+
position: "before"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
group: "external",
|
|
403
|
+
pattern: "{react,@react/**}",
|
|
404
|
+
position: "before"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
group: "internal",
|
|
408
|
+
pattern: "@/**",
|
|
409
|
+
position: "before"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
group: "internal",
|
|
413
|
+
pattern: "@@/**",
|
|
414
|
+
position: "before"
|
|
415
|
+
}
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
})
|
|
421
|
+
];
|
|
422
|
+
}
|
|
423
|
+
};
|
|
1121
424
|
|
|
1122
425
|
// src/configs/javascript.ts
|
|
1123
|
-
init_esm_shims();
|
|
1124
426
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
1125
427
|
import globals from "globals";
|
|
1126
428
|
|
|
1127
429
|
// src/common.ts
|
|
1128
|
-
init_esm_shims();
|
|
1129
430
|
var VAR_IGNORE_PATTERN = "^_";
|
|
1130
431
|
|
|
1131
432
|
// src/configs/javascript.ts
|
|
1132
|
-
var
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
document: "readonly",
|
|
1144
|
-
navigator: "readonly",
|
|
1145
|
-
window: "readonly"
|
|
1146
|
-
},
|
|
1147
|
-
parserOptions: {
|
|
1148
|
-
ecmaFeatures: { jsx: true, impliedStrict: true },
|
|
433
|
+
var JavascriptConfig = class extends CustomConfig {
|
|
434
|
+
namespace = "javascript";
|
|
435
|
+
constructor(options = {}) {
|
|
436
|
+
super(options);
|
|
437
|
+
}
|
|
438
|
+
async _rules() {
|
|
439
|
+
const { files = GLOB_SCRIPTS } = this.options;
|
|
440
|
+
return [
|
|
441
|
+
this.createRuleConfig("setup", {
|
|
442
|
+
files,
|
|
443
|
+
languageOptions: {
|
|
1149
444
|
ecmaVersion: "latest",
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
}
|
|
1158
|
-
},
|
|
1159
|
-
{
|
|
1160
|
-
name: `${NAMESPACE5}/rules`,
|
|
1161
|
-
plugins: {
|
|
1162
|
-
"unused-imports": pluginUnusedImports
|
|
1163
|
-
},
|
|
1164
|
-
rules: {
|
|
1165
|
-
"array-callback-return": ["error"],
|
|
1166
|
-
"constructor-super": ["error"],
|
|
1167
|
-
"for-direction": ["error"],
|
|
1168
|
-
"getter-return": ["error"],
|
|
1169
|
-
"no-async-promise-executor": ["error"],
|
|
1170
|
-
"no-class-assign": ["error"],
|
|
1171
|
-
"no-compare-neg-zero": ["error"],
|
|
1172
|
-
"no-cond-assign": ["error", "except-parens"],
|
|
1173
|
-
"no-const-assign": ["error"],
|
|
1174
|
-
"no-constant-binary-expression": ["error"],
|
|
1175
|
-
"no-constant-condition": ["error"],
|
|
1176
|
-
"no-constructor-return": ["error"],
|
|
1177
|
-
"no-control-regex": ["error"],
|
|
1178
|
-
"no-debugger": ["error"],
|
|
1179
|
-
"no-dupe-args": ["error"],
|
|
1180
|
-
"no-dupe-class-members": ["error"],
|
|
1181
|
-
"no-dupe-else-if": ["error"],
|
|
1182
|
-
"no-dupe-keys": ["error"],
|
|
1183
|
-
"no-duplicate-case": ["error"],
|
|
1184
|
-
// See `import` ruleset
|
|
1185
|
-
"no-duplicate-imports": ["off"],
|
|
1186
|
-
"no-empty-character-class": ["error"],
|
|
1187
|
-
"no-empty-pattern": ["error"],
|
|
1188
|
-
"no-unsafe-finally": ["error"],
|
|
1189
|
-
"no-unreachable-loop": ["error"],
|
|
1190
|
-
"no-unreachable": ["error"],
|
|
1191
|
-
"no-unmodified-loop-condition": ["error"],
|
|
1192
|
-
"no-unexpected-multiline": ["error"],
|
|
1193
|
-
"no-undef": ["error"],
|
|
1194
|
-
"no-this-before-super": ["error"],
|
|
1195
|
-
"no-template-curly-in-string": ["error"],
|
|
1196
|
-
"no-sparse-arrays": ["error"],
|
|
1197
|
-
"no-setter-return": ["error"],
|
|
1198
|
-
"no-self-compare": ["error"],
|
|
1199
|
-
"no-self-assign": ["error", { props: true }],
|
|
1200
|
-
"no-prototype-builtins": ["error"],
|
|
1201
|
-
"no-promise-executor-return": ["error"],
|
|
1202
|
-
"no-obj-calls": ["error"],
|
|
1203
|
-
"no-new-native-nonconstructor": ["error"],
|
|
1204
|
-
"no-misleading-character-class": ["error"],
|
|
1205
|
-
"no-loss-of-precision": ["error"],
|
|
1206
|
-
"no-irregular-whitespace": ["error"],
|
|
1207
|
-
"no-invalid-regexp": ["error"],
|
|
1208
|
-
"no-import-assign": ["error"],
|
|
1209
|
-
"no-func-assign": ["error"],
|
|
1210
|
-
"no-fallthrough": ["warn"],
|
|
1211
|
-
"no-ex-assign": ["error"],
|
|
1212
|
-
"no-unsafe-negation": ["error"],
|
|
1213
|
-
"no-unsafe-optional-chaining": ["error"],
|
|
1214
|
-
"no-unused-private-class-members": ["error"],
|
|
1215
|
-
"no-unused-vars": [
|
|
1216
|
-
"error",
|
|
1217
|
-
{
|
|
1218
|
-
vars: "all",
|
|
1219
|
-
args: "all",
|
|
1220
|
-
argsIgnorePattern: VAR_IGNORE_PATTERN,
|
|
1221
|
-
caughtErrorsIgnorePattern: VAR_IGNORE_PATTERN,
|
|
1222
|
-
destructuredArrayIgnorePattern: VAR_IGNORE_PATTERN,
|
|
1223
|
-
reportUsedIgnorePattern: true
|
|
1224
|
-
}
|
|
1225
|
-
],
|
|
1226
|
-
"no-use-before-define": [
|
|
1227
|
-
"error",
|
|
1228
|
-
{ classes: false, functions: false, variables: true }
|
|
1229
|
-
],
|
|
1230
|
-
"no-useless-assignment": ["error"],
|
|
1231
|
-
"no-useless-backreference": ["error"],
|
|
1232
|
-
"require-atomic-updates": ["error"],
|
|
1233
|
-
"use-isnan": [
|
|
1234
|
-
"error",
|
|
1235
|
-
{ enforceForIndexOf: true, enforceForSwitchCase: true }
|
|
1236
|
-
],
|
|
1237
|
-
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
1238
|
-
"class-methods-use-this": ["warn"],
|
|
1239
|
-
"consistent-return": ["error"],
|
|
1240
|
-
"curly": ["error", "multi-line"],
|
|
1241
|
-
"default-case": [
|
|
1242
|
-
"error",
|
|
1243
|
-
{
|
|
1244
|
-
commentPattern: String.raw`^skip\sdefault`
|
|
1245
|
-
}
|
|
1246
|
-
],
|
|
1247
|
-
"default-case-last": ["error"],
|
|
1248
|
-
"dot-notation": ["error", { allowKeywords: true }],
|
|
1249
|
-
"eqeqeq": ["error", "smart"],
|
|
1250
|
-
"func-names": ["error", "as-needed"],
|
|
1251
|
-
"accessor-pairs": [
|
|
1252
|
-
"error",
|
|
1253
|
-
{ enforceForClassMembers: true, setWithoutGet: true }
|
|
1254
|
-
],
|
|
1255
|
-
"arrow-body-style": ["error", "as-needed"],
|
|
1256
|
-
"block-scoped-var": ["error"],
|
|
1257
|
-
"camelcase": [
|
|
1258
|
-
"error",
|
|
1259
|
-
{
|
|
1260
|
-
ignoreImports: true
|
|
1261
|
-
}
|
|
1262
|
-
],
|
|
1263
|
-
"capitalized-comments": [
|
|
1264
|
-
"error",
|
|
1265
|
-
"always",
|
|
1266
|
-
{
|
|
1267
|
-
ignoreInlineComments: true,
|
|
1268
|
-
ignoreConsecutiveComments: true
|
|
1269
|
-
}
|
|
1270
|
-
],
|
|
1271
|
-
"grouped-accessor-pairs": ["error", "getBeforeSet"],
|
|
1272
|
-
"max-params": ["warn", { max: 5 }],
|
|
1273
|
-
"new-cap": [
|
|
1274
|
-
"error",
|
|
1275
|
-
{ capIsNew: false, newIsCap: true, properties: true }
|
|
1276
|
-
],
|
|
1277
|
-
"no-alert": ["error"],
|
|
1278
|
-
"no-array-constructor": ["error"],
|
|
1279
|
-
"no-caller": ["error"],
|
|
1280
|
-
"no-case-declarations": ["warn"],
|
|
1281
|
-
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
1282
|
-
"no-delete-var": ["error"],
|
|
1283
|
-
"no-else-return": ["error"],
|
|
1284
|
-
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
1285
|
-
"no-eval": ["error"],
|
|
1286
|
-
"no-extra-bind": ["error"],
|
|
1287
|
-
"no-extend-native": ["error"],
|
|
1288
|
-
"no-extra-boolean-cast": ["error"],
|
|
1289
|
-
"no-global-assign": ["error"],
|
|
1290
|
-
"no-implied-eval": ["error"],
|
|
1291
|
-
"no-invalid-this": ["error"],
|
|
1292
|
-
"no-iterator": ["error"],
|
|
1293
|
-
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
1294
|
-
"no-lone-blocks": ["error"],
|
|
1295
|
-
"no-multi-str": ["error"],
|
|
1296
|
-
"no-new": ["error"],
|
|
1297
|
-
"no-new-func": ["error"],
|
|
1298
|
-
"no-new-wrappers": ["error"],
|
|
1299
|
-
"no-octal": ["error"],
|
|
1300
|
-
"no-octal-escape": ["error"],
|
|
1301
|
-
"no-param-reassign": ["error"],
|
|
1302
|
-
"no-proto": ["error"],
|
|
1303
|
-
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
1304
|
-
"no-regex-spaces": ["error"],
|
|
1305
|
-
"no-restricted-globals": [
|
|
1306
|
-
"error",
|
|
1307
|
-
{ message: "Use `globalThis` instead.", name: "global" },
|
|
1308
|
-
{ message: "Use `globalThis` instead.", name: "self" }
|
|
1309
|
-
],
|
|
1310
|
-
"no-restricted-properties": [
|
|
1311
|
-
"error",
|
|
1312
|
-
{
|
|
1313
|
-
message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
|
|
1314
|
-
property: "__proto__"
|
|
1315
|
-
},
|
|
1316
|
-
{
|
|
1317
|
-
message: "Use `Object.defineProperty` instead.",
|
|
1318
|
-
property: "__defineGetter__"
|
|
1319
|
-
},
|
|
1320
|
-
{
|
|
1321
|
-
message: "Use `Object.defineProperty` instead.",
|
|
1322
|
-
property: "__defineSetter__"
|
|
445
|
+
globals: {
|
|
446
|
+
...globals.browser,
|
|
447
|
+
...globals.node,
|
|
448
|
+
...globals.es2021,
|
|
449
|
+
document: "readonly",
|
|
450
|
+
navigator: "readonly",
|
|
451
|
+
window: "readonly"
|
|
1323
452
|
},
|
|
1324
|
-
{
|
|
1325
|
-
|
|
1326
|
-
|
|
453
|
+
parserOptions: {
|
|
454
|
+
ecmaFeatures: { jsx: true, impliedStrict: true },
|
|
455
|
+
ecmaVersion: "latest",
|
|
456
|
+
sourceType: "module"
|
|
1327
457
|
},
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
"error",
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
"
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
"error",
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
"error",
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
458
|
+
sourceType: "module"
|
|
459
|
+
},
|
|
460
|
+
linterOptions: {
|
|
461
|
+
reportUnusedDisableDirectives: "error",
|
|
462
|
+
reportUnusedInlineConfigs: "error"
|
|
463
|
+
}
|
|
464
|
+
}),
|
|
465
|
+
this.createRuleConfig("rules", {
|
|
466
|
+
files,
|
|
467
|
+
plugins: {
|
|
468
|
+
"unused-imports": pluginUnusedImports
|
|
469
|
+
},
|
|
470
|
+
rules: {
|
|
471
|
+
"array-callback-return": ["error"],
|
|
472
|
+
"constructor-super": ["error"],
|
|
473
|
+
"for-direction": ["error"],
|
|
474
|
+
"getter-return": ["error"],
|
|
475
|
+
"no-async-promise-executor": ["error"],
|
|
476
|
+
"no-class-assign": ["error"],
|
|
477
|
+
"no-compare-neg-zero": ["error"],
|
|
478
|
+
"no-cond-assign": ["error", "except-parens"],
|
|
479
|
+
"no-const-assign": ["error"],
|
|
480
|
+
"no-constant-binary-expression": ["error"],
|
|
481
|
+
"no-constant-condition": ["error"],
|
|
482
|
+
"no-constructor-return": ["error"],
|
|
483
|
+
"no-control-regex": ["error"],
|
|
484
|
+
"no-debugger": ["error"],
|
|
485
|
+
"no-dupe-args": ["error"],
|
|
486
|
+
"no-dupe-class-members": ["error"],
|
|
487
|
+
"no-dupe-else-if": ["error"],
|
|
488
|
+
"no-dupe-keys": ["error"],
|
|
489
|
+
"no-duplicate-case": ["error"],
|
|
490
|
+
// See `import` ruleset
|
|
491
|
+
"no-duplicate-imports": ["off"],
|
|
492
|
+
"no-empty-character-class": ["error"],
|
|
493
|
+
"no-empty-pattern": ["error"],
|
|
494
|
+
"no-unsafe-finally": ["error"],
|
|
495
|
+
"no-unreachable-loop": ["error"],
|
|
496
|
+
"no-unreachable": ["error"],
|
|
497
|
+
"no-unmodified-loop-condition": ["error"],
|
|
498
|
+
"no-unexpected-multiline": ["error"],
|
|
499
|
+
"no-undef": ["error"],
|
|
500
|
+
"no-this-before-super": ["error"],
|
|
501
|
+
"no-template-curly-in-string": ["error"],
|
|
502
|
+
"no-sparse-arrays": ["error"],
|
|
503
|
+
"no-setter-return": ["error"],
|
|
504
|
+
"no-self-compare": ["error"],
|
|
505
|
+
"no-self-assign": ["error", { props: true }],
|
|
506
|
+
"no-prototype-builtins": ["error"],
|
|
507
|
+
"no-promise-executor-return": ["error"],
|
|
508
|
+
"no-obj-calls": ["error"],
|
|
509
|
+
"no-new-native-nonconstructor": ["error"],
|
|
510
|
+
"no-misleading-character-class": ["error"],
|
|
511
|
+
"no-loss-of-precision": ["error"],
|
|
512
|
+
"no-irregular-whitespace": ["error"],
|
|
513
|
+
"no-invalid-regexp": ["error"],
|
|
514
|
+
"no-import-assign": ["error"],
|
|
515
|
+
"no-func-assign": ["error"],
|
|
516
|
+
"no-fallthrough": ["warn"],
|
|
517
|
+
"no-ex-assign": ["error"],
|
|
518
|
+
"no-unsafe-negation": ["error"],
|
|
519
|
+
"no-unsafe-optional-chaining": ["error"],
|
|
520
|
+
"no-unused-private-class-members": ["error"],
|
|
521
|
+
"no-unused-vars": "off",
|
|
522
|
+
"unused-imports/no-unused-imports": "error",
|
|
523
|
+
"unused-imports/no-unused-vars": [
|
|
524
|
+
"error",
|
|
525
|
+
{
|
|
526
|
+
vars: "all",
|
|
527
|
+
args: "all",
|
|
528
|
+
argsIgnorePattern: VAR_IGNORE_PATTERN,
|
|
529
|
+
caughtErrorsIgnorePattern: VAR_IGNORE_PATTERN,
|
|
530
|
+
destructuredArrayIgnorePattern: VAR_IGNORE_PATTERN,
|
|
531
|
+
reportUsedIgnorePattern: true
|
|
532
|
+
}
|
|
533
|
+
],
|
|
534
|
+
"no-use-before-define": [
|
|
535
|
+
"error",
|
|
536
|
+
{ classes: false, functions: false, variables: true }
|
|
537
|
+
],
|
|
538
|
+
"no-useless-assignment": ["error"],
|
|
539
|
+
"no-useless-backreference": ["error"],
|
|
540
|
+
"require-atomic-updates": ["error"],
|
|
541
|
+
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
542
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
543
|
+
"class-methods-use-this": ["warn"],
|
|
544
|
+
"consistent-return": ["error"],
|
|
545
|
+
"curly": ["error", "multi-line"],
|
|
546
|
+
"default-case": [
|
|
547
|
+
"error",
|
|
548
|
+
{
|
|
549
|
+
commentPattern: String.raw`^skip\sdefault`
|
|
550
|
+
}
|
|
551
|
+
],
|
|
552
|
+
"default-case-last": ["error"],
|
|
553
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
554
|
+
"eqeqeq": ["error", "smart"],
|
|
555
|
+
"func-names": ["error", "as-needed"],
|
|
556
|
+
"accessor-pairs": [
|
|
557
|
+
"error",
|
|
558
|
+
{ enforceForClassMembers: true, setWithoutGet: true }
|
|
559
|
+
],
|
|
560
|
+
"arrow-body-style": ["error", "as-needed"],
|
|
561
|
+
"block-scoped-var": ["error"],
|
|
562
|
+
"camelcase": [
|
|
563
|
+
"error",
|
|
564
|
+
{
|
|
565
|
+
ignoreImports: true
|
|
566
|
+
}
|
|
567
|
+
],
|
|
568
|
+
"capitalized-comments": [
|
|
569
|
+
"error",
|
|
570
|
+
"always",
|
|
571
|
+
{
|
|
572
|
+
ignoreInlineComments: true,
|
|
573
|
+
ignoreConsecutiveComments: true
|
|
574
|
+
}
|
|
575
|
+
],
|
|
576
|
+
"grouped-accessor-pairs": ["error", "getBeforeSet"],
|
|
577
|
+
"max-params": ["warn", { max: 5 }],
|
|
578
|
+
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
579
|
+
"no-alert": ["error"],
|
|
580
|
+
"no-array-constructor": ["error"],
|
|
581
|
+
"no-caller": ["error"],
|
|
582
|
+
"no-case-declarations": ["warn"],
|
|
583
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
584
|
+
"no-delete-var": ["error"],
|
|
585
|
+
"no-else-return": ["error"],
|
|
586
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
587
|
+
"no-eval": ["error"],
|
|
588
|
+
"no-extra-bind": ["error"],
|
|
589
|
+
"no-extend-native": ["error"],
|
|
590
|
+
"no-extra-boolean-cast": ["error"],
|
|
591
|
+
"no-global-assign": ["error"],
|
|
592
|
+
"no-implied-eval": ["error"],
|
|
593
|
+
"no-invalid-this": ["error"],
|
|
594
|
+
"no-iterator": ["error"],
|
|
595
|
+
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
596
|
+
"no-lone-blocks": ["error"],
|
|
597
|
+
"no-multi-str": ["error"],
|
|
598
|
+
"no-new": ["error"],
|
|
599
|
+
"no-new-func": ["error"],
|
|
600
|
+
"no-new-wrappers": ["error"],
|
|
601
|
+
"no-octal": ["error"],
|
|
602
|
+
"no-octal-escape": ["error"],
|
|
603
|
+
"no-param-reassign": ["error"],
|
|
604
|
+
"no-proto": ["error"],
|
|
605
|
+
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
606
|
+
"no-regex-spaces": ["error"],
|
|
607
|
+
"no-restricted-globals": [
|
|
608
|
+
"error",
|
|
609
|
+
{ message: "Use `globalThis` instead.", name: "global" },
|
|
610
|
+
{ message: "Use `globalThis` instead.", name: "self" }
|
|
611
|
+
],
|
|
612
|
+
"no-restricted-properties": [
|
|
613
|
+
"error",
|
|
614
|
+
{
|
|
615
|
+
message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
|
|
616
|
+
property: "__proto__"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
message: "Use `Object.defineProperty` instead.",
|
|
620
|
+
property: "__defineGetter__"
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
message: "Use `Object.defineProperty` instead.",
|
|
624
|
+
property: "__defineSetter__"
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
628
|
+
property: "__lookupGetter__"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
632
|
+
property: "__lookupSetter__"
|
|
633
|
+
}
|
|
634
|
+
],
|
|
635
|
+
"no-restricted-syntax": [
|
|
636
|
+
"error",
|
|
637
|
+
"TSEnumDeclaration[const=true]",
|
|
638
|
+
"TSExportAssignment"
|
|
639
|
+
],
|
|
640
|
+
"no-sequences": ["error"],
|
|
641
|
+
"no-shadow-restricted-names": ["error"],
|
|
642
|
+
"no-throw-literal": ["warn"],
|
|
643
|
+
"no-undef-init": ["error"],
|
|
644
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
645
|
+
"no-unused-expressions": [
|
|
646
|
+
"error",
|
|
647
|
+
{
|
|
648
|
+
allowShortCircuit: true,
|
|
649
|
+
allowTaggedTemplates: true,
|
|
650
|
+
allowTernary: true
|
|
651
|
+
}
|
|
652
|
+
],
|
|
653
|
+
"no-useless-call": ["error"],
|
|
654
|
+
"no-useless-catch": ["error"],
|
|
655
|
+
"no-useless-computed-key": ["error"],
|
|
656
|
+
"no-useless-constructor": ["error"],
|
|
657
|
+
"no-useless-return": ["error"],
|
|
658
|
+
"no-var": ["error"],
|
|
659
|
+
"no-with": ["error"],
|
|
660
|
+
"no-useless-escape": ["error"],
|
|
661
|
+
"object-shorthand": [
|
|
662
|
+
"error",
|
|
663
|
+
"always",
|
|
664
|
+
{
|
|
665
|
+
avoidQuotes: true,
|
|
666
|
+
ignoreConstructors: false
|
|
667
|
+
}
|
|
668
|
+
],
|
|
669
|
+
"one-var": ["error", { initialized: "never", uninitialized: "never" }],
|
|
670
|
+
"prefer-arrow-callback": [
|
|
671
|
+
"error",
|
|
672
|
+
{
|
|
673
|
+
allowNamedFunctions: false,
|
|
674
|
+
allowUnboundThis: true
|
|
675
|
+
}
|
|
676
|
+
],
|
|
677
|
+
"prefer-const": [
|
|
678
|
+
"error",
|
|
679
|
+
{
|
|
680
|
+
destructuring: "all",
|
|
681
|
+
ignoreReadBeforeAssign: true
|
|
682
|
+
}
|
|
683
|
+
],
|
|
684
|
+
"prefer-exponentiation-operator": ["error"],
|
|
685
|
+
"prefer-promise-reject-errors": ["error"],
|
|
686
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
687
|
+
"prefer-rest-params": ["error"],
|
|
688
|
+
"prefer-spread": ["error"],
|
|
689
|
+
"prefer-template": ["error"],
|
|
690
|
+
"radix": ["error"],
|
|
691
|
+
"symbol-description": ["error"],
|
|
692
|
+
"vars-on-top": ["error"],
|
|
693
|
+
"yoda": ["error", "never"],
|
|
694
|
+
"unicode-bom": ["error", "never"]
|
|
695
|
+
},
|
|
696
|
+
...this.options.overrides
|
|
697
|
+
})
|
|
698
|
+
];
|
|
699
|
+
}
|
|
700
|
+
};
|
|
1398
701
|
|
|
1399
702
|
// src/configs/jsdoc.ts
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
703
|
+
var JsdocConfig = class extends CustomConfig {
|
|
704
|
+
namespace = "jsdoc";
|
|
705
|
+
constructor(options = {}) {
|
|
706
|
+
super(options);
|
|
707
|
+
}
|
|
708
|
+
async _rules() {
|
|
709
|
+
return [
|
|
710
|
+
this.createRuleConfig("rules", {
|
|
711
|
+
files: GLOB_SCRIPTS,
|
|
712
|
+
plugins: {
|
|
713
|
+
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
714
|
+
},
|
|
715
|
+
rules: {
|
|
716
|
+
"jsdoc/check-access": ["warn"],
|
|
717
|
+
"jsdoc/check-param-names": ["warn"],
|
|
718
|
+
"jsdoc/check-property-names": ["warn"],
|
|
719
|
+
"jsdoc/check-types": ["warn"],
|
|
720
|
+
"jsdoc/empty-tags": ["warn"],
|
|
721
|
+
"jsdoc/implements-on-classes": ["warn"],
|
|
722
|
+
"jsdoc/no-defaults": ["warn"],
|
|
723
|
+
"jsdoc/no-multi-asterisks": ["warn"],
|
|
724
|
+
"jsdoc/require-param-name": ["warn"],
|
|
725
|
+
"jsdoc/require-property": ["warn"],
|
|
726
|
+
"jsdoc/require-property-description": ["warn"],
|
|
727
|
+
"jsdoc/require-property-name": ["warn"],
|
|
728
|
+
"jsdoc/require-returns-check": ["warn"],
|
|
729
|
+
"jsdoc/require-returns-description": ["warn"],
|
|
730
|
+
"jsdoc/require-yields-check": ["warn"],
|
|
731
|
+
"jsdoc/check-alignment": ["warn"],
|
|
732
|
+
"jsdoc/multiline-blocks": ["warn"],
|
|
733
|
+
"jsdoc/check-line-alignment": ["warn"],
|
|
734
|
+
"jsdoc/no-blank-block-descriptions": ["warn"],
|
|
735
|
+
"jsdoc/no-blank-blocks": ["warn"],
|
|
736
|
+
"jsdoc/sort-tags": ["warn"]
|
|
737
|
+
}
|
|
738
|
+
})
|
|
739
|
+
];
|
|
740
|
+
}
|
|
741
|
+
};
|
|
1431
742
|
|
|
1432
|
-
// src/configs/
|
|
1433
|
-
|
|
743
|
+
// src/configs/json-schema.ts
|
|
744
|
+
var JsonSchemaConfig = class extends CustomConfig {
|
|
745
|
+
namespace = "json-schema";
|
|
746
|
+
constructor({
|
|
747
|
+
files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML, GLOB_TOML],
|
|
748
|
+
...rest
|
|
749
|
+
} = {}) {
|
|
750
|
+
super({
|
|
751
|
+
files,
|
|
752
|
+
...rest
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
async _rules() {
|
|
756
|
+
const { files, overrides = {} } = this.options;
|
|
757
|
+
const plugin4 = await interopDefault(import("eslint-plugin-json-schema-validator"));
|
|
758
|
+
return [
|
|
759
|
+
this.createRuleConfig("rules", {
|
|
760
|
+
files,
|
|
761
|
+
plugins: {
|
|
762
|
+
"json-schema-validator": plugin4
|
|
763
|
+
},
|
|
764
|
+
rules: {
|
|
765
|
+
"json-schema-validator/no-invalid": "error",
|
|
766
|
+
...overrides
|
|
767
|
+
}
|
|
768
|
+
})
|
|
769
|
+
];
|
|
770
|
+
}
|
|
771
|
+
};
|
|
1434
772
|
|
|
1435
773
|
// src/defaults.ts
|
|
1436
|
-
init_esm_shims();
|
|
1437
774
|
var STYLE_DEFAULTS = {
|
|
1438
775
|
indent: 2,
|
|
1439
776
|
jsx: true,
|
|
@@ -1442,376 +779,428 @@ var STYLE_DEFAULTS = {
|
|
|
1442
779
|
};
|
|
1443
780
|
|
|
1444
781
|
// src/configs/jsonc.ts
|
|
1445
|
-
var
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
]);
|
|
1454
|
-
return [
|
|
1455
|
-
{
|
|
1456
|
-
name: `${NAMESPACE7}/setup`,
|
|
1457
|
-
plugins: {
|
|
1458
|
-
jsonc: plugin4
|
|
1459
|
-
}
|
|
1460
|
-
},
|
|
1461
|
-
{
|
|
782
|
+
var JsoncConfig = class extends CustomConfig {
|
|
783
|
+
namespace = "jsonc";
|
|
784
|
+
constructor({
|
|
785
|
+
files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
786
|
+
indent = STYLE_DEFAULTS.indent,
|
|
787
|
+
...rest
|
|
788
|
+
} = {}) {
|
|
789
|
+
super({
|
|
1462
790
|
files,
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
"error",
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
"error",
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
"error",
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
791
|
+
indent,
|
|
792
|
+
...rest
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
async _rules() {
|
|
796
|
+
const {
|
|
797
|
+
files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
798
|
+
overrides = {},
|
|
799
|
+
indent = STYLE_DEFAULTS.indent,
|
|
800
|
+
sortKeys = []
|
|
801
|
+
} = this.options;
|
|
802
|
+
const [plugin4, parser] = await Promise.all([
|
|
803
|
+
interopDefault(import("eslint-plugin-jsonc")),
|
|
804
|
+
interopDefault(import("jsonc-eslint-parser"))
|
|
805
|
+
]);
|
|
806
|
+
return [
|
|
807
|
+
this.createRuleConfig("setup", {
|
|
808
|
+
plugins: {
|
|
809
|
+
jsonc: plugin4
|
|
810
|
+
}
|
|
811
|
+
}),
|
|
812
|
+
this.createRuleConfig("rules", {
|
|
813
|
+
files,
|
|
814
|
+
languageOptions: {
|
|
815
|
+
parser
|
|
816
|
+
},
|
|
817
|
+
rules: {
|
|
818
|
+
"jsonc/no-bigint-literals": "error",
|
|
819
|
+
"jsonc/no-binary-expression": "error",
|
|
820
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
821
|
+
"jsonc/no-dupe-keys": "error",
|
|
822
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
823
|
+
"jsonc/no-floating-decimal": "error",
|
|
824
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
825
|
+
"jsonc/no-infinity": "error",
|
|
826
|
+
"jsonc/no-irregular-whitespace": "error",
|
|
827
|
+
"jsonc/no-multi-str": "error",
|
|
828
|
+
"jsonc/no-nan": "error",
|
|
829
|
+
"jsonc/no-number-props": "error",
|
|
830
|
+
"jsonc/no-numeric-separators": "error",
|
|
831
|
+
"jsonc/no-octal": "error",
|
|
832
|
+
"jsonc/no-octal-escape": "error",
|
|
833
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
834
|
+
"jsonc/no-parenthesized": "error",
|
|
835
|
+
"jsonc/no-plus-sign": "error",
|
|
836
|
+
"jsonc/no-regexp-literals": "error",
|
|
837
|
+
"jsonc/no-sparse-arrays": "error",
|
|
838
|
+
"jsonc/no-template-literals": "error",
|
|
839
|
+
"jsonc/no-undefined-value": "error",
|
|
840
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
841
|
+
"jsonc/no-useless-escape": "error",
|
|
842
|
+
"jsonc/space-unary-ops": "error",
|
|
843
|
+
"jsonc/valid-json-number": "error",
|
|
844
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
845
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
846
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
847
|
+
"jsonc/comma-style": ["error", "last"],
|
|
848
|
+
"jsonc/indent": ["error", indent],
|
|
849
|
+
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
850
|
+
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
851
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
852
|
+
"jsonc/object-property-newline": [
|
|
853
|
+
"error",
|
|
854
|
+
{ allowMultiplePropertiesPerLine: true }
|
|
855
|
+
],
|
|
856
|
+
"jsonc/quote-props": "error",
|
|
857
|
+
"jsonc/quotes": "error",
|
|
858
|
+
...overrides
|
|
859
|
+
}
|
|
860
|
+
}),
|
|
861
|
+
...sortKeys.length > 0 ? [
|
|
862
|
+
this.createRuleConfig("sort-keys", {
|
|
863
|
+
files: sortKeys,
|
|
864
|
+
ignores: ["**/package.json", "**/tsconfig.json", "**/tsconfig.*.json"],
|
|
865
|
+
languageOptions: {
|
|
866
|
+
parser
|
|
867
|
+
},
|
|
868
|
+
rules: {
|
|
869
|
+
"jsonc/sort-keys": [
|
|
870
|
+
"error",
|
|
871
|
+
"asc",
|
|
872
|
+
{ allowLineSeparatedGroups: true, natural: true }
|
|
873
|
+
]
|
|
874
|
+
}
|
|
875
|
+
})
|
|
876
|
+
] : []
|
|
877
|
+
];
|
|
878
|
+
}
|
|
879
|
+
};
|
|
1518
880
|
|
|
1519
881
|
// src/configs/jsx.ts
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
882
|
+
var JsxConfig = class extends CustomConfig {
|
|
883
|
+
namespace = "jsx";
|
|
884
|
+
constructor(options = {}) {
|
|
885
|
+
super(options);
|
|
886
|
+
}
|
|
887
|
+
async _rules() {
|
|
888
|
+
return [
|
|
889
|
+
this.createRuleConfig("setup", {
|
|
890
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
891
|
+
languageOptions: {
|
|
892
|
+
parserOptions: {
|
|
893
|
+
ecmaFeatures: {
|
|
894
|
+
jsx: true
|
|
895
|
+
}
|
|
1531
896
|
}
|
|
1532
897
|
}
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
}
|
|
898
|
+
})
|
|
899
|
+
];
|
|
900
|
+
}
|
|
901
|
+
};
|
|
1537
902
|
|
|
1538
903
|
// src/configs/markdown.ts
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
overrides = {}
|
|
1544
|
-
} = {}) {
|
|
1545
|
-
const markdown2 = await interopDefault(import("@eslint/markdown"));
|
|
1546
|
-
return [
|
|
1547
|
-
{
|
|
1548
|
-
name: `${NAMESPACE9}/setup`,
|
|
1549
|
-
plugins: { markdown: markdown2 }
|
|
1550
|
-
},
|
|
1551
|
-
{
|
|
1552
|
-
name: `${NAMESPACE9}/processor`,
|
|
904
|
+
var MarkdownConfig = class extends CustomConfig {
|
|
905
|
+
namespace = "markdown";
|
|
906
|
+
constructor({ files = [GLOB_MARKDOWN], ...rest } = {}) {
|
|
907
|
+
super({
|
|
1553
908
|
files,
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
909
|
+
...rest
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
async _rules() {
|
|
913
|
+
const { files = [GLOB_MARKDOWN], overrides = {} } = this.options;
|
|
914
|
+
const markdown = await interopDefault(import("@eslint/markdown"));
|
|
915
|
+
return [
|
|
916
|
+
this.createRuleConfig("setup", {
|
|
917
|
+
plugins: { markdown }
|
|
918
|
+
}),
|
|
919
|
+
this.createRuleConfig("processor", {
|
|
920
|
+
files,
|
|
921
|
+
ignores: ["**/*.md/*.md"],
|
|
922
|
+
// `eslint-plugin-markdown` only creates virtual files for code blocks,
|
|
923
|
+
// but not the markdown file itself (we use passthrough for this).
|
|
924
|
+
processor: mergeProcessors([markdown.processors.markdown, processorPassThrough])
|
|
925
|
+
}),
|
|
926
|
+
this.createRuleConfig("rules", {
|
|
927
|
+
files,
|
|
928
|
+
language: "markdown/gfm",
|
|
929
|
+
rules: {
|
|
930
|
+
...markdown.configs.recommended[0].rules
|
|
1575
931
|
}
|
|
1576
|
-
},
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
932
|
+
}),
|
|
933
|
+
this.createRuleConfig("disables", {
|
|
934
|
+
files: [GLOB_MARKDOWN_CODE],
|
|
935
|
+
languageOptions: {
|
|
936
|
+
parserOptions: {
|
|
937
|
+
ecmaFeatures: { impliedStrict: true }
|
|
938
|
+
}
|
|
939
|
+
},
|
|
940
|
+
rules: {
|
|
941
|
+
"import/newline-after-import": "off",
|
|
942
|
+
"no-alert": "off",
|
|
943
|
+
"no-console": "off",
|
|
944
|
+
"no-labels": "off",
|
|
945
|
+
"no-lone-blocks": "off",
|
|
946
|
+
"no-restricted-syntax": "off",
|
|
947
|
+
"no-undef": "off",
|
|
948
|
+
"no-unused-expressions": "off",
|
|
949
|
+
"no-unused-labels": "off",
|
|
950
|
+
"no-unused-vars": "off",
|
|
951
|
+
"node/prefer-global/process": "off",
|
|
952
|
+
"style/comma-dangle": "off",
|
|
953
|
+
"style/eol-last": "off",
|
|
954
|
+
"ts/consistent-type-imports": "off",
|
|
955
|
+
"ts/explicit-function-return-type": "off",
|
|
956
|
+
"ts/no-namespace": "off",
|
|
957
|
+
"ts/no-redeclare": "off",
|
|
958
|
+
"ts/no-require-imports": "off",
|
|
959
|
+
"ts/no-unused-expressions": "off",
|
|
960
|
+
"ts/no-unused-vars": "off",
|
|
961
|
+
"ts/no-use-before-define": "off",
|
|
962
|
+
"unicode-bom": "off",
|
|
963
|
+
"unused-imports/no-unused-imports": "off",
|
|
964
|
+
"unused-imports/no-unused-vars": "off",
|
|
965
|
+
...overrides
|
|
966
|
+
}
|
|
967
|
+
})
|
|
968
|
+
];
|
|
969
|
+
}
|
|
970
|
+
};
|
|
1610
971
|
|
|
1611
972
|
// src/configs/misc/perfectionist.ts
|
|
1612
|
-
init_esm_shims();
|
|
1613
973
|
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
1614
|
-
var
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
}
|
|
974
|
+
var SORT_OPTIONS = { order: "asc", type: "natural" };
|
|
975
|
+
var PerfectionistConfig = class extends CustomConfig {
|
|
976
|
+
namespace = "misc/perfectionist";
|
|
977
|
+
constructor({ sortDeclarations = false, ...rest } = {}) {
|
|
978
|
+
super({
|
|
979
|
+
sortDeclarations,
|
|
980
|
+
...rest
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
async _rules() {
|
|
984
|
+
const { sortDeclarations = false } = this.options;
|
|
985
|
+
return [
|
|
986
|
+
this.createRuleConfig("setup", {
|
|
987
|
+
files: GLOB_SCRIPTS,
|
|
988
|
+
plugins: {
|
|
989
|
+
perfectionist: pluginPerfectionist
|
|
990
|
+
},
|
|
991
|
+
rules: {
|
|
992
|
+
"perfectionist/sort-array-includes": ["error", SORT_OPTIONS],
|
|
993
|
+
"perfectionist/sort-exports": ["error", SORT_OPTIONS],
|
|
994
|
+
"perfectionist/sort-heritage-clauses": ["error", SORT_OPTIONS],
|
|
995
|
+
"perfectionist/sort-named-exports": ["error", SORT_OPTIONS],
|
|
996
|
+
"perfectionist/sort-named-imports": ["error", SORT_OPTIONS],
|
|
997
|
+
"perfectionist/sort-union-types": ["error", SORT_OPTIONS]
|
|
998
|
+
}
|
|
999
|
+
}),
|
|
1000
|
+
...sortDeclarations ? [
|
|
1001
|
+
this.createRuleConfig("declarations", {
|
|
1002
|
+
files: GLOB_SCRIPTS,
|
|
1003
|
+
rules: {
|
|
1004
|
+
"perfectionist/sort-classes": ["error", SORT_OPTIONS],
|
|
1005
|
+
"perfectionist/sort-enums": ["error", SORT_OPTIONS],
|
|
1006
|
+
"perfectionist/sort-interfaces": ["error", SORT_OPTIONS],
|
|
1007
|
+
"perfectionist/sort-intersection-types": ["error", SORT_OPTIONS],
|
|
1008
|
+
"perfectionist/sort-modules": ["error", SORT_OPTIONS],
|
|
1009
|
+
"perfectionist/sort-object-types": ["error", SORT_OPTIONS],
|
|
1010
|
+
"perfectionist/sort-sets": ["error", SORT_OPTIONS]
|
|
1011
|
+
}
|
|
1012
|
+
})
|
|
1013
|
+
] : []
|
|
1014
|
+
];
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1658
1017
|
|
|
1659
1018
|
// src/configs/misc/unicorn.ts
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
}
|
|
1019
|
+
import pluginUnicorn2 from "eslint-plugin-unicorn";
|
|
1020
|
+
var UnicornConfig = class extends CustomConfig {
|
|
1021
|
+
namespace = "misc/unicorn";
|
|
1022
|
+
constructor(options = {}) {
|
|
1023
|
+
super(options);
|
|
1024
|
+
}
|
|
1025
|
+
async _rules() {
|
|
1026
|
+
return [
|
|
1027
|
+
this.createRuleConfig("rules", {
|
|
1028
|
+
files: GLOB_SCRIPTS,
|
|
1029
|
+
plugins: {
|
|
1030
|
+
unicorn: pluginUnicorn2
|
|
1031
|
+
},
|
|
1032
|
+
rules: {
|
|
1033
|
+
...pluginUnicorn2.configs.recommended.rules,
|
|
1034
|
+
"unicorn/prevent-abbreviations": "off",
|
|
1035
|
+
"unicorn/no-null": "off",
|
|
1036
|
+
"unicorn/prefer-top-level-await": "off",
|
|
1037
|
+
"unicorn/filename-case": "off",
|
|
1038
|
+
"unicorn/no-await-expression-member": "off",
|
|
1039
|
+
"unicorn/throw-new-error": "off",
|
|
1040
|
+
"unicorn/no-array-callback-reference": "off",
|
|
1041
|
+
"unicorn/no-new-array": "off"
|
|
1042
|
+
}
|
|
1043
|
+
})
|
|
1044
|
+
];
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1684
1047
|
|
|
1685
1048
|
// src/configs/node.ts
|
|
1686
|
-
init_esm_shims();
|
|
1687
1049
|
import plugin3 from "eslint-plugin-n";
|
|
1688
|
-
var
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1050
|
+
var NodeConfig = class extends CustomConfig {
|
|
1051
|
+
namespace = "node";
|
|
1052
|
+
constructor(options = {}) {
|
|
1053
|
+
super(options);
|
|
1054
|
+
}
|
|
1055
|
+
async _rules() {
|
|
1056
|
+
return [
|
|
1057
|
+
this.createRuleConfig("rules", {
|
|
1058
|
+
files: GLOB_SCRIPTS,
|
|
1059
|
+
plugins: {
|
|
1060
|
+
node: plugin3
|
|
1061
|
+
},
|
|
1062
|
+
rules: {
|
|
1063
|
+
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
1064
|
+
"node/no-deprecated-api": "error",
|
|
1065
|
+
"node/no-exports-assign": "error",
|
|
1066
|
+
"node/no-new-require": "error",
|
|
1067
|
+
"node/no-path-concat": "error",
|
|
1068
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
1069
|
+
"node/process-exit-as-throw": "error",
|
|
1070
|
+
"node/hashbang": "error",
|
|
1071
|
+
...this.options.overrides
|
|
1072
|
+
}
|
|
1073
|
+
})
|
|
1074
|
+
];
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1708
1077
|
|
|
1709
1078
|
// src/configs/package.json.ts
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
rules
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1079
|
+
var PackageJsonConfig = class extends CustomConfig {
|
|
1080
|
+
namespace = "package.json";
|
|
1081
|
+
constructor(options = {}) {
|
|
1082
|
+
super(options);
|
|
1083
|
+
}
|
|
1084
|
+
async _rules() {
|
|
1085
|
+
return [
|
|
1086
|
+
this.createRuleConfig("rules", {
|
|
1087
|
+
files: ["**/package.json"],
|
|
1088
|
+
rules: {
|
|
1089
|
+
"jsonc/sort-array-values": [
|
|
1090
|
+
"error",
|
|
1091
|
+
{
|
|
1092
|
+
order: { type: "asc" },
|
|
1093
|
+
pathPattern: "^files$"
|
|
1094
|
+
}
|
|
1095
|
+
],
|
|
1096
|
+
"jsonc/sort-keys": [
|
|
1097
|
+
"error",
|
|
1098
|
+
{
|
|
1099
|
+
order: [
|
|
1100
|
+
"publisher",
|
|
1101
|
+
"name",
|
|
1102
|
+
"displayName",
|
|
1103
|
+
"type",
|
|
1104
|
+
"version",
|
|
1105
|
+
"private",
|
|
1106
|
+
"packageManager",
|
|
1107
|
+
"description",
|
|
1108
|
+
"author",
|
|
1109
|
+
"contributors",
|
|
1110
|
+
"license",
|
|
1111
|
+
"funding",
|
|
1112
|
+
"homepage",
|
|
1113
|
+
"repository",
|
|
1114
|
+
"bugs",
|
|
1115
|
+
"keywords",
|
|
1116
|
+
"categories",
|
|
1117
|
+
"sideEffects",
|
|
1118
|
+
"exports",
|
|
1119
|
+
"main",
|
|
1120
|
+
"module",
|
|
1121
|
+
"unpkg",
|
|
1122
|
+
"jsdelivr",
|
|
1123
|
+
"types",
|
|
1124
|
+
"typesVersions",
|
|
1125
|
+
"bin",
|
|
1126
|
+
"icon",
|
|
1127
|
+
"files",
|
|
1128
|
+
"engines",
|
|
1129
|
+
"activationEvents",
|
|
1130
|
+
"contributes",
|
|
1131
|
+
"scripts",
|
|
1132
|
+
"peerDependencies",
|
|
1133
|
+
"peerDependenciesMeta",
|
|
1134
|
+
"dependencies",
|
|
1135
|
+
"optionalDependencies",
|
|
1136
|
+
"devDependencies",
|
|
1137
|
+
"pnpm",
|
|
1138
|
+
"overrides",
|
|
1139
|
+
"resolutions",
|
|
1140
|
+
"husky",
|
|
1141
|
+
"simple-git-hooks",
|
|
1142
|
+
"lint-staged",
|
|
1143
|
+
"eslintConfig"
|
|
1144
|
+
],
|
|
1145
|
+
pathPattern: "^$"
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
order: { type: "asc" },
|
|
1149
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
order: { type: "asc" },
|
|
1153
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
order: ["types", "import", "require", "default"],
|
|
1157
|
+
pathPattern: "^exports.*$"
|
|
1158
|
+
},
|
|
1159
|
+
{
|
|
1160
|
+
order: [
|
|
1161
|
+
// Client hooks only
|
|
1162
|
+
"pre-commit",
|
|
1163
|
+
"prepare-commit-msg",
|
|
1164
|
+
"commit-msg",
|
|
1165
|
+
"post-commit",
|
|
1166
|
+
"pre-rebase",
|
|
1167
|
+
"post-rewrite",
|
|
1168
|
+
"post-checkout",
|
|
1169
|
+
"post-merge",
|
|
1170
|
+
"pre-push",
|
|
1171
|
+
"pre-auto-gc"
|
|
1172
|
+
],
|
|
1173
|
+
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
|
|
1174
|
+
}
|
|
1175
|
+
],
|
|
1176
|
+
...this.options.overrides
|
|
1177
|
+
}
|
|
1178
|
+
})
|
|
1179
|
+
];
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
var PackageJsonPluginConfig = class extends CustomConfig {
|
|
1183
|
+
namespace = "package.json/plugin";
|
|
1184
|
+
constructor(options = {}) {
|
|
1185
|
+
super(options);
|
|
1186
|
+
}
|
|
1187
|
+
async _rules() {
|
|
1188
|
+
const plugin4 = await interopDefault(import("eslint-plugin-package-json"));
|
|
1189
|
+
const { recommended, stylistic } = plugin4.configs;
|
|
1190
|
+
return [
|
|
1191
|
+
this.createRuleConfig("rules", {
|
|
1192
|
+
...recommended,
|
|
1193
|
+
rules: {
|
|
1194
|
+
...recommended.rules,
|
|
1195
|
+
...stylistic.rules,
|
|
1196
|
+
...this.options.overrides
|
|
1197
|
+
}
|
|
1198
|
+
})
|
|
1199
|
+
];
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1812
1202
|
|
|
1813
1203
|
// src/vendor/plugins/eslint-config-prettier.ts
|
|
1814
|
-
init_esm_shims();
|
|
1815
1204
|
var specialRule = 0;
|
|
1816
1205
|
var eslint_config_prettier_default = {
|
|
1817
1206
|
rules: {
|
|
@@ -2102,12 +1491,38 @@ var eslint_config_prettier_default = {
|
|
|
2102
1491
|
};
|
|
2103
1492
|
|
|
2104
1493
|
// src/configs/prettier.ts
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
1494
|
+
var FORMAT_PLUGIN_RULES = {
|
|
1495
|
+
"jsonc/comma-dangle": "off",
|
|
1496
|
+
"jsonc/indent": "off",
|
|
1497
|
+
"jsonc/quote-props": "off",
|
|
1498
|
+
"jsonc/quotes": "off",
|
|
1499
|
+
"toml/array-bracket-spacing": "off",
|
|
1500
|
+
"toml/array-element-newline": "off",
|
|
1501
|
+
"toml/indent": "off",
|
|
1502
|
+
"yaml/flow-mapping-curly-spacing": "off",
|
|
1503
|
+
"yaml/indent": "off",
|
|
1504
|
+
"yaml/quotes": "off"
|
|
1505
|
+
};
|
|
1506
|
+
var PrettierConfig = class extends CustomConfig {
|
|
1507
|
+
namespace = "prettier";
|
|
1508
|
+
constructor(options = {}) {
|
|
1509
|
+
super(options);
|
|
1510
|
+
}
|
|
1511
|
+
async _rules() {
|
|
1512
|
+
return [
|
|
1513
|
+
this.createRuleConfig("rules", {
|
|
1514
|
+
...eslint_config_prettier_default,
|
|
1515
|
+
rules: {
|
|
1516
|
+
...eslint_config_prettier_default.rules,
|
|
1517
|
+
...FORMAT_PLUGIN_RULES,
|
|
1518
|
+
...this.options.overrides
|
|
1519
|
+
}
|
|
1520
|
+
})
|
|
1521
|
+
];
|
|
1522
|
+
}
|
|
1523
|
+
};
|
|
2108
1524
|
|
|
2109
1525
|
// src/configs/react.ts
|
|
2110
|
-
init_esm_shims();
|
|
2111
1526
|
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
2112
1527
|
var REACT_REFRESH_ALLOW_CONSTANT_EXPORT_PACKAGES = ["vite"];
|
|
2113
1528
|
var REACT_ROUTER_PACKAGES = [
|
|
@@ -2116,172 +1531,195 @@ var REACT_ROUTER_PACKAGES = [
|
|
|
2116
1531
|
"@react-router/serve",
|
|
2117
1532
|
"@react-router/dev"
|
|
2118
1533
|
];
|
|
2119
|
-
var
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
1534
|
+
var ReactConfig = class extends CustomConfig {
|
|
1535
|
+
namespace = "react";
|
|
1536
|
+
constructor({
|
|
1537
|
+
files = [GLOB_SRC],
|
|
1538
|
+
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
1539
|
+
ignoresTypeAware = [],
|
|
1540
|
+
tsconfigPath,
|
|
1541
|
+
...rest
|
|
1542
|
+
} = {}) {
|
|
1543
|
+
super({
|
|
1544
|
+
files,
|
|
1545
|
+
filesTypeAware,
|
|
1546
|
+
ignoresTypeAware,
|
|
1547
|
+
tsconfigPath,
|
|
1548
|
+
...rest
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
async _rules() {
|
|
1552
|
+
const {
|
|
1553
|
+
files = [GLOB_SRC],
|
|
1554
|
+
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
1555
|
+
ignoresTypeAware = [],
|
|
1556
|
+
tsconfigPath,
|
|
1557
|
+
overrides = {}
|
|
1558
|
+
} = this.options;
|
|
1559
|
+
const isTypeAware = !!tsconfigPath;
|
|
1560
|
+
const typeAwareRules = {
|
|
1561
|
+
"react/no-leaked-conditional-rendering": "warn"
|
|
1562
|
+
};
|
|
1563
|
+
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
2133
1564
|
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
2134
1565
|
interopDefault(import("eslint-plugin-react-hooks")),
|
|
2135
1566
|
interopDefault(import("eslint-plugin-react-refresh"))
|
|
2136
|
-
]
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
}
|
|
1567
|
+
]);
|
|
1568
|
+
const isAllowConstantExport = REACT_REFRESH_ALLOW_CONSTANT_EXPORT_PACKAGES.some(
|
|
1569
|
+
(index) => isPackageExists2(index)
|
|
1570
|
+
);
|
|
1571
|
+
const isUsingReactRouter = REACT_ROUTER_PACKAGES.some((index) => isPackageExists2(index));
|
|
1572
|
+
const plugins = pluginReact.configs.all.plugins;
|
|
1573
|
+
return [
|
|
1574
|
+
this.createRuleConfig("setup", {
|
|
1575
|
+
plugins: {
|
|
1576
|
+
"react": plugins["@eslint-react"],
|
|
1577
|
+
"react-dom": plugins["@eslint-react/dom"],
|
|
1578
|
+
"react-hooks": pluginReactHooks,
|
|
1579
|
+
"react-hooks-extra": plugins["@eslint-react/hooks-extra"],
|
|
1580
|
+
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1581
|
+
"react-refresh": pluginReactRefresh,
|
|
1582
|
+
"react-web-api": plugins["@eslint-react/web-api"]
|
|
1583
|
+
}
|
|
1584
|
+
}),
|
|
1585
|
+
this.createRuleConfig("rules", {
|
|
1586
|
+
files,
|
|
1587
|
+
languageOptions: {
|
|
1588
|
+
parserOptions: {
|
|
1589
|
+
ecmaFeatures: {
|
|
1590
|
+
jsx: true
|
|
1591
|
+
}
|
|
1592
|
+
},
|
|
1593
|
+
sourceType: "module"
|
|
2162
1594
|
},
|
|
2163
|
-
sourceType: "module"
|
|
2164
|
-
},
|
|
2165
|
-
rules: {
|
|
2166
|
-
// Recommended rules from @eslint-react/dom
|
|
2167
|
-
"react-dom/no-children-in-void-dom-elements": "warn",
|
|
2168
|
-
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
2169
|
-
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
2170
|
-
"react-dom/no-find-dom-node": "error",
|
|
2171
|
-
"react-dom/no-missing-button-type": "warn",
|
|
2172
|
-
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
2173
|
-
"react-dom/no-namespace": "error",
|
|
2174
|
-
"react-dom/no-render-return-value": "error",
|
|
2175
|
-
"react-dom/no-script-url": "warn",
|
|
2176
|
-
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
2177
|
-
"react-dom/no-unsafe-target-blank": "warn",
|
|
2178
|
-
// Recommended rules react-hooks
|
|
2179
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
2180
|
-
"react-hooks/rules-of-hooks": "error",
|
|
2181
|
-
// React refresh
|
|
2182
|
-
"react-refresh/only-export-components": [
|
|
2183
|
-
"warn",
|
|
2184
|
-
{
|
|
2185
|
-
allowConstantExport: isAllowConstantExport,
|
|
2186
|
-
allowExportNames: [
|
|
2187
|
-
...isUsingReactRouter ? ["meta", "links", "headers", "loader", "action"] : []
|
|
2188
|
-
]
|
|
2189
|
-
}
|
|
2190
|
-
],
|
|
2191
|
-
// Recommended rules from @eslint-react/web-api
|
|
2192
|
-
"react-web-api/no-leaked-event-listener": "warn",
|
|
2193
|
-
"react-web-api/no-leaked-interval": "warn",
|
|
2194
|
-
"react-web-api/no-leaked-resize-observer": "warn",
|
|
2195
|
-
"react-web-api/no-leaked-timeout": "warn",
|
|
2196
|
-
// Recommended rules from @eslint-react
|
|
2197
|
-
"react/ensure-forward-ref-using-ref": "warn",
|
|
2198
|
-
"react/jsx-no-duplicate-props": "warn",
|
|
2199
|
-
"react/jsx-uses-vars": "warn",
|
|
2200
|
-
"react/no-access-state-in-setstate": "error",
|
|
2201
|
-
"react/no-array-index-key": "warn",
|
|
2202
|
-
"react/no-children-count": "warn",
|
|
2203
|
-
"react/no-children-for-each": "warn",
|
|
2204
|
-
"react/no-children-map": "warn",
|
|
2205
|
-
"react/no-children-only": "warn",
|
|
2206
|
-
"react/no-children-to-array": "warn",
|
|
2207
|
-
"react/no-clone-element": "warn",
|
|
2208
|
-
"react/no-comment-textnodes": "warn",
|
|
2209
|
-
"react/no-component-will-mount": "error",
|
|
2210
|
-
"react/no-component-will-receive-props": "error",
|
|
2211
|
-
"react/no-component-will-update": "error",
|
|
2212
|
-
"react/no-context-provider": "warn",
|
|
2213
|
-
"react/no-create-ref": "error",
|
|
2214
|
-
"react/no-default-props": "error",
|
|
2215
|
-
"react/no-direct-mutation-state": "error",
|
|
2216
|
-
"react/no-duplicate-key": "error",
|
|
2217
|
-
"react/no-forward-ref": "warn",
|
|
2218
|
-
"react/no-implicit-key": "warn",
|
|
2219
|
-
"react/no-missing-key": "error",
|
|
2220
|
-
"react/no-nested-components": "error",
|
|
2221
|
-
"react/no-prop-types": "error",
|
|
2222
|
-
"react/no-redundant-should-component-update": "error",
|
|
2223
|
-
"react/no-set-state-in-component-did-mount": "warn",
|
|
2224
|
-
"react/no-set-state-in-component-did-update": "warn",
|
|
2225
|
-
"react/no-set-state-in-component-will-update": "warn",
|
|
2226
|
-
"react/no-string-refs": "error",
|
|
2227
|
-
"react/no-unsafe-component-will-mount": "warn",
|
|
2228
|
-
"react/no-unsafe-component-will-receive-props": "warn",
|
|
2229
|
-
"react/no-unsafe-component-will-update": "warn",
|
|
2230
|
-
"react/no-unstable-context-value": "warn",
|
|
2231
|
-
"react/no-unstable-default-props": "warn",
|
|
2232
|
-
"react/no-unused-class-component-members": "warn",
|
|
2233
|
-
"react/no-unused-state": "warn",
|
|
2234
|
-
"react/prefer-destructuring-assignment": "warn",
|
|
2235
|
-
"react/prefer-shorthand-boolean": "warn",
|
|
2236
|
-
"react/prefer-shorthand-fragment": "warn",
|
|
2237
|
-
...overrides
|
|
2238
|
-
}
|
|
2239
|
-
},
|
|
2240
|
-
...isTypeAware ? [
|
|
2241
|
-
{
|
|
2242
|
-
name: `${NAMESPACE14}/type-aware-rules`,
|
|
2243
|
-
files: filesTypeAware,
|
|
2244
|
-
ignores: ignoresTypeAware,
|
|
2245
1595
|
rules: {
|
|
2246
|
-
|
|
1596
|
+
// Recommended rules from @eslint-react/dom
|
|
1597
|
+
"react-dom/no-children-in-void-dom-elements": "warn",
|
|
1598
|
+
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
1599
|
+
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
1600
|
+
"react-dom/no-find-dom-node": "error",
|
|
1601
|
+
"react-dom/no-missing-button-type": "warn",
|
|
1602
|
+
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
1603
|
+
"react-dom/no-namespace": "error",
|
|
1604
|
+
"react-dom/no-render-return-value": "error",
|
|
1605
|
+
"react-dom/no-script-url": "warn",
|
|
1606
|
+
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1607
|
+
"react-dom/no-unsafe-target-blank": "warn",
|
|
1608
|
+
// Recommended rules react-hooks
|
|
1609
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1610
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1611
|
+
// React refresh
|
|
1612
|
+
"react-refresh/only-export-components": [
|
|
1613
|
+
"warn",
|
|
1614
|
+
{
|
|
1615
|
+
allowConstantExport: isAllowConstantExport,
|
|
1616
|
+
allowExportNames: [
|
|
1617
|
+
...isUsingReactRouter ? ["meta", "links", "headers", "loader", "action"] : []
|
|
1618
|
+
]
|
|
1619
|
+
}
|
|
1620
|
+
],
|
|
1621
|
+
// Recommended rules from @eslint-react/web-api
|
|
1622
|
+
"react-web-api/no-leaked-event-listener": "warn",
|
|
1623
|
+
"react-web-api/no-leaked-interval": "warn",
|
|
1624
|
+
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1625
|
+
"react-web-api/no-leaked-timeout": "warn",
|
|
1626
|
+
// Recommended rules from @eslint-react
|
|
1627
|
+
"react/ensure-forward-ref-using-ref": "warn",
|
|
1628
|
+
"react/jsx-no-duplicate-props": "warn",
|
|
1629
|
+
"react/jsx-uses-vars": "warn",
|
|
1630
|
+
"react/no-access-state-in-setstate": "error",
|
|
1631
|
+
"react/no-array-index-key": "warn",
|
|
1632
|
+
"react/no-children-count": "warn",
|
|
1633
|
+
"react/no-children-for-each": "warn",
|
|
1634
|
+
"react/no-children-map": "warn",
|
|
1635
|
+
"react/no-children-only": "warn",
|
|
1636
|
+
"react/no-children-to-array": "warn",
|
|
1637
|
+
"react/no-clone-element": "warn",
|
|
1638
|
+
"react/no-comment-textnodes": "warn",
|
|
1639
|
+
"react/no-component-will-mount": "error",
|
|
1640
|
+
"react/no-component-will-receive-props": "error",
|
|
1641
|
+
"react/no-component-will-update": "error",
|
|
1642
|
+
"react/no-context-provider": "warn",
|
|
1643
|
+
"react/no-create-ref": "error",
|
|
1644
|
+
"react/no-default-props": "error",
|
|
1645
|
+
"react/no-direct-mutation-state": "error",
|
|
1646
|
+
"react/no-duplicate-key": "error",
|
|
1647
|
+
"react/no-forward-ref": "warn",
|
|
1648
|
+
"react/no-implicit-key": "warn",
|
|
1649
|
+
"react/no-missing-key": "error",
|
|
1650
|
+
"react/no-nested-components": "error",
|
|
1651
|
+
"react/no-prop-types": "error",
|
|
1652
|
+
"react/no-redundant-should-component-update": "error",
|
|
1653
|
+
"react/no-set-state-in-component-did-mount": "warn",
|
|
1654
|
+
"react/no-set-state-in-component-did-update": "warn",
|
|
1655
|
+
"react/no-set-state-in-component-will-update": "warn",
|
|
1656
|
+
"react/no-string-refs": "error",
|
|
1657
|
+
"react/no-unsafe-component-will-mount": "warn",
|
|
1658
|
+
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1659
|
+
"react/no-unsafe-component-will-update": "warn",
|
|
1660
|
+
"react/no-unstable-context-value": "warn",
|
|
1661
|
+
"react/no-unstable-default-props": "warn",
|
|
1662
|
+
"react/no-unused-class-component-members": "warn",
|
|
1663
|
+
"react/no-unused-state": "warn",
|
|
1664
|
+
"react/prefer-destructuring-assignment": "warn",
|
|
1665
|
+
"react/prefer-shorthand-boolean": "warn",
|
|
1666
|
+
"react/prefer-shorthand-fragment": "warn",
|
|
1667
|
+
...overrides
|
|
2247
1668
|
}
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
1669
|
+
}),
|
|
1670
|
+
...isTypeAware ? [
|
|
1671
|
+
this.createRuleConfig("type-aware-rules", {
|
|
1672
|
+
files: filesTypeAware,
|
|
1673
|
+
ignores: ignoresTypeAware,
|
|
1674
|
+
rules: {
|
|
1675
|
+
...typeAwareRules
|
|
1676
|
+
}
|
|
1677
|
+
})
|
|
1678
|
+
] : []
|
|
1679
|
+
];
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
2252
1682
|
|
|
2253
1683
|
// src/configs/regexpr.ts
|
|
2254
|
-
init_esm_shims();
|
|
2255
1684
|
import { configs } from "eslint-plugin-regexp";
|
|
2256
|
-
var
|
|
2257
|
-
|
|
2258
|
-
level = "error",
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
...config.rules
|
|
2264
|
-
};
|
|
2265
|
-
if (level === "warn") {
|
|
2266
|
-
for (const key in rules) {
|
|
2267
|
-
if (rules[key] === "error") rules[key] = "warn";
|
|
2268
|
-
}
|
|
1685
|
+
var RegexprConfig = class extends CustomConfig {
|
|
1686
|
+
namespace = "regexpr";
|
|
1687
|
+
constructor({ level = "error", ...rest } = {}) {
|
|
1688
|
+
super({
|
|
1689
|
+
level,
|
|
1690
|
+
...rest
|
|
1691
|
+
});
|
|
2269
1692
|
}
|
|
2270
|
-
|
|
2271
|
-
{
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
rules
|
|
2275
|
-
|
|
2276
|
-
|
|
1693
|
+
async _rules() {
|
|
1694
|
+
const { level = "error", overrides = {} } = this.options;
|
|
1695
|
+
const config = configs["flat/recommended"];
|
|
1696
|
+
const rules = {
|
|
1697
|
+
...config.rules
|
|
1698
|
+
};
|
|
1699
|
+
if (level === "warn") {
|
|
1700
|
+
for (const key in rules) {
|
|
1701
|
+
if (rules[key] === "error") rules[key] = "warn";
|
|
2277
1702
|
}
|
|
2278
1703
|
}
|
|
2279
|
-
|
|
2280
|
-
|
|
1704
|
+
return [
|
|
1705
|
+
this.createRuleConfig("rules", {
|
|
1706
|
+
...config,
|
|
1707
|
+
files: GLOB_SCRIPTS,
|
|
1708
|
+
rules: {
|
|
1709
|
+
...rules,
|
|
1710
|
+
"regexp/prefer-quantifier": level,
|
|
1711
|
+
"regexp/prefer-regexp-test": level,
|
|
1712
|
+
"regexp/sort-alternatives": level,
|
|
1713
|
+
"regexp/sort-character-class-elements": level,
|
|
1714
|
+
"regexp/unicode-property": level,
|
|
1715
|
+
...overrides
|
|
1716
|
+
}
|
|
1717
|
+
})
|
|
1718
|
+
];
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
2281
1721
|
|
|
2282
1722
|
// src/configs/test.ts
|
|
2283
|
-
init_esm_shims();
|
|
2284
|
-
var import_flat = __toESM(require_flat(), 1);
|
|
2285
1723
|
var PLUGIN_RUNNER_MAP = {
|
|
2286
1724
|
tap: [
|
|
2287
1725
|
"eslint-plugin-tap",
|
|
@@ -2316,634 +1754,714 @@ var PLUGIN_RUNNER_MAP = {
|
|
|
2316
1754
|
})
|
|
2317
1755
|
]
|
|
2318
1756
|
};
|
|
2319
|
-
var
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
const extraConfigs = [];
|
|
2333
|
-
if (cypress) {
|
|
2334
|
-
extraConfigs.push({
|
|
2335
|
-
name: `${NAMESPACE16}/cypress/rules`,
|
|
2336
|
-
...import_flat.default.configs.recommended,
|
|
2337
|
-
...typeof cypress === "boolean" ? {} : cypress
|
|
1757
|
+
var TestConfig = class extends CustomConfig {
|
|
1758
|
+
namespace = "test";
|
|
1759
|
+
constructor({
|
|
1760
|
+
runner = "vitest",
|
|
1761
|
+
cypress = false,
|
|
1762
|
+
files = GLOB_TESTS,
|
|
1763
|
+
...rest
|
|
1764
|
+
} = {}) {
|
|
1765
|
+
super({
|
|
1766
|
+
runner,
|
|
1767
|
+
cypress,
|
|
1768
|
+
files,
|
|
1769
|
+
...rest
|
|
2338
1770
|
});
|
|
2339
1771
|
}
|
|
2340
|
-
|
|
2341
|
-
{
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
1772
|
+
async _rules() {
|
|
1773
|
+
const {
|
|
1774
|
+
runner = "vitest",
|
|
1775
|
+
cypress = false,
|
|
1776
|
+
files = GLOB_TESTS,
|
|
1777
|
+
overrides = {}
|
|
1778
|
+
} = this.options;
|
|
1779
|
+
const [plugin4, rules] = PLUGIN_RUNNER_MAP[runner];
|
|
1780
|
+
const [pluginRunner, pluginNoOnlyTests] = await Promise.all([
|
|
1781
|
+
interopDefault(import(plugin4)),
|
|
1782
|
+
// @ts-expect-error no types
|
|
1783
|
+
interopDefault(import("eslint-plugin-no-only-tests"))
|
|
1784
|
+
]);
|
|
1785
|
+
const extraConfigs = [];
|
|
1786
|
+
if (cypress) {
|
|
1787
|
+
const pluginCypress = await interopDefault(import("eslint-plugin-cypress/flat"));
|
|
1788
|
+
extraConfigs.push(
|
|
1789
|
+
this.createRuleConfig("cypress/rules", {
|
|
1790
|
+
...pluginCypress.configs.recommended,
|
|
1791
|
+
...typeof cypress === "boolean" ? {} : cypress
|
|
1792
|
+
})
|
|
1793
|
+
);
|
|
1794
|
+
}
|
|
1795
|
+
return [
|
|
1796
|
+
this.createRuleConfig("setup", {
|
|
1797
|
+
plugins: {
|
|
1798
|
+
test: {
|
|
1799
|
+
...pluginRunner,
|
|
1800
|
+
rules: {
|
|
1801
|
+
...pluginNoOnlyTests.rules,
|
|
1802
|
+
...rules(pluginRunner)
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
}),
|
|
1807
|
+
...runner === "jest" ? [
|
|
1808
|
+
this.createRuleConfig("jest", {
|
|
1809
|
+
...cypress && typeof cypress !== "boolean" ? { ignores: [...cypress.files ?? []] } : {},
|
|
1810
|
+
...pluginRunner.configs["flat/recommended"],
|
|
2346
1811
|
rules: {
|
|
2347
|
-
...
|
|
2348
|
-
...rules(pluginRunner)
|
|
1812
|
+
...pluginRunner.configs["flat/recommended"].rules
|
|
2349
1813
|
}
|
|
1814
|
+
})
|
|
1815
|
+
] : [],
|
|
1816
|
+
this.createRuleConfig("rules", {
|
|
1817
|
+
files,
|
|
1818
|
+
rules: {
|
|
1819
|
+
"test/no-only-tests": "error",
|
|
1820
|
+
...overrides
|
|
2350
1821
|
}
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
...pluginRunner.configs["flat/recommended"],
|
|
2357
|
-
rules: {
|
|
2358
|
-
...pluginRunner.configs["flat/recommended"].rules
|
|
2359
|
-
}
|
|
2360
|
-
} : {},
|
|
2361
|
-
{
|
|
2362
|
-
name: `${NAMESPACE16}/rules`,
|
|
2363
|
-
files,
|
|
2364
|
-
rules: {
|
|
2365
|
-
...overrides
|
|
2366
|
-
}
|
|
2367
|
-
},
|
|
2368
|
-
...extraConfigs
|
|
2369
|
-
];
|
|
2370
|
-
}
|
|
1822
|
+
}),
|
|
1823
|
+
...extraConfigs
|
|
1824
|
+
];
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
2371
1827
|
|
|
2372
1828
|
// src/configs/toml.ts
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
{
|
|
2382
|
-
name: `${NAMESPACE17}/setup`,
|
|
2383
|
-
plugins: {
|
|
2384
|
-
toml: plugin4
|
|
2385
|
-
}
|
|
2386
|
-
},
|
|
2387
|
-
{
|
|
2388
|
-
name: `${NAMESPACE17}/rules`,
|
|
1829
|
+
var TomlConfig = class extends CustomConfig {
|
|
1830
|
+
namespace = "toml";
|
|
1831
|
+
constructor({
|
|
1832
|
+
files = [GLOB_TOML],
|
|
1833
|
+
indent = STYLE_DEFAULTS.indent,
|
|
1834
|
+
...rest
|
|
1835
|
+
} = {}) {
|
|
1836
|
+
super({
|
|
2389
1837
|
files,
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
1838
|
+
indent,
|
|
1839
|
+
...rest
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
async _rules() {
|
|
1843
|
+
const {
|
|
1844
|
+
files = [GLOB_TOML],
|
|
1845
|
+
overrides = {},
|
|
1846
|
+
indent = STYLE_DEFAULTS.indent
|
|
1847
|
+
} = this.options;
|
|
1848
|
+
const [plugin4, parser] = await Promise.all([
|
|
1849
|
+
interopDefault(import("eslint-plugin-toml")),
|
|
1850
|
+
interopDefault(import("toml-eslint-parser"))
|
|
1851
|
+
]);
|
|
1852
|
+
return [
|
|
1853
|
+
this.createRuleConfig("setup", {
|
|
1854
|
+
plugins: {
|
|
1855
|
+
toml: plugin4
|
|
1856
|
+
}
|
|
1857
|
+
}),
|
|
1858
|
+
this.createRuleConfig("rules", {
|
|
1859
|
+
files,
|
|
1860
|
+
languageOptions: {
|
|
1861
|
+
parser
|
|
1862
|
+
},
|
|
1863
|
+
rules: {
|
|
1864
|
+
"style/spaced-comment": "off",
|
|
1865
|
+
"toml/comma-style": "error",
|
|
1866
|
+
"toml/keys-order": "error",
|
|
1867
|
+
"toml/no-space-dots": "error",
|
|
1868
|
+
"toml/no-unreadable-number-separator": "error",
|
|
1869
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
1870
|
+
"toml/precision-of-integer": "error",
|
|
1871
|
+
"toml/tables-order": "error",
|
|
1872
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1873
|
+
"toml/array-bracket-newline": "error",
|
|
1874
|
+
"toml/array-bracket-spacing": "error",
|
|
1875
|
+
"toml/array-element-newline": "error",
|
|
1876
|
+
"toml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
1877
|
+
"toml/inline-table-curly-spacing": "error",
|
|
1878
|
+
"toml/key-spacing": "error",
|
|
1879
|
+
"toml/padding-line-between-pairs": "error",
|
|
1880
|
+
"toml/padding-line-between-tables": "error",
|
|
1881
|
+
"toml/quoted-keys": "error",
|
|
1882
|
+
"toml/spaced-comment": "error",
|
|
1883
|
+
"toml/table-bracket-spacing": "error",
|
|
1884
|
+
...overrides
|
|
1885
|
+
}
|
|
1886
|
+
})
|
|
1887
|
+
];
|
|
1888
|
+
}
|
|
1889
|
+
};
|
|
2419
1890
|
|
|
2420
1891
|
// src/configs/tsconfig.ts
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
rules
|
|
2429
|
-
"
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
}
|
|
1892
|
+
var TsconfigConfig = class extends CustomConfig {
|
|
1893
|
+
namespace = "tsconfig";
|
|
1894
|
+
constructor(options = {}) {
|
|
1895
|
+
super(options);
|
|
1896
|
+
}
|
|
1897
|
+
async _rules() {
|
|
1898
|
+
return [
|
|
1899
|
+
this.createRuleConfig("rules", {
|
|
1900
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
1901
|
+
rules: {
|
|
1902
|
+
"jsonc/sort-keys": [
|
|
1903
|
+
"error",
|
|
1904
|
+
{
|
|
1905
|
+
order: [
|
|
1906
|
+
"extends",
|
|
1907
|
+
"compilerOptions",
|
|
1908
|
+
"references",
|
|
1909
|
+
"files",
|
|
1910
|
+
"include",
|
|
1911
|
+
"exclude"
|
|
1912
|
+
],
|
|
1913
|
+
pathPattern: "^$"
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
order: [
|
|
1917
|
+
/* Projects */
|
|
1918
|
+
"incremental",
|
|
1919
|
+
"composite",
|
|
1920
|
+
"tsBuildInfoFile",
|
|
1921
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
1922
|
+
"disableSolutionSearching",
|
|
1923
|
+
"disableReferencedProjectLoad",
|
|
1924
|
+
/* Language and Environment */
|
|
1925
|
+
"target",
|
|
1926
|
+
"jsx",
|
|
1927
|
+
"jsxFactory",
|
|
1928
|
+
"jsxFragmentFactory",
|
|
1929
|
+
"jsxImportSource",
|
|
1930
|
+
"lib",
|
|
1931
|
+
"moduleDetection",
|
|
1932
|
+
"noLib",
|
|
1933
|
+
"reactNamespace",
|
|
1934
|
+
"useDefineForClassFields",
|
|
1935
|
+
"emitDecoratorMetadata",
|
|
1936
|
+
"experimentalDecorators",
|
|
1937
|
+
/* Modules */
|
|
1938
|
+
"baseUrl",
|
|
1939
|
+
"rootDir",
|
|
1940
|
+
"rootDirs",
|
|
1941
|
+
"customConditions",
|
|
1942
|
+
"module",
|
|
1943
|
+
"moduleResolution",
|
|
1944
|
+
"moduleSuffixes",
|
|
1945
|
+
"noResolve",
|
|
1946
|
+
"paths",
|
|
1947
|
+
"resolveJsonModule",
|
|
1948
|
+
"resolvePackageJsonExports",
|
|
1949
|
+
"resolvePackageJsonImports",
|
|
1950
|
+
"typeRoots",
|
|
1951
|
+
"types",
|
|
1952
|
+
"allowArbitraryExtensions",
|
|
1953
|
+
"allowImportingTsExtensions",
|
|
1954
|
+
"allowUmdGlobalAccess",
|
|
1955
|
+
/* JavaScript Support */
|
|
1956
|
+
"allowJs",
|
|
1957
|
+
"checkJs",
|
|
1958
|
+
"maxNodeModuleJsDepth",
|
|
1959
|
+
/* Type Checking */
|
|
1960
|
+
"strict",
|
|
1961
|
+
"strictBindCallApply",
|
|
1962
|
+
"strictFunctionTypes",
|
|
1963
|
+
"strictNullChecks",
|
|
1964
|
+
"strictPropertyInitialization",
|
|
1965
|
+
"allowUnreachableCode",
|
|
1966
|
+
"allowUnusedLabels",
|
|
1967
|
+
"alwaysStrict",
|
|
1968
|
+
"exactOptionalPropertyTypes",
|
|
1969
|
+
"noFallthroughCasesInSwitch",
|
|
1970
|
+
"noImplicitAny",
|
|
1971
|
+
"noImplicitOverride",
|
|
1972
|
+
"noImplicitReturns",
|
|
1973
|
+
"noImplicitThis",
|
|
1974
|
+
"noPropertyAccessFromIndexSignature",
|
|
1975
|
+
"noUncheckedIndexedAccess",
|
|
1976
|
+
"noUnusedLocals",
|
|
1977
|
+
"noUnusedParameters",
|
|
1978
|
+
"useUnknownInCatchVariables",
|
|
1979
|
+
/* Emit */
|
|
1980
|
+
"declaration",
|
|
1981
|
+
"declarationDir",
|
|
1982
|
+
"declarationMap",
|
|
1983
|
+
"downlevelIteration",
|
|
1984
|
+
"emitBOM",
|
|
1985
|
+
"emitDeclarationOnly",
|
|
1986
|
+
"importHelpers",
|
|
1987
|
+
"importsNotUsedAsValues",
|
|
1988
|
+
"inlineSourceMap",
|
|
1989
|
+
"inlineSources",
|
|
1990
|
+
"mapRoot",
|
|
1991
|
+
"newLine",
|
|
1992
|
+
"noEmit",
|
|
1993
|
+
"noEmitHelpers",
|
|
1994
|
+
"noEmitOnError",
|
|
1995
|
+
"outDir",
|
|
1996
|
+
"outFile",
|
|
1997
|
+
"preserveConstEnums",
|
|
1998
|
+
"preserveValueImports",
|
|
1999
|
+
"removeComments",
|
|
2000
|
+
"sourceMap",
|
|
2001
|
+
"sourceRoot",
|
|
2002
|
+
"stripInternal",
|
|
2003
|
+
/* Interop Constraints */
|
|
2004
|
+
"allowSyntheticDefaultImports",
|
|
2005
|
+
"esModuleInterop",
|
|
2006
|
+
"forceConsistentCasingInFileNames",
|
|
2007
|
+
"isolatedDeclarations",
|
|
2008
|
+
"isolatedModules",
|
|
2009
|
+
"preserveSymlinks",
|
|
2010
|
+
"verbatimModuleSyntax",
|
|
2011
|
+
/* Completeness */
|
|
2012
|
+
"skipDefaultLibCheck",
|
|
2013
|
+
"skipLibCheck"
|
|
2014
|
+
],
|
|
2015
|
+
pathPattern: "^compilerOptions$"
|
|
2016
|
+
}
|
|
2017
|
+
],
|
|
2018
|
+
...this.options.overrides
|
|
2019
|
+
}
|
|
2020
|
+
})
|
|
2021
|
+
];
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2549
2024
|
|
|
2550
2025
|
// src/configs/typescript.ts
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
const {
|
|
2555
|
-
type = "app",
|
|
2026
|
+
var TypescriptConfig = class extends CustomConfig {
|
|
2027
|
+
namespace = "typescript";
|
|
2028
|
+
constructor({
|
|
2556
2029
|
parserOptions = {},
|
|
2557
|
-
overrides = {},
|
|
2558
2030
|
typeAwareOverrides = {},
|
|
2559
|
-
ignoresTypeAware = []
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
"ts/await-thenable": ["error"],
|
|
2569
|
-
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
2570
|
-
"ts/no-floating-promises": ["error"],
|
|
2571
|
-
"ts/no-for-in-array": ["error"],
|
|
2572
|
-
"ts/no-implied-eval": ["error"],
|
|
2573
|
-
"ts/no-misused-promises": ["error"],
|
|
2574
|
-
"ts/no-unnecessary-type-assertion": ["error"],
|
|
2575
|
-
"ts/no-unsafe-argument": ["error"],
|
|
2576
|
-
"ts/no-unsafe-assignment": ["error"],
|
|
2577
|
-
"ts/no-unsafe-call": ["error"],
|
|
2578
|
-
"ts/no-unsafe-member-access": ["error"],
|
|
2579
|
-
"ts/no-unsafe-return": ["error"],
|
|
2580
|
-
"ts/promise-function-async": ["error"],
|
|
2581
|
-
"ts/restrict-plus-operands": ["error"],
|
|
2582
|
-
"ts/restrict-template-expressions": ["error"],
|
|
2583
|
-
"ts/return-await": ["error", "in-try-catch"],
|
|
2584
|
-
"ts/strict-boolean-expressions": [
|
|
2585
|
-
"error",
|
|
2586
|
-
{ allowNullableBoolean: true, allowNullableObject: true }
|
|
2587
|
-
],
|
|
2588
|
-
"ts/switch-exhaustiveness-check": ["error"],
|
|
2589
|
-
"ts/unbound-method": ["error"]
|
|
2590
|
-
};
|
|
2591
|
-
const [plugin4, parser] = await Promise.all([
|
|
2592
|
-
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
2593
|
-
interopDefault(import("@typescript-eslint/parser"))
|
|
2594
|
-
]);
|
|
2595
|
-
function makeParser(typeAware, files2, ignores2 = []) {
|
|
2596
|
-
return {
|
|
2597
|
-
name: `${NAMESPACE19}/${typeAware ? "type-aware-parser" : "parser"}`,
|
|
2598
|
-
files: files2,
|
|
2599
|
-
ignores: ignores2,
|
|
2600
|
-
languageOptions: {
|
|
2601
|
-
parser,
|
|
2602
|
-
parserOptions: {
|
|
2603
|
-
sourceType: "module",
|
|
2604
|
-
...typeAware ? {
|
|
2605
|
-
projectService: {
|
|
2606
|
-
allowDefaultProject: ["./*.js"],
|
|
2607
|
-
defaultProject: tsconfigPath
|
|
2608
|
-
},
|
|
2609
|
-
tsconfigRootDir: process.cwd()
|
|
2610
|
-
} : {},
|
|
2611
|
-
...parserOptions
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
};
|
|
2031
|
+
ignoresTypeAware = [],
|
|
2032
|
+
...rest
|
|
2033
|
+
} = {}) {
|
|
2034
|
+
super({
|
|
2035
|
+
parserOptions,
|
|
2036
|
+
typeAwareOverrides,
|
|
2037
|
+
ignoresTypeAware,
|
|
2038
|
+
...rest
|
|
2039
|
+
});
|
|
2615
2040
|
}
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
allowTaggedTemplates: true,
|
|
2670
|
-
allowTernary: true
|
|
2671
|
-
}
|
|
2672
|
-
],
|
|
2673
|
-
"ts/no-unused-vars": [
|
|
2674
|
-
"error",
|
|
2675
|
-
{
|
|
2676
|
-
vars: "all",
|
|
2677
|
-
args: "all",
|
|
2678
|
-
argsIgnorePattern: VAR_IGNORE_PATTERN,
|
|
2679
|
-
caughtErrorsIgnorePattern: VAR_IGNORE_PATTERN,
|
|
2680
|
-
destructuredArrayIgnorePattern: VAR_IGNORE_PATTERN,
|
|
2681
|
-
reportUsedIgnorePattern: true
|
|
2041
|
+
async _rules() {
|
|
2042
|
+
const files = this.options.files ?? [GLOB_TS, GLOB_TSX];
|
|
2043
|
+
const filesTypeAware = this.options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
2044
|
+
const tsconfigPath = this.options?.tsconfigPath;
|
|
2045
|
+
const isTypeAware = !!tsconfigPath;
|
|
2046
|
+
const typeAwareRules = {
|
|
2047
|
+
"dot-notation": ["off"],
|
|
2048
|
+
"no-implied-eval": ["off"],
|
|
2049
|
+
"ts/await-thenable": ["error"],
|
|
2050
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
2051
|
+
"ts/no-floating-promises": ["error"],
|
|
2052
|
+
"ts/no-for-in-array": ["error"],
|
|
2053
|
+
"ts/no-implied-eval": ["error"],
|
|
2054
|
+
"ts/no-misused-promises": ["error"],
|
|
2055
|
+
"ts/no-unnecessary-type-assertion": ["error"],
|
|
2056
|
+
"ts/no-unsafe-argument": ["error"],
|
|
2057
|
+
"ts/no-unsafe-assignment": ["error"],
|
|
2058
|
+
"ts/no-unsafe-call": ["error"],
|
|
2059
|
+
"ts/no-unsafe-member-access": ["error"],
|
|
2060
|
+
"ts/no-unsafe-return": ["error"],
|
|
2061
|
+
"ts/promise-function-async": ["error"],
|
|
2062
|
+
"ts/restrict-plus-operands": ["error"],
|
|
2063
|
+
"ts/restrict-template-expressions": ["error"],
|
|
2064
|
+
"ts/return-await": ["error", "in-try-catch"],
|
|
2065
|
+
"ts/strict-boolean-expressions": [
|
|
2066
|
+
"error",
|
|
2067
|
+
{ allowNullableBoolean: true, allowNullableObject: true }
|
|
2068
|
+
],
|
|
2069
|
+
"ts/switch-exhaustiveness-check": ["error"],
|
|
2070
|
+
"ts/unbound-method": ["error"]
|
|
2071
|
+
};
|
|
2072
|
+
const [plugin4, parser] = await Promise.all([
|
|
2073
|
+
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
2074
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
2075
|
+
]);
|
|
2076
|
+
const { parserOptions } = this.options;
|
|
2077
|
+
const boundCreateRuleConfig = this.createRuleConfig.bind(this);
|
|
2078
|
+
function makeParser(typeAware, files2, ignores = []) {
|
|
2079
|
+
return boundCreateRuleConfig(typeAware ? "parser-type-aware" : "parser", {
|
|
2080
|
+
files: files2,
|
|
2081
|
+
ignores,
|
|
2082
|
+
languageOptions: {
|
|
2083
|
+
parser,
|
|
2084
|
+
parserOptions: {
|
|
2085
|
+
sourceType: "module",
|
|
2086
|
+
...typeAware ? {
|
|
2087
|
+
projectService: {
|
|
2088
|
+
allowDefaultProject: ["./*.js"],
|
|
2089
|
+
defaultProject: tsconfigPath
|
|
2090
|
+
},
|
|
2091
|
+
tsconfigRootDir: process.cwd()
|
|
2092
|
+
} : {},
|
|
2093
|
+
...parserOptions
|
|
2682
2094
|
}
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2095
|
+
}
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
return [
|
|
2099
|
+
this.createRuleConfig("setup", {
|
|
2100
|
+
plugins: {
|
|
2101
|
+
ts: plugin4
|
|
2102
|
+
}
|
|
2103
|
+
}),
|
|
2104
|
+
makeParser(false, files),
|
|
2105
|
+
...isTypeAware ? [makeParser(true, filesTypeAware, this.options.ignoresTypeAware)] : [],
|
|
2106
|
+
this.createRuleConfig("rules", {
|
|
2107
|
+
files,
|
|
2108
|
+
rules: {
|
|
2109
|
+
...renameRules(plugin4.configs["eslint-recommended"].overrides[0].rules, {
|
|
2110
|
+
"@typescript-eslint": "ts"
|
|
2111
|
+
}),
|
|
2112
|
+
...renameRules(plugin4.configs.strict.rules, {
|
|
2113
|
+
"@typescript-eslint": "ts"
|
|
2114
|
+
}),
|
|
2115
|
+
"no-dupe-class-members": ["off"],
|
|
2116
|
+
"no-redeclare": ["off"],
|
|
2117
|
+
"no-use-before-define": ["off"],
|
|
2118
|
+
"no-useless-constructor": ["off"],
|
|
2119
|
+
"ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
2120
|
+
"ts/consistent-type-definitions": ["error", "interface"],
|
|
2121
|
+
"ts/consistent-type-imports": [
|
|
2694
2122
|
"error",
|
|
2695
2123
|
{
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2124
|
+
disallowTypeAnnotations: false,
|
|
2125
|
+
fixStyle: "separate-type-imports",
|
|
2126
|
+
prefer: "type-imports"
|
|
2699
2127
|
}
|
|
2700
|
-
]
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2128
|
+
],
|
|
2129
|
+
// See: https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
2130
|
+
"ts/method-signature-style": ["error", "property"],
|
|
2131
|
+
"ts/no-dupe-class-members": ["error"],
|
|
2132
|
+
"ts/no-dynamic-delete": ["off"],
|
|
2133
|
+
"ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
|
|
2134
|
+
"ts/no-explicit-any": ["warn"],
|
|
2135
|
+
"ts/no-extraneous-class": ["off"],
|
|
2136
|
+
"ts/no-import-type-side-effects": ["error"],
|
|
2137
|
+
"ts/no-invalid-void-type": ["error"],
|
|
2138
|
+
"ts/no-non-null-assertion": ["error"],
|
|
2139
|
+
"ts/no-redeclare": ["error", { builtinGlobals: false }],
|
|
2140
|
+
"ts/no-require-imports": ["error"],
|
|
2141
|
+
"ts/no-unused-expressions": [
|
|
2142
|
+
"error",
|
|
2143
|
+
{
|
|
2144
|
+
allowShortCircuit: true,
|
|
2145
|
+
allowTaggedTemplates: true,
|
|
2146
|
+
allowTernary: true
|
|
2147
|
+
}
|
|
2148
|
+
],
|
|
2149
|
+
"ts/no-unused-vars": "off",
|
|
2150
|
+
"ts/no-use-before-define": [
|
|
2151
|
+
"error",
|
|
2152
|
+
{ classes: false, functions: false, variables: true }
|
|
2153
|
+
],
|
|
2154
|
+
"ts/no-useless-constructor": ["error"],
|
|
2155
|
+
"ts/no-wrapper-object-types": ["error"],
|
|
2156
|
+
"ts/triple-slash-reference": ["off"],
|
|
2157
|
+
"ts/unified-signatures": ["off"],
|
|
2158
|
+
...this.options.type === "lib" ? {
|
|
2159
|
+
"ts/explicit-function-return-type": [
|
|
2160
|
+
"error",
|
|
2161
|
+
{
|
|
2162
|
+
allowExpressions: true,
|
|
2163
|
+
allowHigherOrderFunctions: true,
|
|
2164
|
+
allowIIFEs: true
|
|
2165
|
+
}
|
|
2166
|
+
]
|
|
2167
|
+
} : {},
|
|
2168
|
+
...this.options.overrides
|
|
2713
2169
|
}
|
|
2714
|
-
}
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2170
|
+
}),
|
|
2171
|
+
...isTypeAware ? [
|
|
2172
|
+
this.createRuleConfig("rules-type-aware", {
|
|
2173
|
+
files: filesTypeAware,
|
|
2174
|
+
ignores: this.options.ignoresTypeAware,
|
|
2175
|
+
rules: {
|
|
2176
|
+
...typeAwareRules,
|
|
2177
|
+
...this.options.typeAwareOverrides
|
|
2178
|
+
}
|
|
2179
|
+
})
|
|
2180
|
+
] : []
|
|
2181
|
+
];
|
|
2182
|
+
}
|
|
2183
|
+
};
|
|
2718
2184
|
|
|
2719
2185
|
// src/configs/vue.ts
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
interopDefault(import("vue-eslint-parser")),
|
|
2732
|
-
interopDefault(import("eslint-processor-vue-blocks"))
|
|
2733
|
-
]);
|
|
2734
|
-
return [
|
|
2735
|
-
{
|
|
2736
|
-
name: `${NAMESPACE20}/setup`,
|
|
2737
|
-
plugins: {
|
|
2738
|
-
vue: pluginVue
|
|
2739
|
-
},
|
|
2740
|
-
languageOptions: {
|
|
2741
|
-
globals: {
|
|
2742
|
-
computed: "readonly",
|
|
2743
|
-
defineEmits: "readonly",
|
|
2744
|
-
defineExpose: "readonly",
|
|
2745
|
-
defineProps: "readonly",
|
|
2746
|
-
onMounted: "readonly",
|
|
2747
|
-
onUnmounted: "readonly",
|
|
2748
|
-
reactive: "readonly",
|
|
2749
|
-
ref: "readonly",
|
|
2750
|
-
shallowReactive: "readonly",
|
|
2751
|
-
shallowRef: "readonly",
|
|
2752
|
-
toRef: "readonly",
|
|
2753
|
-
toRefs: "readonly",
|
|
2754
|
-
watch: "readonly",
|
|
2755
|
-
watchEffect: "readonly"
|
|
2756
|
-
}
|
|
2757
|
-
}
|
|
2758
|
-
},
|
|
2759
|
-
{
|
|
2760
|
-
name: `${NAMESPACE20}/rules`,
|
|
2186
|
+
var VueConfig = class extends CustomConfig {
|
|
2187
|
+
namespace = "vue";
|
|
2188
|
+
constructor({
|
|
2189
|
+
files = [GLOB_VUE],
|
|
2190
|
+
typescript = true,
|
|
2191
|
+
vueVersion = 3,
|
|
2192
|
+
graphql = false,
|
|
2193
|
+
indent = STYLE_DEFAULTS.indent,
|
|
2194
|
+
...rest
|
|
2195
|
+
} = {}) {
|
|
2196
|
+
super({
|
|
2761
2197
|
files,
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
},
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
...pluginVue.configs["strongly-recommended"].rules,
|
|
2788
|
-
...pluginVue.configs.recommended.rules
|
|
2789
|
-
} : {
|
|
2790
|
-
...pluginVue.configs["vue3-essential"].rules,
|
|
2791
|
-
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
2792
|
-
...pluginVue.configs["vue3-recommended"].rules
|
|
2198
|
+
typescript,
|
|
2199
|
+
vueVersion,
|
|
2200
|
+
graphql,
|
|
2201
|
+
indent,
|
|
2202
|
+
...rest
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
async _rules() {
|
|
2206
|
+
const {
|
|
2207
|
+
files = [GLOB_VUE],
|
|
2208
|
+
overrides = {},
|
|
2209
|
+
typescript = true,
|
|
2210
|
+
vueVersion = 3,
|
|
2211
|
+
graphql = false,
|
|
2212
|
+
indent = STYLE_DEFAULTS.indent
|
|
2213
|
+
} = this.options;
|
|
2214
|
+
const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
|
|
2215
|
+
interopDefault(import("eslint-plugin-vue")),
|
|
2216
|
+
interopDefault(import("vue-eslint-parser")),
|
|
2217
|
+
interopDefault(import("eslint-processor-vue-blocks"))
|
|
2218
|
+
]);
|
|
2219
|
+
return [
|
|
2220
|
+
this.createRuleConfig("setup", {
|
|
2221
|
+
plugins: {
|
|
2222
|
+
vue: pluginVue
|
|
2793
2223
|
},
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
}
|
|
2811
|
-
],
|
|
2812
|
-
"vue/dot-location": ["error", "property"],
|
|
2813
|
-
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
2814
|
-
"vue/eqeqeq": ["error", "smart"],
|
|
2815
|
-
"vue/html-indent": ["error", indent],
|
|
2816
|
-
"vue/html-quotes": ["error", "double"],
|
|
2817
|
-
"vue/max-attributes-per-line": "off",
|
|
2818
|
-
"vue/multi-word-component-names": "off",
|
|
2819
|
-
"vue/no-dupe-keys": "off",
|
|
2820
|
-
"vue/no-empty-pattern": "error",
|
|
2821
|
-
"vue/no-irregular-whitespace": "error",
|
|
2822
|
-
"vue/no-loss-of-precision": "error",
|
|
2823
|
-
"vue/no-restricted-syntax": [
|
|
2824
|
-
"error",
|
|
2825
|
-
"DebuggerStatement",
|
|
2826
|
-
"LabeledStatement",
|
|
2827
|
-
"WithStatement"
|
|
2828
|
-
],
|
|
2829
|
-
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
2830
|
-
"vue/no-setup-props-reactivity-loss": "off",
|
|
2831
|
-
"vue/no-sparse-arrays": "error",
|
|
2832
|
-
"vue/no-unused-refs": "error",
|
|
2833
|
-
"vue/no-useless-v-bind": "error",
|
|
2834
|
-
"vue/no-v-html": "off",
|
|
2835
|
-
"vue/object-shorthand": [
|
|
2836
|
-
"error",
|
|
2837
|
-
"always",
|
|
2838
|
-
{
|
|
2839
|
-
avoidQuotes: true,
|
|
2840
|
-
ignoreConstructors: false
|
|
2841
|
-
}
|
|
2842
|
-
],
|
|
2843
|
-
"vue/prefer-separate-static-class": "error",
|
|
2844
|
-
"vue/prefer-template": "error",
|
|
2845
|
-
"vue/prop-name-casing": ["error", "camelCase"],
|
|
2846
|
-
"vue/require-default-prop": "off",
|
|
2847
|
-
"vue/require-prop-types": "off",
|
|
2848
|
-
"vue/space-infix-ops": "error",
|
|
2849
|
-
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
2850
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
|
2851
|
-
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
2852
|
-
"vue/block-spacing": ["error", "always"],
|
|
2853
|
-
"vue/block-tag-newline": [
|
|
2854
|
-
"error",
|
|
2855
|
-
{
|
|
2856
|
-
multiline: "always",
|
|
2857
|
-
singleline: "always"
|
|
2224
|
+
languageOptions: {
|
|
2225
|
+
globals: {
|
|
2226
|
+
computed: "readonly",
|
|
2227
|
+
defineEmits: "readonly",
|
|
2228
|
+
defineExpose: "readonly",
|
|
2229
|
+
defineProps: "readonly",
|
|
2230
|
+
onMounted: "readonly",
|
|
2231
|
+
onUnmounted: "readonly",
|
|
2232
|
+
reactive: "readonly",
|
|
2233
|
+
ref: "readonly",
|
|
2234
|
+
shallowReactive: "readonly",
|
|
2235
|
+
shallowRef: "readonly",
|
|
2236
|
+
toRef: "readonly",
|
|
2237
|
+
toRefs: "readonly",
|
|
2238
|
+
watch: "readonly",
|
|
2239
|
+
watchEffect: "readonly"
|
|
2858
2240
|
}
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2241
|
+
}
|
|
2242
|
+
}),
|
|
2243
|
+
this.createRuleConfig("rules", {
|
|
2244
|
+
files,
|
|
2245
|
+
languageOptions: {
|
|
2246
|
+
parser: parserVue,
|
|
2247
|
+
parserOptions: {
|
|
2248
|
+
ecmaFeatures: {
|
|
2249
|
+
jsx: true
|
|
2250
|
+
},
|
|
2251
|
+
extraFileExtensions: [".vue"],
|
|
2252
|
+
parser: typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
|
|
2253
|
+
sourceType: "module"
|
|
2869
2254
|
}
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2255
|
+
},
|
|
2256
|
+
processor: graphql === false ? pluginVue.processors[".vue"] : mergeProcessors([
|
|
2257
|
+
pluginVue.processors[".vue"],
|
|
2258
|
+
processorVueBlocks({
|
|
2259
|
+
blocks: {
|
|
2260
|
+
script: true,
|
|
2261
|
+
scriptSetup: true,
|
|
2262
|
+
customBlocks: true
|
|
2263
|
+
}
|
|
2264
|
+
})
|
|
2265
|
+
]),
|
|
2266
|
+
rules: {
|
|
2267
|
+
...pluginVue.configs.base.rules,
|
|
2268
|
+
...vueVersion === 2 ? {
|
|
2269
|
+
...pluginVue.configs.essential.rules,
|
|
2270
|
+
...pluginVue.configs["strongly-recommended"].rules,
|
|
2271
|
+
...pluginVue.configs.recommended.rules
|
|
2272
|
+
} : {
|
|
2273
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
2274
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
2275
|
+
...pluginVue.configs["vue3-recommended"].rules
|
|
2276
|
+
},
|
|
2277
|
+
"node/prefer-global/process": "off",
|
|
2278
|
+
"ts/explicit-function-return-type": "off",
|
|
2279
|
+
"vue/block-order": [
|
|
2280
|
+
"error",
|
|
2281
|
+
{
|
|
2282
|
+
order: ["script", "template", "style"]
|
|
2283
|
+
}
|
|
2284
|
+
],
|
|
2285
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
2286
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
2287
|
+
"vue/component-tags-order": "off",
|
|
2288
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
2289
|
+
"vue/define-macros-order": [
|
|
2290
|
+
"error",
|
|
2291
|
+
{
|
|
2292
|
+
order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
|
|
2293
|
+
}
|
|
2294
|
+
],
|
|
2295
|
+
"vue/dot-location": ["error", "property"],
|
|
2296
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
2297
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
2298
|
+
"vue/html-indent": ["error", indent],
|
|
2299
|
+
"vue/html-quotes": ["error", "double"],
|
|
2300
|
+
"vue/max-attributes-per-line": "off",
|
|
2301
|
+
"vue/multi-word-component-names": "off",
|
|
2302
|
+
"vue/no-dupe-keys": "off",
|
|
2303
|
+
"vue/no-empty-pattern": "error",
|
|
2304
|
+
"vue/no-irregular-whitespace": "error",
|
|
2305
|
+
"vue/no-loss-of-precision": "error",
|
|
2306
|
+
"vue/no-restricted-syntax": [
|
|
2307
|
+
"error",
|
|
2308
|
+
"DebuggerStatement",
|
|
2309
|
+
"LabeledStatement",
|
|
2310
|
+
"WithStatement"
|
|
2311
|
+
],
|
|
2312
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
2313
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
2314
|
+
"vue/no-sparse-arrays": "error",
|
|
2315
|
+
"vue/no-unused-refs": "error",
|
|
2316
|
+
"vue/no-useless-v-bind": "error",
|
|
2317
|
+
"vue/no-v-html": "off",
|
|
2318
|
+
"vue/object-shorthand": [
|
|
2319
|
+
"error",
|
|
2320
|
+
"always",
|
|
2321
|
+
{
|
|
2322
|
+
avoidQuotes: true,
|
|
2323
|
+
ignoreConstructors: false
|
|
2324
|
+
}
|
|
2325
|
+
],
|
|
2326
|
+
"vue/prefer-separate-static-class": "error",
|
|
2327
|
+
"vue/prefer-template": "error",
|
|
2328
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
2329
|
+
"vue/require-default-prop": "off",
|
|
2330
|
+
"vue/require-prop-types": "off",
|
|
2331
|
+
"vue/space-infix-ops": "error",
|
|
2332
|
+
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
2333
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
2334
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
2335
|
+
"vue/block-spacing": ["error", "always"],
|
|
2336
|
+
"vue/block-tag-newline": [
|
|
2337
|
+
"error",
|
|
2338
|
+
{
|
|
2339
|
+
multiline: "always",
|
|
2340
|
+
singleline: "always"
|
|
2341
|
+
}
|
|
2342
|
+
],
|
|
2343
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
2344
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
2345
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
2346
|
+
"vue/comma-style": ["error", "last"],
|
|
2347
|
+
"vue/html-comment-content-spacing": [
|
|
2348
|
+
"error",
|
|
2349
|
+
"always",
|
|
2350
|
+
{
|
|
2351
|
+
exceptions: ["-"]
|
|
2352
|
+
}
|
|
2353
|
+
],
|
|
2354
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
2355
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
2356
|
+
"vue/object-curly-newline": "off",
|
|
2357
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
2358
|
+
"vue/object-property-newline": [
|
|
2359
|
+
"error",
|
|
2360
|
+
{ allowMultiplePropertiesPerLine: true }
|
|
2361
|
+
],
|
|
2362
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
2363
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
2364
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
2365
|
+
"vue/space-in-parens": ["error", "never"],
|
|
2366
|
+
"vue/template-curly-spacing": "error",
|
|
2367
|
+
...overrides
|
|
2368
|
+
}
|
|
2369
|
+
})
|
|
2370
|
+
];
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2889
2373
|
|
|
2890
2374
|
// src/configs/yaml.ts
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
{
|
|
2900
|
-
name: `${NAMESPACE21}/setup`,
|
|
2901
|
-
plugins: {
|
|
2902
|
-
yaml: plugin4
|
|
2903
|
-
}
|
|
2904
|
-
},
|
|
2905
|
-
{
|
|
2906
|
-
name: `${NAMESPACE21}/rules`,
|
|
2375
|
+
var YamlConfig = class extends CustomConfig {
|
|
2376
|
+
namespace = "yaml";
|
|
2377
|
+
constructor({
|
|
2378
|
+
files = [GLOB_YAML],
|
|
2379
|
+
indent = STYLE_DEFAULTS.indent,
|
|
2380
|
+
quotes = STYLE_DEFAULTS.quotes,
|
|
2381
|
+
...rest
|
|
2382
|
+
} = {}) {
|
|
2383
|
+
super({
|
|
2907
2384
|
files,
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2385
|
+
indent,
|
|
2386
|
+
quotes,
|
|
2387
|
+
...rest
|
|
2388
|
+
});
|
|
2389
|
+
}
|
|
2390
|
+
async _rules() {
|
|
2391
|
+
const {
|
|
2392
|
+
files = [GLOB_YAML],
|
|
2393
|
+
overrides = {},
|
|
2394
|
+
indent = STYLE_DEFAULTS.indent,
|
|
2395
|
+
quotes = STYLE_DEFAULTS.quotes,
|
|
2396
|
+
sortKeys = []
|
|
2397
|
+
} = this.options;
|
|
2398
|
+
const [plugin4, parser] = await Promise.all([
|
|
2399
|
+
interopDefault(import("eslint-plugin-yml")),
|
|
2400
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
2401
|
+
]);
|
|
2402
|
+
return [
|
|
2403
|
+
this.createRuleConfig("setup", {
|
|
2404
|
+
plugins: {
|
|
2405
|
+
yaml: plugin4
|
|
2406
|
+
}
|
|
2407
|
+
}),
|
|
2408
|
+
this.createRuleConfig("rules", {
|
|
2409
|
+
files,
|
|
2410
|
+
languageOptions: {
|
|
2411
|
+
parser
|
|
2412
|
+
},
|
|
2413
|
+
rules: {
|
|
2414
|
+
"style/spaced-comment": "off",
|
|
2415
|
+
"yaml/block-mapping-colon-indicator-newline": "error",
|
|
2416
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
2417
|
+
"yaml/block-mapping": "error",
|
|
2418
|
+
"yaml/block-sequence": "error",
|
|
2419
|
+
"yaml/no-empty-key": "error",
|
|
2420
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
2421
|
+
"yaml/no-irregular-whitespace": "error",
|
|
2422
|
+
"yaml/plain-scalar": "error",
|
|
2423
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
2424
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
2425
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
2426
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
2427
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
2428
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
2429
|
+
"yaml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
2430
|
+
"yaml/key-spacing": "error",
|
|
2431
|
+
"yaml/no-tab-indent": "error",
|
|
2432
|
+
"yaml/quotes": [
|
|
2433
|
+
"error",
|
|
2434
|
+
{
|
|
2435
|
+
avoidEscape: true,
|
|
2436
|
+
prefer: quotes === "backtick" ? "single" : quotes
|
|
2437
|
+
}
|
|
2438
|
+
],
|
|
2439
|
+
"yaml/spaced-comment": "error",
|
|
2440
|
+
"yaml/no-empty-document": "error",
|
|
2441
|
+
"yaml/no-empty-mapping-value": "error",
|
|
2442
|
+
"yaml/no-trailing-zeros": "error",
|
|
2443
|
+
"yaml/no-multiple-empty-lines": "error",
|
|
2444
|
+
...overrides
|
|
2445
|
+
}
|
|
2446
|
+
}),
|
|
2447
|
+
...sortKeys.length > 0 ? [
|
|
2448
|
+
this.createRuleConfig("sort-keys", {
|
|
2449
|
+
files: sortKeys,
|
|
2450
|
+
languageOptions: {
|
|
2451
|
+
parser
|
|
2452
|
+
},
|
|
2453
|
+
rules: {
|
|
2454
|
+
"yaml/sort-keys": [
|
|
2455
|
+
"error",
|
|
2456
|
+
"asc",
|
|
2457
|
+
{ allowLineSeparatedGroups: true, natural: true }
|
|
2458
|
+
]
|
|
2935
2459
|
}
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
"yaml/no-multiple-empty-lines": "error",
|
|
2942
|
-
...overrides
|
|
2943
|
-
}
|
|
2944
|
-
}
|
|
2945
|
-
];
|
|
2946
|
-
}
|
|
2460
|
+
})
|
|
2461
|
+
] : []
|
|
2462
|
+
];
|
|
2463
|
+
}
|
|
2464
|
+
};
|
|
2947
2465
|
|
|
2948
2466
|
// src/factory.ts
|
|
2949
2467
|
async function exbotanical({
|
|
@@ -2960,55 +2478,96 @@ async function exbotanical({
|
|
|
2960
2478
|
react: optionsReact,
|
|
2961
2479
|
vue: optionsVue,
|
|
2962
2480
|
graphql: optionsGraphql,
|
|
2481
|
+
packageJson: optionsPackageJson = false,
|
|
2482
|
+
jsonSchema: optionsJsonSchema = false,
|
|
2483
|
+
githubAction: optionsGithubAction = false,
|
|
2484
|
+
css: optionsCss = false,
|
|
2485
|
+
perfectionist: optionsPerfectionist,
|
|
2963
2486
|
type
|
|
2964
|
-
}, ...userConfigs) {
|
|
2487
|
+
} = {}, ...userConfigs) {
|
|
2965
2488
|
const configs2 = [
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2489
|
+
new PerfectionistConfig({ ...optionsPerfectionist }).rules(),
|
|
2490
|
+
new UnicornConfig().rules(),
|
|
2491
|
+
new CommentsConfig().rules(),
|
|
2492
|
+
new ImportsConfig().rules(),
|
|
2493
|
+
new JavascriptConfig({ ...optionsJavascript, type }).rules(),
|
|
2494
|
+
new JsdocConfig().rules(),
|
|
2495
|
+
new JsxConfig().rules(),
|
|
2496
|
+
new NodeConfig().rules(),
|
|
2497
|
+
new RegexprConfig().rules(),
|
|
2498
|
+
new TestConfig({ ...factoryConfig(optionsTest) }).rules()
|
|
2976
2499
|
];
|
|
2977
2500
|
if (optionsJsonc) {
|
|
2978
2501
|
configs2.push(
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2502
|
+
...optionsPackageJson ? [] : [new PackageJsonConfig().rules()],
|
|
2503
|
+
new TsconfigConfig().rules(),
|
|
2504
|
+
new JsoncConfig({
|
|
2982
2505
|
...factoryConfig(optionsJsonc),
|
|
2983
2506
|
...optionsStyle
|
|
2984
|
-
})
|
|
2507
|
+
}).rules()
|
|
2508
|
+
);
|
|
2509
|
+
}
|
|
2510
|
+
if (optionsPackageJson) {
|
|
2511
|
+
configs2.push(
|
|
2512
|
+
new PackageJsonPluginConfig({ ...factoryConfig(optionsPackageJson) }).rules()
|
|
2513
|
+
);
|
|
2514
|
+
}
|
|
2515
|
+
if (optionsJsonSchema) {
|
|
2516
|
+
configs2.push(new JsonSchemaConfig({ ...factoryConfig(optionsJsonSchema) }).rules());
|
|
2517
|
+
}
|
|
2518
|
+
if (optionsGithubAction) {
|
|
2519
|
+
configs2.push(
|
|
2520
|
+
new GithubActionConfig({ ...factoryConfig(optionsGithubAction) }).rules()
|
|
2985
2521
|
);
|
|
2986
2522
|
}
|
|
2523
|
+
if (optionsCss) {
|
|
2524
|
+
configs2.push(new CssConfig({ ...factoryConfig(optionsCss) }).rules());
|
|
2525
|
+
}
|
|
2987
2526
|
if (optionsMarkdown) {
|
|
2988
|
-
configs2.push(
|
|
2527
|
+
configs2.push(new MarkdownConfig({ ...factoryConfig(optionsMarkdown) }).rules());
|
|
2989
2528
|
}
|
|
2990
2529
|
if (optionsGraphql) {
|
|
2991
|
-
configs2.push(
|
|
2530
|
+
configs2.push(new GraphqlConfig().rules());
|
|
2992
2531
|
}
|
|
2993
2532
|
if (optionsReact) {
|
|
2994
|
-
configs2.push(
|
|
2533
|
+
configs2.push(new ReactConfig({ ...factoryConfig(optionsReact) }).rules());
|
|
2995
2534
|
}
|
|
2996
2535
|
if (optionsToml) {
|
|
2997
|
-
configs2.push(
|
|
2536
|
+
configs2.push(
|
|
2537
|
+
new TomlConfig({ ...factoryConfig(optionsToml), ...optionsStyle }).rules()
|
|
2538
|
+
);
|
|
2998
2539
|
}
|
|
2999
2540
|
if (optionsTypescript) {
|
|
3000
|
-
configs2.push(
|
|
2541
|
+
configs2.push(
|
|
2542
|
+
new TypescriptConfig({ ...factoryConfig(optionsTypescript), type }).rules()
|
|
2543
|
+
);
|
|
3001
2544
|
}
|
|
3002
2545
|
if (optionsVue) {
|
|
3003
|
-
configs2.push(
|
|
2546
|
+
configs2.push(
|
|
2547
|
+
new VueConfig({ ...factoryConfig(optionsVue), graphql: !!optionsGraphql }).rules()
|
|
2548
|
+
);
|
|
3004
2549
|
}
|
|
3005
2550
|
if (optionsYaml) {
|
|
3006
|
-
configs2.push(
|
|
2551
|
+
configs2.push(
|
|
2552
|
+
new YamlConfig({ ...factoryConfig(optionsYaml), ...optionsStyle }).rules()
|
|
2553
|
+
);
|
|
3007
2554
|
}
|
|
2555
|
+
configs2.push(
|
|
2556
|
+
new DataFilesConfig({
|
|
2557
|
+
files: [
|
|
2558
|
+
...optionsJsonc ? [GLOB_JSON, GLOB_JSON5, GLOB_JSONC] : [],
|
|
2559
|
+
...optionsYaml ? [GLOB_YAML] : [],
|
|
2560
|
+
...optionsToml ? [GLOB_TOML] : []
|
|
2561
|
+
]
|
|
2562
|
+
}).rules()
|
|
2563
|
+
);
|
|
3008
2564
|
if (formatter) {
|
|
3009
|
-
configs2.push(
|
|
2565
|
+
configs2.push(new PrettierConfig().rules());
|
|
3010
2566
|
}
|
|
3011
|
-
configs2.push(
|
|
2567
|
+
configs2.push(
|
|
2568
|
+
new DisablesConfig().rules(),
|
|
2569
|
+
new IgnoresConfig({ files: optionsIgnore }).rules()
|
|
2570
|
+
);
|
|
3012
2571
|
if (userConfigs.length > 0) {
|
|
3013
2572
|
const resolved2 = await Promise.all(userConfigs);
|
|
3014
2573
|
configs2.push(...resolved2.map((r) => Promise.resolve(Array.isArray(r) ? r : [r])));
|
|
@@ -3020,15 +2579,10 @@ function factoryConfig(options) {
|
|
|
3020
2579
|
if (!options) return {};
|
|
3021
2580
|
return typeof options === "boolean" ? {} : options;
|
|
3022
2581
|
}
|
|
3023
|
-
|
|
3024
|
-
// src/options.ts
|
|
3025
|
-
init_esm_shims();
|
|
3026
|
-
|
|
3027
|
-
// src/types.ts
|
|
3028
|
-
init_esm_shims();
|
|
3029
2582
|
export {
|
|
3030
2583
|
GLOB_CSS,
|
|
3031
2584
|
GLOB_EXCLUDES,
|
|
2585
|
+
GLOB_GITHUB_WORKFLOW,
|
|
3032
2586
|
GLOB_GRAPHQL,
|
|
3033
2587
|
GLOB_HTML,
|
|
3034
2588
|
GLOB_JS,
|
|
@@ -3040,6 +2594,7 @@ export {
|
|
|
3040
2594
|
GLOB_MARKDOWN,
|
|
3041
2595
|
GLOB_MARKDOWN_CODE,
|
|
3042
2596
|
GLOB_POSTCSS,
|
|
2597
|
+
GLOB_SCRIPTS,
|
|
3043
2598
|
GLOB_SCSS,
|
|
3044
2599
|
GLOB_SRC,
|
|
3045
2600
|
GLOB_SRC_EXT,
|