@borela-tech/eslint-config 2.4.2 → 2.5.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/.gitattributes +2 -0
- package/dist/index.cjs.js +4738 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.esm.js +4729 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +8 -5
- package/.github/workflows/ci.yml +0 -82
- package/dist/index.mjs +0 -3928
- package/dist/index.mjs.map +0 -1
- package/jest.config.ts +0 -14
- package/vite.config.ts +0 -40
|
@@ -0,0 +1,4729 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import react from "eslint-plugin-react";
|
|
3
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
4
|
+
import typescript from "typescript-eslint";
|
|
5
|
+
import * as path from "path";
|
|
6
|
+
import perfectionist from "eslint-plugin-perfectionist";
|
|
7
|
+
import rule from "eslint-plugin-react-hooks";
|
|
8
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
9
|
+
//#region \0rolldown/runtime.js
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
|
+
var __exportAll = (all, no_symbols) => {
|
|
19
|
+
let target = {};
|
|
20
|
+
for (var name in all) __defProp(target, name, {
|
|
21
|
+
get: all[name],
|
|
22
|
+
enumerable: true
|
|
23
|
+
});
|
|
24
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
|
+
return target;
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
29
|
+
key = keys[i];
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
31
|
+
get: ((k) => from[k]).bind(null, key),
|
|
32
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
38
|
+
value: mod,
|
|
39
|
+
enumerable: true
|
|
40
|
+
}) : target, mod));
|
|
41
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/rules/shared/getLineIndent.ts
|
|
44
|
+
function getLineIndent(sourceCode, line) {
|
|
45
|
+
return (sourceCode.getText().split("\n")[line - 1] ?? "").match(/^(\s*)/)?.[1] ?? "";
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/rules/arrayItemsLineBreak/buildMultilineFix.ts
|
|
49
|
+
function buildMultilineFix$1(fixer, brackets, elements, sourceCode) {
|
|
50
|
+
const openingLine = brackets.openingBracket.loc.start.line;
|
|
51
|
+
const baseIndent = getLineIndent(sourceCode, openingLine);
|
|
52
|
+
const itemIndent = baseIndent + " ";
|
|
53
|
+
const newText = `\n${elements.filter((el) => el !== null).map((element) => {
|
|
54
|
+
return `${itemIndent}${sourceCode.getText(element)}`;
|
|
55
|
+
}).join(",\n")},\n${baseIndent}`;
|
|
56
|
+
return fixer.replaceTextRange([brackets.openingBracket.range[1], brackets.closingBracket.range[0]], newText);
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/rules/arrayItemsLineBreak/defaultOptions.ts
|
|
60
|
+
var defaultOptions$6 = { maxLength: 80 };
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/rules/arrayItemsLineBreak/getBrackets.ts
|
|
63
|
+
function getBrackets(sourceCode, node) {
|
|
64
|
+
const elements = node.elements;
|
|
65
|
+
if (elements.length === 0) return null;
|
|
66
|
+
const firstElement = elements.find((el) => el !== null);
|
|
67
|
+
if (!firstElement) return null;
|
|
68
|
+
const lastElement = [...elements].reverse().find((el) => el !== null);
|
|
69
|
+
if (!lastElement) return null;
|
|
70
|
+
const openingBracket = sourceCode.getTokenBefore(firstElement);
|
|
71
|
+
const closingBracket = sourceCode.getTokenAfter(lastElement);
|
|
72
|
+
if (!openingBracket || !closingBracket) return null;
|
|
73
|
+
if (openingBracket.value !== "[" || closingBracket.value !== "]") return null;
|
|
74
|
+
return {
|
|
75
|
+
closingBracket,
|
|
76
|
+
openingBracket
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/rules/shared/getLineLength.ts
|
|
81
|
+
function getLineLength(sourceCode, lineNumber) {
|
|
82
|
+
return sourceCode.getLines()[lineNumber - 1]?.length ?? 0;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/rules/arrayItemsLineBreak/checkArray.ts
|
|
86
|
+
function checkArray(sourceCode, context, node) {
|
|
87
|
+
const maxLength = (context.options[0] ?? {}).maxLength ?? defaultOptions$6.maxLength;
|
|
88
|
+
const elements = node.elements;
|
|
89
|
+
if (elements.length <= 1) return;
|
|
90
|
+
const brackets = getBrackets(sourceCode, node);
|
|
91
|
+
if (!brackets) return;
|
|
92
|
+
const firstLine = brackets.openingBracket.loc.start.line;
|
|
93
|
+
if (firstLine !== brackets.closingBracket.loc.end.line) return;
|
|
94
|
+
if (getLineLength(sourceCode, firstLine) <= maxLength) return;
|
|
95
|
+
context.report({
|
|
96
|
+
fix: (fixer) => buildMultilineFix$1(fixer, brackets, elements, sourceCode),
|
|
97
|
+
messageId: "arrayItemsOnNewLine",
|
|
98
|
+
node: elements[0]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/rules/arrayItemsLineBreak/index.ts
|
|
103
|
+
var arrayItemsLineBreak = {
|
|
104
|
+
create(context) {
|
|
105
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
106
|
+
return { ArrayExpression(node) {
|
|
107
|
+
checkArray(sourceCode, context, node);
|
|
108
|
+
} };
|
|
109
|
+
},
|
|
110
|
+
meta: {
|
|
111
|
+
docs: { description: "Enforce each array item to be on its own line when the array expression exceeds a configurable maximum line length." },
|
|
112
|
+
fixable: "code",
|
|
113
|
+
messages: { arrayItemsOnNewLine: "arrayItemsOnNewLine" },
|
|
114
|
+
schema: [{
|
|
115
|
+
additionalProperties: false,
|
|
116
|
+
properties: { maxLength: { type: "number" } },
|
|
117
|
+
type: "object"
|
|
118
|
+
}],
|
|
119
|
+
type: "layout"
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/rules/braceStyleControlStatements/getIndentation.ts
|
|
124
|
+
function getIndentation(node, sourceCode) {
|
|
125
|
+
const tokenBeforeBody = sourceCode.getTokenBefore(node);
|
|
126
|
+
if (!tokenBeforeBody) return "";
|
|
127
|
+
const line = sourceCode.getText().split("\n")[tokenBeforeBody.loc.start.line - 1];
|
|
128
|
+
if (!line) return "";
|
|
129
|
+
return line.match(/^(\s*)/)?.[1] ?? "";
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/rules/braceStyleControlStatements/createBraceStyleFix.ts
|
|
133
|
+
function createBraceStyleFix(fixer, body, sourceCode) {
|
|
134
|
+
if (body.type === "BlockStatement") {
|
|
135
|
+
const firstToken = sourceCode.getFirstToken(body);
|
|
136
|
+
if (!firstToken) return null;
|
|
137
|
+
return fixer.insertTextBefore(firstToken, "\n");
|
|
138
|
+
}
|
|
139
|
+
const bodyText = sourceCode.getText(body);
|
|
140
|
+
const indentation = getIndentation(body, sourceCode);
|
|
141
|
+
const fixedText = `{\n${indentation} ${bodyText}\n${indentation}}`;
|
|
142
|
+
return fixer.replaceText(body, fixedText);
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/rules/braceStyleControlStatements/isOnSameLineAsCondition.ts
|
|
146
|
+
function isOnSameLineAsCondition(node, sourceCode) {
|
|
147
|
+
const tokenBeforeBody = sourceCode.getTokenBefore(node);
|
|
148
|
+
if (!tokenBeforeBody) return false;
|
|
149
|
+
const firstToken = sourceCode.getFirstToken(node);
|
|
150
|
+
if (!firstToken) return false;
|
|
151
|
+
return tokenBeforeBody.loc.end.line === firstToken.loc.start.line;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/rules/shared/isSingleLineStatement.ts
|
|
155
|
+
function isSingleLineStatement(node, sourceCode) {
|
|
156
|
+
const firstToken = sourceCode.getFirstToken(node);
|
|
157
|
+
const lastToken = sourceCode.getLastToken(node);
|
|
158
|
+
if (!firstToken || !lastToken) return false;
|
|
159
|
+
return firstToken.loc.start.line === lastToken.loc.end.line;
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/rules/braceStyleControlStatements/reportBodyOnSameLineAsCondition.ts
|
|
163
|
+
function reportBodyOnSameLineAsCondition(context, body) {
|
|
164
|
+
const sourceCode = context.sourceCode;
|
|
165
|
+
if (body.type !== "BlockStatement") {
|
|
166
|
+
if (isOnSameLineAsCondition(body, sourceCode)) context.report({
|
|
167
|
+
fix: (fixer) => createBraceStyleFix(fixer, body, sourceCode),
|
|
168
|
+
messageId: "singleLine",
|
|
169
|
+
node: body
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
172
|
+
const isOnSameLine = isOnSameLineAsCondition(body, sourceCode);
|
|
173
|
+
const isSingleLine = isSingleLineStatement(body, sourceCode);
|
|
174
|
+
if (isOnSameLine && isSingleLine) context.report({
|
|
175
|
+
fix: (fixer) => createBraceStyleFix(fixer, body, sourceCode),
|
|
176
|
+
messageId: "singleLine",
|
|
177
|
+
node: body
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/rules/braceStyleControlStatements/checkDoWhileStatementBraceStyle.ts
|
|
183
|
+
function checkDoWhileStatementBraceStyle(node, context) {
|
|
184
|
+
reportBodyOnSameLineAsCondition(context, node.body);
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/rules/braceStyleControlStatements/checkForStatementBraceStyle.ts
|
|
188
|
+
function checkForStatementBraceStyle(node, context) {
|
|
189
|
+
reportBodyOnSameLineAsCondition(context, node.body);
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/rules/braceStyleControlStatements/checkIfStatementBraceStyle.ts
|
|
193
|
+
function checkIfStatementBraceStyle(node, context) {
|
|
194
|
+
const sourceCode = context.sourceCode;
|
|
195
|
+
reportBodyOnSameLineAsCondition(context, node.consequent);
|
|
196
|
+
if (!node.alternate) return;
|
|
197
|
+
if (node.alternate.type === "BlockStatement") {
|
|
198
|
+
reportBodyOnSameLineAsCondition(context, node.alternate);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (node.alternate.type !== "IfStatement") {
|
|
202
|
+
const alternate = node.alternate;
|
|
203
|
+
if (isOnSameLineAsCondition(alternate, sourceCode)) context.report({
|
|
204
|
+
fix: (fixer) => createBraceStyleFix(fixer, alternate, sourceCode),
|
|
205
|
+
messageId: "singleLine",
|
|
206
|
+
node: alternate
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/rules/braceStyleControlStatements/checkWhileStatementBraceStyle.ts
|
|
212
|
+
function checkWhileStatementBraceStyle(node, context) {
|
|
213
|
+
reportBodyOnSameLineAsCondition(context, node.body);
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/rules/braceStyleControlStatements/index.ts
|
|
217
|
+
var braceStyleControlStatements = {
|
|
218
|
+
create(context) {
|
|
219
|
+
return {
|
|
220
|
+
DoWhileStatement: (node) => checkDoWhileStatementBraceStyle(node, context),
|
|
221
|
+
ForStatement: (node) => checkForStatementBraceStyle(node, context),
|
|
222
|
+
IfStatement: (node) => checkIfStatementBraceStyle(node, context),
|
|
223
|
+
WhileStatement: (node) => checkWhileStatementBraceStyle(node, context)
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
meta: {
|
|
227
|
+
docs: { description: "Enforce control statements to have multi-line body." },
|
|
228
|
+
fixable: "code",
|
|
229
|
+
messages: { singleLine: "Control statement body must be on a separate line" },
|
|
230
|
+
schema: [],
|
|
231
|
+
type: "layout"
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/rules/braceStyleObjectLiteral/checkClosingBrace.ts
|
|
236
|
+
function checkClosingBrace(sourceCode, context, node, closingBrace) {
|
|
237
|
+
const lastProperty = node.properties[node.properties.length - 1];
|
|
238
|
+
const closingLine = closingBrace.loc.end.line;
|
|
239
|
+
if (!(lastProperty.loc.end.line < closingLine)) context.report({
|
|
240
|
+
fix(fixer) {
|
|
241
|
+
return fixer.replaceTextRange([lastProperty.range[1], closingBrace.range[0]], ",\n" + getLineIndent(sourceCode, lastProperty.loc.end.line));
|
|
242
|
+
},
|
|
243
|
+
loc: closingBrace.loc,
|
|
244
|
+
messageId: "braceOnPropertyLine"
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/rules/braceStyleObjectLiteral/checkNestedObjects.ts
|
|
249
|
+
function checkNestedObjects(sourceCode, context, node, checkObjectExpression) {
|
|
250
|
+
for (const property of node.properties) if (property.type === "Property" && property.value.type === "ObjectExpression") checkObjectExpression(sourceCode, context, property.value);
|
|
251
|
+
else if (property.type === "SpreadElement" && property.argument.type === "ObjectExpression") checkObjectExpression(sourceCode, context, property.argument);
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/rules/braceStyleObjectLiteral/checkOpeningBrace.ts
|
|
255
|
+
function checkOpeningBrace(sourceCode, context, node, openingBrace) {
|
|
256
|
+
const firstProperty = node.properties[0];
|
|
257
|
+
const openingLine = openingBrace.loc.start.line;
|
|
258
|
+
if (!(firstProperty.loc.start.line > openingLine)) context.report({
|
|
259
|
+
fix(fixer) {
|
|
260
|
+
return fixer.replaceTextRange([openingBrace.range[1], firstProperty.range[0]], "\n" + getLineIndent(sourceCode, firstProperty.loc.start.line));
|
|
261
|
+
},
|
|
262
|
+
loc: openingBrace.loc,
|
|
263
|
+
messageId: "braceOnPropertyLine"
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/rules/braceStyleObjectLiteral/checkPropertyOnOwnLine.ts
|
|
268
|
+
function checkPropertyOnOwnLine(sourceCode, context, prevPropertyEndLine, property) {
|
|
269
|
+
if (property.loc.start.line === prevPropertyEndLine) context.report({
|
|
270
|
+
fix(fixer) {
|
|
271
|
+
const lastNewLineIndex = sourceCode.getText().lastIndexOf("\n", property.range[0] - 1);
|
|
272
|
+
return fixer.replaceTextRange([lastNewLineIndex, property.range[0]], "\n" + getLineIndent(sourceCode, property.loc.start.line));
|
|
273
|
+
},
|
|
274
|
+
loc: property.loc,
|
|
275
|
+
messageId: "propertiesOnSameLine"
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/rules/braceStyleObjectLiteral/checkObjectExpression.ts
|
|
280
|
+
function checkObjectExpression(sourceCode, context, node) {
|
|
281
|
+
if (node.properties.length === 0) return;
|
|
282
|
+
const openingBrace = sourceCode.getFirstToken(node);
|
|
283
|
+
const closingBrace = sourceCode.getLastToken(node);
|
|
284
|
+
if (!openingBrace || !closingBrace) return;
|
|
285
|
+
if (openingBrace.loc.start.line === closingBrace.loc.end.line) return;
|
|
286
|
+
checkOpeningBrace(sourceCode, context, node, openingBrace);
|
|
287
|
+
let prevPropertyEndLine = node.properties[0].loc.start.line;
|
|
288
|
+
for (const property of node.properties) {
|
|
289
|
+
if (property !== node.properties[0]) checkPropertyOnOwnLine(sourceCode, context, prevPropertyEndLine, property);
|
|
290
|
+
prevPropertyEndLine = property.loc.end.line;
|
|
291
|
+
}
|
|
292
|
+
checkClosingBrace(sourceCode, context, node, closingBrace);
|
|
293
|
+
checkNestedObjects(sourceCode, context, node, checkObjectExpression);
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/rules/braceStyleObjectLiteral/index.ts
|
|
297
|
+
var braceStyleObjectLiteral = {
|
|
298
|
+
create(context) {
|
|
299
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
300
|
+
return { ObjectExpression(node) {
|
|
301
|
+
checkObjectExpression(sourceCode, context, node);
|
|
302
|
+
} };
|
|
303
|
+
},
|
|
304
|
+
meta: {
|
|
305
|
+
docs: { description: "Enforce consistent brace positioning for object literals." },
|
|
306
|
+
fixable: "code",
|
|
307
|
+
messages: {
|
|
308
|
+
braceOnPropertyLine: "Opening brace should be on its own line",
|
|
309
|
+
propertiesOnSameLine: "Multi-line objects must have each property on its own line"
|
|
310
|
+
},
|
|
311
|
+
schema: [{
|
|
312
|
+
additionalProperties: false,
|
|
313
|
+
properties: {},
|
|
314
|
+
type: "object"
|
|
315
|
+
}],
|
|
316
|
+
type: "layout"
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/rules/compactArrayItems/buildCompactFix.ts
|
|
321
|
+
function buildCompactFix(fixer, openingBracket, closingBracket, elements, sourceCode) {
|
|
322
|
+
const newText = `[${elements.filter((el) => el !== null).map((element) => sourceCode.getText(element)).join(", ")}]`;
|
|
323
|
+
return fixer.replaceTextRange([openingBracket.range[0], closingBracket.range[1]], newText);
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/rules/compactArrayItems/findBracketByRange.ts
|
|
327
|
+
function findBracketByRange(tokens, range, value) {
|
|
328
|
+
return tokens?.find((t) => t.range[0] === range[0] && t.value === value);
|
|
329
|
+
}
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/rules/compactArrayItems/findClosingBracketByRange.ts
|
|
332
|
+
function findClosingBracketByRange(tokens, range) {
|
|
333
|
+
return tokens?.find((t) => t.range[1] === range[1] && t.value === "]");
|
|
334
|
+
}
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/rules/compactArrayItems/hasElements.ts
|
|
337
|
+
function hasElements(elements) {
|
|
338
|
+
return elements.filter((el) => el !== null).length >= 1;
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/rules/compactArrayItems/hasMultilineItems.ts
|
|
342
|
+
function hasMultilineItems(nonNullElements) {
|
|
343
|
+
return nonNullElements.some((el) => el.loc.start.line !== el.loc.end.line);
|
|
344
|
+
}
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/rules/compactArrayItems/isBracketOnOwnLine.ts
|
|
347
|
+
function isBracketOnOwnLine(sourceCode, openingBracket) {
|
|
348
|
+
const nextToken = sourceCode.getTokenAfter(openingBracket, { includeComments: false });
|
|
349
|
+
if (!nextToken) return false;
|
|
350
|
+
const text = sourceCode.getText();
|
|
351
|
+
const openingBracketEndIndex = openingBracket.range[1];
|
|
352
|
+
return text.slice(openingBracketEndIndex, nextToken.range[0]).includes("\n");
|
|
353
|
+
}
|
|
354
|
+
//#endregion
|
|
355
|
+
//#region src/rules/compactArrayItems/index.ts
|
|
356
|
+
var compactArrayItems = {
|
|
357
|
+
create(context) {
|
|
358
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
359
|
+
return { ArrayExpression(node) {
|
|
360
|
+
if (!hasElements(node.elements)) return;
|
|
361
|
+
const tokens = sourceCode.ast.tokens;
|
|
362
|
+
const openingBracket = findBracketByRange(tokens, node.range, "[");
|
|
363
|
+
const closingBracket = findClosingBracketByRange(tokens, node.range);
|
|
364
|
+
if (!openingBracket || !closingBracket) return;
|
|
365
|
+
if (!isBracketOnOwnLine(sourceCode, openingBracket)) return;
|
|
366
|
+
if (!hasMultilineItems(node.elements.filter((el) => el !== null))) return;
|
|
367
|
+
context.report({
|
|
368
|
+
fix: (fixer) => buildCompactFix(fixer, openingBracket, closingBracket, node.elements, sourceCode),
|
|
369
|
+
messageId: "compactItems",
|
|
370
|
+
node
|
|
371
|
+
});
|
|
372
|
+
} };
|
|
373
|
+
},
|
|
374
|
+
meta: {
|
|
375
|
+
docs: { description: "Enforce arrays with multiline items to have a compact, inline bracket style." },
|
|
376
|
+
fixable: "code",
|
|
377
|
+
messages: { compactItems: "Array items should be compact when the array spans multiple lines." },
|
|
378
|
+
schema: [],
|
|
379
|
+
type: "layout"
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/rules/exportFilenameMatch/getNameFromDeclaration.ts
|
|
384
|
+
function getNameFromDeclaration(node) {
|
|
385
|
+
const names = [];
|
|
386
|
+
switch (node.type) {
|
|
387
|
+
case "ClassDeclaration":
|
|
388
|
+
if (node.id) names.push(node.id.name);
|
|
389
|
+
break;
|
|
390
|
+
case "FunctionDeclaration":
|
|
391
|
+
if (node.id) names.push(node.id.name);
|
|
392
|
+
break;
|
|
393
|
+
case "TSInterfaceDeclaration":
|
|
394
|
+
names.push(node.id.name);
|
|
395
|
+
break;
|
|
396
|
+
case "TSTypeAliasDeclaration":
|
|
397
|
+
names.push(node.id.name);
|
|
398
|
+
break;
|
|
399
|
+
case "VariableDeclaration":
|
|
400
|
+
for (const d of node.declarations) if (d.id.type === "Identifier") names.push(d.id.name);
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
return names;
|
|
404
|
+
}
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/rules/exportFilenameMatch/getNamesFromSpecifiers.ts
|
|
407
|
+
function getNamesFromSpecifiers(node) {
|
|
408
|
+
if (!node.specifiers?.length) return [];
|
|
409
|
+
const names = [];
|
|
410
|
+
for (const specifier of node.specifiers) if (specifier.exported.type === "Identifier") names.push(specifier.exported.name);
|
|
411
|
+
return names;
|
|
412
|
+
}
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/rules/exportFilenameMatch/getExportedNames.ts
|
|
415
|
+
function getExportedNames(node) {
|
|
416
|
+
const specifierNames = getNamesFromSpecifiers(node);
|
|
417
|
+
if (!node.declaration) return specifierNames;
|
|
418
|
+
const declarationNames = getNameFromDeclaration(node.declaration);
|
|
419
|
+
return [...specifierNames, ...declarationNames];
|
|
420
|
+
}
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/rules/shared/stripExtension.ts
|
|
423
|
+
function stripExtension(filename) {
|
|
424
|
+
return path.basename(filename, path.extname(filename));
|
|
425
|
+
}
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/rules/shared/isExempt.ts
|
|
428
|
+
function isExempt$2(filename) {
|
|
429
|
+
const name = stripExtension(filename);
|
|
430
|
+
return name === "index" || name.endsWith(".test") || name.endsWith(".spec") || name.endsWith(".config");
|
|
431
|
+
}
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/rules/exportFilenameMatch/index.ts
|
|
434
|
+
var exportFilenameMatch = {
|
|
435
|
+
create(context) {
|
|
436
|
+
const fileName = context.filename;
|
|
437
|
+
const baseName = path.basename(fileName);
|
|
438
|
+
const ext = path.extname(baseName);
|
|
439
|
+
const fileNameWithoutExt = baseName.slice(0, -ext.length);
|
|
440
|
+
if (isExempt$2(fileName)) return {};
|
|
441
|
+
const exportNames = [];
|
|
442
|
+
return {
|
|
443
|
+
ExportNamedDeclaration(node) {
|
|
444
|
+
const names = getExportedNames(node);
|
|
445
|
+
exportNames.push(...names);
|
|
446
|
+
},
|
|
447
|
+
"Program:exit"(programNode) {
|
|
448
|
+
if (exportNames.length === 1) {
|
|
449
|
+
const [exportName] = exportNames;
|
|
450
|
+
if (exportName !== fileNameWithoutExt) context.report({
|
|
451
|
+
data: {
|
|
452
|
+
currentName: `${fileNameWithoutExt}${ext}`,
|
|
453
|
+
expectedName: `${exportName}${ext}`
|
|
454
|
+
},
|
|
455
|
+
messageId: "filenameMismatch",
|
|
456
|
+
node: programNode
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
},
|
|
462
|
+
meta: {
|
|
463
|
+
docs: { description: "Enforce filename matches the single named export." },
|
|
464
|
+
messages: { filenameMismatch: "File name must be '{{expectedName}}' instead of '{{currentName}}'." },
|
|
465
|
+
schema: [],
|
|
466
|
+
type: "suggestion"
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/rules/shared/findLinesWithMultipleNodes.ts
|
|
471
|
+
function findLinesWithMultipleNodes(nodes) {
|
|
472
|
+
const lines = [];
|
|
473
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
474
|
+
const nodeLine = nodes[i].loc.start.line;
|
|
475
|
+
if (i < nodes.length - 1) {
|
|
476
|
+
if (nodes[i + 1].loc.start.line === nodeLine) lines.push(nodeLine);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return lines;
|
|
480
|
+
}
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/rules/functionCallArgumentLineBreak/formatArgs.ts
|
|
483
|
+
function formatArgs(sourceCode, nodes, indent) {
|
|
484
|
+
return nodes.map((arg, index) => {
|
|
485
|
+
const argText = sourceCode.getText(arg);
|
|
486
|
+
if (index === nodes.length - 1) return argText;
|
|
487
|
+
const comma = sourceCode.getTokenAfter(arg, (token) => token.value === ",");
|
|
488
|
+
if (comma && comma.loc.end.line === arg.loc.end.line) return argText + ",";
|
|
489
|
+
return argText;
|
|
490
|
+
}).map((text, index) => index === 0 ? `${indent}${text}` : `\n${indent}${text}`).join("");
|
|
491
|
+
}
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/rules/shared/getLineStartIndex.ts
|
|
494
|
+
function getLineStartIndex(sourceCode, line) {
|
|
495
|
+
return sourceCode.getLines().slice(0, line - 1).reduce((acc, l) => acc + l.length + 1, 0);
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/rules/functionCallArgumentLineBreak/checkMultilineArgs.ts
|
|
499
|
+
function checkMultilineArgs(sourceCode, context, args, maxLength) {
|
|
500
|
+
const linesWithMultipleArgs = findLinesWithMultipleNodes(args);
|
|
501
|
+
for (const line of linesWithMultipleArgs) {
|
|
502
|
+
const lineLength = getLineLength(sourceCode, line);
|
|
503
|
+
if (lineLength > maxLength) context.report({
|
|
504
|
+
data: { maxLength },
|
|
505
|
+
fix: (fixer) => {
|
|
506
|
+
const nodesOnLine = args.filter((arg) => arg.loc.start.line <= line && arg.loc.end.line >= line);
|
|
507
|
+
const lastNode = nodesOnLine[nodesOnLine.length - 1];
|
|
508
|
+
const lineStartIndex = getLineStartIndex(sourceCode, line);
|
|
509
|
+
const fixed = formatArgs(sourceCode, nodesOnLine, (sourceCode.getText().match(/^[\t ]*/)?.[0] ?? "") + " ");
|
|
510
|
+
return fixer.replaceTextRange([lineStartIndex, lastNode.range[1]], fixed);
|
|
511
|
+
},
|
|
512
|
+
loc: {
|
|
513
|
+
end: {
|
|
514
|
+
column: lineLength,
|
|
515
|
+
line
|
|
516
|
+
},
|
|
517
|
+
start: {
|
|
518
|
+
column: 0,
|
|
519
|
+
line
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
messageId: "multipleOnSameLine"
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region src/rules/functionCallArgumentLineBreak/checkSingleLineArgs.ts
|
|
528
|
+
function checkSingleLineArgs(sourceCode, context, args, parens, maxLength) {
|
|
529
|
+
const { closingParen, openingParen } = parens;
|
|
530
|
+
const lineLength = getLineLength(sourceCode, openingParen.loc.start.line);
|
|
531
|
+
if (lineLength <= maxLength) return;
|
|
532
|
+
if (args.length === 1) {
|
|
533
|
+
context.report({
|
|
534
|
+
data: { maxLength },
|
|
535
|
+
loc: {
|
|
536
|
+
end: {
|
|
537
|
+
column: lineLength,
|
|
538
|
+
line: closingParen.loc.end.line
|
|
539
|
+
},
|
|
540
|
+
start: {
|
|
541
|
+
column: 0,
|
|
542
|
+
line: openingParen.loc.start.line
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
messageId: "exceedsMaxLength"
|
|
546
|
+
});
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
context.report({
|
|
550
|
+
data: { maxLength },
|
|
551
|
+
fix: (fixer) => {
|
|
552
|
+
const indent = sourceCode.getText().match(/^[\t ]*/)?.[0] ?? "";
|
|
553
|
+
const fixed = [
|
|
554
|
+
"(\n",
|
|
555
|
+
`${indent} ${args.map((arg) => {
|
|
556
|
+
const argText = sourceCode.getText(arg);
|
|
557
|
+
const comma = sourceCode.getTokenAfter(arg, (token) => token.value === ",");
|
|
558
|
+
if (comma && comma.loc.end.line === arg.loc.end.line) return argText + ",";
|
|
559
|
+
return argText;
|
|
560
|
+
}).join(`\n${indent} `)}\n`,
|
|
561
|
+
`${indent})`
|
|
562
|
+
].join("");
|
|
563
|
+
return fixer.replaceTextRange([openingParen.range[0], closingParen.range[1]], fixed);
|
|
564
|
+
},
|
|
565
|
+
loc: {
|
|
566
|
+
end: {
|
|
567
|
+
column: lineLength,
|
|
568
|
+
line: closingParen.loc.end.line
|
|
569
|
+
},
|
|
570
|
+
start: {
|
|
571
|
+
column: 0,
|
|
572
|
+
line: openingParen.loc.start.line
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
messageId: "multipleOnSameLine"
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region src/rules/functionCallArgumentLineBreak/defaultOptions.ts
|
|
580
|
+
var defaultOptions$5 = { maxLength: 80 };
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/rules/shared/getParens.ts
|
|
583
|
+
function getParens$1(sourceCode, nodes) {
|
|
584
|
+
if (nodes.length === 0) return null;
|
|
585
|
+
const firstNode = nodes[0];
|
|
586
|
+
const lastNode = nodes[nodes.length - 1];
|
|
587
|
+
const openingParen = sourceCode.getTokenBefore(firstNode);
|
|
588
|
+
const closingParen = sourceCode.getTokenAfter(lastNode);
|
|
589
|
+
if (!openingParen || !closingParen) return null;
|
|
590
|
+
return {
|
|
591
|
+
closingParen,
|
|
592
|
+
openingParen
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region src/rules/shared/isValidParens.ts
|
|
597
|
+
function isValidParens(parens) {
|
|
598
|
+
if (!parens) return false;
|
|
599
|
+
return parens.openingParen.value === "(" && parens.closingParen.value === ")";
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/rules/functionCallArgumentLineBreak/checkCall.ts
|
|
603
|
+
function checkCall(sourceCode, context, node) {
|
|
604
|
+
const maxLength = (context.options[0] ?? {}).maxLength ?? defaultOptions$5.maxLength;
|
|
605
|
+
const args = node.arguments;
|
|
606
|
+
const parens = getParens$1(sourceCode, args);
|
|
607
|
+
if (!isValidParens(parens)) return;
|
|
608
|
+
if (parens.openingParen.loc.start.line === parens.closingParen.loc.end.line) checkSingleLineArgs(sourceCode, context, args, parens, maxLength);
|
|
609
|
+
else checkMultilineArgs(sourceCode, context, args, maxLength);
|
|
610
|
+
}
|
|
611
|
+
//#endregion
|
|
612
|
+
//#region src/rules/functionCallArgumentLineBreak/index.ts
|
|
613
|
+
var functionCallArgumentLineBreak = {
|
|
614
|
+
create(context) {
|
|
615
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
616
|
+
return {
|
|
617
|
+
CallExpression(node) {
|
|
618
|
+
checkCall(sourceCode, context, node);
|
|
619
|
+
},
|
|
620
|
+
OptionalCallExpression(node) {
|
|
621
|
+
checkCall(sourceCode, context, node);
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
},
|
|
625
|
+
meta: {
|
|
626
|
+
docs: { description: "Enforce each function call argument to be on its own line when line exceeds max length." },
|
|
627
|
+
fixable: "code",
|
|
628
|
+
messages: {
|
|
629
|
+
exceedsMaxLength: "Refactor this function call as it exceeds {{maxLength}} characters",
|
|
630
|
+
multipleOnSameLine: "Each argument must be on its own line"
|
|
631
|
+
},
|
|
632
|
+
schema: [{
|
|
633
|
+
additionalProperties: false,
|
|
634
|
+
properties: { maxLength: { type: "number" } },
|
|
635
|
+
type: "object"
|
|
636
|
+
}],
|
|
637
|
+
type: "layout"
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
//#endregion
|
|
641
|
+
//#region src/rules/functionCognitiveComplexity/isNodeWithType.ts
|
|
642
|
+
function isNodeWithType(value) {
|
|
643
|
+
return value !== null && typeof value === "object" && "type" in value;
|
|
644
|
+
}
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region src/rules/functionCognitiveComplexity/getChildNodes.ts
|
|
647
|
+
var SKIP_KEYS = new Set([
|
|
648
|
+
"loc",
|
|
649
|
+
"parent",
|
|
650
|
+
"range"
|
|
651
|
+
]);
|
|
652
|
+
function getChildNodes(node) {
|
|
653
|
+
const children = [];
|
|
654
|
+
for (const key of Object.keys(node)) {
|
|
655
|
+
if (SKIP_KEYS.has(key)) continue;
|
|
656
|
+
const value = node[key];
|
|
657
|
+
if (Array.isArray(value)) {
|
|
658
|
+
for (const item of value) if (isNodeWithType(item)) children.push(item);
|
|
659
|
+
} else if (isNodeWithType(value)) children.push(value);
|
|
660
|
+
}
|
|
661
|
+
return children;
|
|
662
|
+
}
|
|
663
|
+
//#endregion
|
|
664
|
+
//#region src/rules/functionCognitiveComplexity/isIncrementableControlFlow.ts
|
|
665
|
+
var INCREMENTABLE_TYPES = new Set([
|
|
666
|
+
"ConditionalExpression",
|
|
667
|
+
"DoWhileStatement",
|
|
668
|
+
"ForInStatement",
|
|
669
|
+
"ForOfStatement",
|
|
670
|
+
"ForStatement",
|
|
671
|
+
"IfStatement",
|
|
672
|
+
"LogicalExpression",
|
|
673
|
+
"SwitchStatement",
|
|
674
|
+
"TryStatement",
|
|
675
|
+
"WhileStatement"
|
|
676
|
+
]);
|
|
677
|
+
function isIncrementableControlFlow(node) {
|
|
678
|
+
return INCREMENTABLE_TYPES.has(node.type);
|
|
679
|
+
}
|
|
680
|
+
//#endregion
|
|
681
|
+
//#region src/rules/functionCognitiveComplexity/traverse.ts
|
|
682
|
+
function traverse(node, nestingLevel, state) {
|
|
683
|
+
if (isIncrementableControlFlow(node)) {
|
|
684
|
+
state.complexity += 1 + nestingLevel;
|
|
685
|
+
nestingLevel++;
|
|
686
|
+
}
|
|
687
|
+
const children = getChildNodes(node);
|
|
688
|
+
for (const child of children) traverse(child, nestingLevel, state);
|
|
689
|
+
}
|
|
690
|
+
//#endregion
|
|
691
|
+
//#region src/rules/functionCognitiveComplexity/calculateCognitiveComplexity.ts
|
|
692
|
+
function calculateCognitiveComplexity(node) {
|
|
693
|
+
const state = {
|
|
694
|
+
complexity: 0,
|
|
695
|
+
nestingLevel: 0
|
|
696
|
+
};
|
|
697
|
+
const children = getChildNodes(node);
|
|
698
|
+
for (const child of children) traverse(child, 0, state);
|
|
699
|
+
return state.complexity;
|
|
700
|
+
}
|
|
701
|
+
//#endregion
|
|
702
|
+
//#region src/rules/functionCognitiveComplexity/getNameFromCallExpression.ts
|
|
703
|
+
function getNameFromCallExpression(node) {
|
|
704
|
+
if (node?.type === "CallExpression" && node.callee?.type === "Identifier") return `${node.callee.name} callback`;
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
707
|
+
//#endregion
|
|
708
|
+
//#region src/rules/functionCognitiveComplexity/getNameFromProperty.ts
|
|
709
|
+
function getNameFromProperty(node) {
|
|
710
|
+
if (node?.type === "Property" && node.key?.type === "Identifier") return node.key.name;
|
|
711
|
+
return null;
|
|
712
|
+
}
|
|
713
|
+
//#endregion
|
|
714
|
+
//#region src/rules/functionCognitiveComplexity/getNameFromVariableDeclarator.ts
|
|
715
|
+
function getNameFromVariableDeclarator(node) {
|
|
716
|
+
if (node?.type === "VariableDeclarator" && node.id?.type === "Identifier") return node.id.name;
|
|
717
|
+
return null;
|
|
718
|
+
}
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/rules/functionCognitiveComplexity/getArrowFunctionExpressionName.ts
|
|
721
|
+
function getArrowFunctionExpressionName(node) {
|
|
722
|
+
const parent = node.parent;
|
|
723
|
+
const nameFromVar = getNameFromVariableDeclarator(parent);
|
|
724
|
+
if (nameFromVar) return nameFromVar;
|
|
725
|
+
const nameFromProp = getNameFromProperty(parent);
|
|
726
|
+
if (nameFromProp) return nameFromProp;
|
|
727
|
+
const nameFromCall = getNameFromCallExpression(parent);
|
|
728
|
+
if (nameFromCall) return nameFromCall;
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
//#endregion
|
|
732
|
+
//#region src/rules/functionCognitiveComplexity/getNameFromMethodDefinition.ts
|
|
733
|
+
function getNameFromMethodDefinition(node) {
|
|
734
|
+
if (node?.type === "MethodDefinition" && node.key?.type === "Identifier") return node.key.name;
|
|
735
|
+
return null;
|
|
736
|
+
}
|
|
737
|
+
//#endregion
|
|
738
|
+
//#region src/rules/functionCognitiveComplexity/getFunctionExpressionName.ts
|
|
739
|
+
function getFunctionExpressionName(node) {
|
|
740
|
+
const parent = node.parent;
|
|
741
|
+
const nameFromVar = getNameFromVariableDeclarator(parent);
|
|
742
|
+
if (nameFromVar) return nameFromVar;
|
|
743
|
+
const nameFromProp = getNameFromProperty(parent);
|
|
744
|
+
if (nameFromProp) return nameFromProp;
|
|
745
|
+
const nameFromMethod = getNameFromMethodDefinition(parent);
|
|
746
|
+
if (nameFromMethod) return nameFromMethod;
|
|
747
|
+
return null;
|
|
748
|
+
}
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region src/rules/functionCognitiveComplexity/getFunctionName.ts
|
|
751
|
+
function getFunctionName$1(node) {
|
|
752
|
+
if (node.type === "FunctionDeclaration" && node.id?.name) return node.id.name;
|
|
753
|
+
if (node.type === "FunctionExpression") return getFunctionExpressionName(node);
|
|
754
|
+
if (node.type === "ArrowFunctionExpression") return getArrowFunctionExpressionName(node);
|
|
755
|
+
return null;
|
|
756
|
+
}
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region src/rules/functionCognitiveComplexity/messageIds.ts
|
|
759
|
+
var messageIds$8 = {
|
|
760
|
+
tooHighCognitiveComplexity: "Function '{{name}}' has cognitive complexity of {{actual}} (max: {{max}}). Consider extracting sub-functions.",
|
|
761
|
+
tooHighCognitiveComplexityAnonymous: "Anonymous function has cognitive complexity of {{actual}} (max: {{max}}). Consider extracting sub-functions."
|
|
762
|
+
};
|
|
763
|
+
//#endregion
|
|
764
|
+
//#region src/rules/functionCognitiveComplexity/index.ts
|
|
765
|
+
var DEFAULT_MAX_COGNITIVE_COMPLEXITY = 15;
|
|
766
|
+
var functionCognitiveComplexity = {
|
|
767
|
+
create(context) {
|
|
768
|
+
const maxCognitiveComplexity = (context.options[0] ?? {}).maxCognitiveComplexity ?? DEFAULT_MAX_COGNITIVE_COMPLEXITY;
|
|
769
|
+
function checkFunction(node) {
|
|
770
|
+
const complexity = calculateCognitiveComplexity(node);
|
|
771
|
+
if (complexity > maxCognitiveComplexity) {
|
|
772
|
+
const name = getFunctionName$1(node);
|
|
773
|
+
if (name) context.report({
|
|
774
|
+
data: {
|
|
775
|
+
actual: complexity,
|
|
776
|
+
max: maxCognitiveComplexity,
|
|
777
|
+
name
|
|
778
|
+
},
|
|
779
|
+
messageId: "tooHighCognitiveComplexity",
|
|
780
|
+
node
|
|
781
|
+
});
|
|
782
|
+
else context.report({
|
|
783
|
+
data: {
|
|
784
|
+
actual: complexity,
|
|
785
|
+
max: maxCognitiveComplexity
|
|
786
|
+
},
|
|
787
|
+
messageId: "tooHighCognitiveComplexityAnonymous",
|
|
788
|
+
node
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return {
|
|
793
|
+
ArrowFunctionExpression(node) {
|
|
794
|
+
checkFunction(node);
|
|
795
|
+
},
|
|
796
|
+
FunctionDeclaration(node) {
|
|
797
|
+
checkFunction(node);
|
|
798
|
+
},
|
|
799
|
+
FunctionExpression(node) {
|
|
800
|
+
checkFunction(node);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
},
|
|
804
|
+
meta: {
|
|
805
|
+
docs: { description: "Enforce cognitive complexity threshold for functions." },
|
|
806
|
+
messages: messageIds$8,
|
|
807
|
+
schema: [{
|
|
808
|
+
additionalProperties: false,
|
|
809
|
+
properties: { maxCognitiveComplexity: { type: "number" } },
|
|
810
|
+
type: "object"
|
|
811
|
+
}],
|
|
812
|
+
type: "suggestion"
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
//#endregion
|
|
816
|
+
//#region src/rules/functionParameterLineBreak/formatParams.ts
|
|
817
|
+
function formatParams(sourceCode, nodes, indent) {
|
|
818
|
+
return nodes.map((param, index) => {
|
|
819
|
+
const paramText = sourceCode.getText(param);
|
|
820
|
+
if (index === nodes.length - 1) return paramText;
|
|
821
|
+
const comma = sourceCode.getTokenAfter(param, (token) => token.value === ",");
|
|
822
|
+
if (comma && comma.loc.end.line === param.loc.end.line) return paramText + ",";
|
|
823
|
+
return paramText;
|
|
824
|
+
}).map((text, index) => index === 0 ? `${indent}${text}` : `\n${indent}${text}`).join("");
|
|
825
|
+
}
|
|
826
|
+
//#endregion
|
|
827
|
+
//#region src/rules/functionParameterLineBreak/checkMultilineParams.ts
|
|
828
|
+
function checkMultilineParams(sourceCode, context, params, parens, maxLength) {
|
|
829
|
+
const linesWithMultipleParams = findLinesWithMultipleNodes(params);
|
|
830
|
+
for (const line of linesWithMultipleParams) {
|
|
831
|
+
const lineLength = getLineLength(sourceCode, line);
|
|
832
|
+
if (lineLength > maxLength) context.report({
|
|
833
|
+
data: { maxLength },
|
|
834
|
+
fix: (fixer) => {
|
|
835
|
+
const nodesOnLine = params.filter((param) => param.loc.start.line <= line && param.loc.end.line >= line);
|
|
836
|
+
const lastNode = nodesOnLine[nodesOnLine.length - 1];
|
|
837
|
+
const lineStartIndex = getLineStartIndex(sourceCode, line);
|
|
838
|
+
const fixed = formatParams(sourceCode, nodesOnLine, (sourceCode.getText().match(/^[\t ]*/)?.[0] ?? "") + " ");
|
|
839
|
+
return fixer.replaceTextRange([lineStartIndex, lastNode.range[1]], fixed);
|
|
840
|
+
},
|
|
841
|
+
loc: {
|
|
842
|
+
end: {
|
|
843
|
+
column: lineLength,
|
|
844
|
+
line
|
|
845
|
+
},
|
|
846
|
+
start: {
|
|
847
|
+
column: 0,
|
|
848
|
+
line
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
messageId: "multipleOnSameLine"
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
//#endregion
|
|
856
|
+
//#region src/rules/functionParameterLineBreak/checkSingleLineParams.ts
|
|
857
|
+
function checkSingleLineParams(sourceCode, context, params, parens, maxLength) {
|
|
858
|
+
const { closingParen, openingParen } = parens;
|
|
859
|
+
const lineLength = getLineLength(sourceCode, openingParen.loc.start.line);
|
|
860
|
+
if (lineLength <= maxLength) return;
|
|
861
|
+
if (params.length === 1) {
|
|
862
|
+
context.report({
|
|
863
|
+
data: { maxLength },
|
|
864
|
+
loc: {
|
|
865
|
+
end: {
|
|
866
|
+
column: lineLength,
|
|
867
|
+
line: closingParen.loc.end.line
|
|
868
|
+
},
|
|
869
|
+
start: {
|
|
870
|
+
column: 0,
|
|
871
|
+
line: openingParen.loc.start.line
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
messageId: "exceedsMaxLength"
|
|
875
|
+
});
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
context.report({
|
|
879
|
+
data: { maxLength },
|
|
880
|
+
fix: (fixer) => {
|
|
881
|
+
const indent = sourceCode.getText().match(/^[\t ]*/)?.[0] ?? "";
|
|
882
|
+
const fixed = [
|
|
883
|
+
"(\n",
|
|
884
|
+
`${indent} ${params.map((param) => {
|
|
885
|
+
const paramText = sourceCode.getText(param);
|
|
886
|
+
const comma = sourceCode.getTokenAfter(param, (token) => token.value === ",");
|
|
887
|
+
if (comma && comma.loc.end.line === param.loc.end.line) return paramText + ",";
|
|
888
|
+
return paramText;
|
|
889
|
+
}).join(`\n${indent} `)}\n`,
|
|
890
|
+
`${indent})`
|
|
891
|
+
].join("");
|
|
892
|
+
return fixer.replaceTextRange([openingParen.range[0], closingParen.range[1]], fixed);
|
|
893
|
+
},
|
|
894
|
+
loc: {
|
|
895
|
+
end: {
|
|
896
|
+
column: lineLength,
|
|
897
|
+
line: closingParen.loc.end.line
|
|
898
|
+
},
|
|
899
|
+
start: {
|
|
900
|
+
column: 0,
|
|
901
|
+
line: openingParen.loc.start.line
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
messageId: "multipleOnSameLine"
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
//#endregion
|
|
908
|
+
//#region src/rules/functionParameterLineBreak/defaultOptions.ts
|
|
909
|
+
var defaultOptions$4 = { maxLength: 80 };
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region src/rules/functionParameterLineBreak/checkFunction.ts
|
|
912
|
+
function checkFunction$1(sourceCode, context, node) {
|
|
913
|
+
const maxLength = (context.options[0] ?? {}).maxLength ?? defaultOptions$4.maxLength;
|
|
914
|
+
const params = node.params;
|
|
915
|
+
if (params.length === 0) return;
|
|
916
|
+
const parens = getParens$1(sourceCode, params);
|
|
917
|
+
if (!isValidParens(parens)) return;
|
|
918
|
+
if (parens.openingParen.loc.start.line === parens.closingParen.loc.end.line) checkSingleLineParams(sourceCode, context, params, parens, maxLength);
|
|
919
|
+
else checkMultilineParams(sourceCode, context, params, parens, maxLength);
|
|
920
|
+
}
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region src/rules/functionParameterLineBreak/index.ts
|
|
923
|
+
var functionParameterLineBreak = {
|
|
924
|
+
create(context) {
|
|
925
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
926
|
+
return {
|
|
927
|
+
ArrowFunctionExpression(node) {
|
|
928
|
+
if (node.expression) return;
|
|
929
|
+
checkFunction$1(sourceCode, context, node);
|
|
930
|
+
},
|
|
931
|
+
FunctionDeclaration(node) {
|
|
932
|
+
checkFunction$1(sourceCode, context, node);
|
|
933
|
+
},
|
|
934
|
+
FunctionExpression(node) {
|
|
935
|
+
checkFunction$1(sourceCode, context, node);
|
|
936
|
+
},
|
|
937
|
+
TSCallSignatureDeclaration(node) {
|
|
938
|
+
checkFunction$1(sourceCode, context, node);
|
|
939
|
+
},
|
|
940
|
+
TSFunctionType(node) {
|
|
941
|
+
checkFunction$1(sourceCode, context, node);
|
|
942
|
+
},
|
|
943
|
+
TSMethodSignature(node) {
|
|
944
|
+
checkFunction$1(sourceCode, context, node);
|
|
945
|
+
}
|
|
946
|
+
};
|
|
947
|
+
},
|
|
948
|
+
meta: {
|
|
949
|
+
docs: { description: "Enforce each function parameter to be on its own line when line exceeds max length." },
|
|
950
|
+
fixable: "code",
|
|
951
|
+
messages: {
|
|
952
|
+
exceedsMaxLength: "Refactor this function signature as it exceeds {{maxLength}} characters",
|
|
953
|
+
multipleOnSameLine: "Each parameter must be on its own line"
|
|
954
|
+
},
|
|
955
|
+
schema: [{
|
|
956
|
+
additionalProperties: false,
|
|
957
|
+
properties: { maxLength: { type: "number" } },
|
|
958
|
+
type: "object"
|
|
959
|
+
}],
|
|
960
|
+
type: "layout"
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region src/rules/importsAndReExportsAtTop/getStatementType.ts
|
|
965
|
+
function getStatementType(statement) {
|
|
966
|
+
if (statement.type === "ImportDeclaration") return "import";
|
|
967
|
+
if (statement.type === "ExportAllDeclaration") return "re-export";
|
|
968
|
+
if (statement.type === "ExportNamedDeclaration") {
|
|
969
|
+
if (statement.source !== null) return "re-export";
|
|
970
|
+
}
|
|
971
|
+
return "other";
|
|
972
|
+
}
|
|
973
|
+
//#endregion
|
|
974
|
+
//#region src/rules/importsAndReExportsAtTop/isImportDeclaration.ts
|
|
975
|
+
function isImportDeclaration(statement) {
|
|
976
|
+
return statement.type === "ImportDeclaration";
|
|
977
|
+
}
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/rules/importsAndReExportsAtTop/isReExport.ts
|
|
980
|
+
function isReExport(statement) {
|
|
981
|
+
if (statement.type === "ExportAllDeclaration") return true;
|
|
982
|
+
if (statement.type === "ExportNamedDeclaration") return statement.source !== null;
|
|
983
|
+
return false;
|
|
984
|
+
}
|
|
985
|
+
//#endregion
|
|
986
|
+
//#region src/rules/importsAndReExportsAtTop/categorizeStatements.ts
|
|
987
|
+
function categorizeStatements(statements) {
|
|
988
|
+
const result = {
|
|
989
|
+
imports: [],
|
|
990
|
+
other: [],
|
|
991
|
+
reExports: []
|
|
992
|
+
};
|
|
993
|
+
for (const statement of statements) {
|
|
994
|
+
const type = getStatementType(statement);
|
|
995
|
+
if (type === "import" && isImportDeclaration(statement)) result.imports.push(statement);
|
|
996
|
+
else if (type === "re-export" && isReExport(statement)) result.reExports.push(statement);
|
|
997
|
+
else result.other.push(statement);
|
|
998
|
+
}
|
|
999
|
+
return result;
|
|
1000
|
+
}
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region src/rules/importsAndReExportsAtTop/findStatementIndices.ts
|
|
1003
|
+
function findStatementIndices(statements) {
|
|
1004
|
+
let firstRegularStatement = -1;
|
|
1005
|
+
let lastImport = -1;
|
|
1006
|
+
let lastReExport = -1;
|
|
1007
|
+
for (let i = 0; i < statements.length; i++) {
|
|
1008
|
+
const type = getStatementType(statements[i]);
|
|
1009
|
+
if (type === "import") lastImport = i;
|
|
1010
|
+
else if (type === "re-export") lastReExport = i;
|
|
1011
|
+
else if (type === "other" && firstRegularStatement === -1) firstRegularStatement = i;
|
|
1012
|
+
}
|
|
1013
|
+
return {
|
|
1014
|
+
firstRegularStatement,
|
|
1015
|
+
lastImport,
|
|
1016
|
+
lastReExport
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
//#endregion
|
|
1020
|
+
//#region src/rules/importsAndReExportsAtTop/generateSortedText.ts
|
|
1021
|
+
function generateSortedText(context, categories) {
|
|
1022
|
+
return [
|
|
1023
|
+
...categories.imports,
|
|
1024
|
+
...categories.reExports,
|
|
1025
|
+
...categories.other
|
|
1026
|
+
].map((node) => context.sourceCode.getText(node)).join("\n");
|
|
1027
|
+
}
|
|
1028
|
+
//#endregion
|
|
1029
|
+
//#region src/rules/importsAndReExportsAtTop/hasImportOrderViolation.ts
|
|
1030
|
+
function hasImportOrderViolation(indices, categories) {
|
|
1031
|
+
const { firstRegularStatement, lastImport, lastReExport } = indices;
|
|
1032
|
+
if (categories.imports.length === 0 && categories.reExports.length === 0) return false;
|
|
1033
|
+
const hasImportAfterRegularStatement = categories.imports.length > 0 && firstRegularStatement !== -1 && lastImport > firstRegularStatement;
|
|
1034
|
+
const hasReExportAfterRegularStatement = categories.reExports.length > 0 && firstRegularStatement !== -1 && lastReExport > firstRegularStatement;
|
|
1035
|
+
return hasImportAfterRegularStatement || hasReExportAfterRegularStatement;
|
|
1036
|
+
}
|
|
1037
|
+
//#endregion
|
|
1038
|
+
//#region src/rules/importsAndReExportsAtTop/index.ts
|
|
1039
|
+
var importsAndReExportsAtTop = {
|
|
1040
|
+
create(context) {
|
|
1041
|
+
return { Program(node) {
|
|
1042
|
+
const statements = node.body;
|
|
1043
|
+
const categories = categorizeStatements(statements);
|
|
1044
|
+
if (!hasImportOrderViolation(findStatementIndices(statements), categories)) return;
|
|
1045
|
+
context.report({
|
|
1046
|
+
fix(fixer) {
|
|
1047
|
+
const sortedText = generateSortedText(context, categories);
|
|
1048
|
+
return fixer.replaceText(node, sortedText);
|
|
1049
|
+
},
|
|
1050
|
+
messageId: "importsAndReExportsAtTop",
|
|
1051
|
+
node
|
|
1052
|
+
});
|
|
1053
|
+
} };
|
|
1054
|
+
},
|
|
1055
|
+
meta: {
|
|
1056
|
+
docs: { description: "Enforce imports and re-exports at the top of the file." },
|
|
1057
|
+
fixable: "code",
|
|
1058
|
+
messages: { importsAndReExportsAtTop: "Imports and re-exports should be at the top of the file." },
|
|
1059
|
+
schema: [],
|
|
1060
|
+
type: "suggestion"
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
//#endregion
|
|
1064
|
+
//#region src/rules/individualImports/index.ts
|
|
1065
|
+
var individualImports = {
|
|
1066
|
+
create(context) {
|
|
1067
|
+
return { ImportDeclaration(node) {
|
|
1068
|
+
if (node.specifiers.length <= 1) return;
|
|
1069
|
+
context.report({
|
|
1070
|
+
fix(fixer) {
|
|
1071
|
+
const source = node.source.raw;
|
|
1072
|
+
const specifiers = node.specifiers.filter((s) => s.type === "ImportSpecifier").map((s) => `import {${s.local.name}} from ${source}`).join("\n");
|
|
1073
|
+
return fixer.replaceText(node, specifiers);
|
|
1074
|
+
},
|
|
1075
|
+
messageId: "individualImports",
|
|
1076
|
+
node
|
|
1077
|
+
});
|
|
1078
|
+
} };
|
|
1079
|
+
},
|
|
1080
|
+
meta: {
|
|
1081
|
+
docs: { description: "Enforce individual imports instead of grouped imports." },
|
|
1082
|
+
fixable: "code",
|
|
1083
|
+
messages: { individualImports: "Use individual imports instead of grouped imports." },
|
|
1084
|
+
schema: [],
|
|
1085
|
+
type: "suggestion"
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
//#endregion
|
|
1089
|
+
//#region src/rules/individualReExports/index.ts
|
|
1090
|
+
var individualReExports = {
|
|
1091
|
+
create(context) {
|
|
1092
|
+
return { ExportNamedDeclaration(node) {
|
|
1093
|
+
if (!node.source || node.specifiers.length <= 1) return;
|
|
1094
|
+
context.report({
|
|
1095
|
+
fix(fixer) {
|
|
1096
|
+
const source = node.source.value;
|
|
1097
|
+
const typeKeyword = node.exportKind === "type" ? "type " : "";
|
|
1098
|
+
const specifiers = node.specifiers.map((s) => {
|
|
1099
|
+
const localName = s.local.type === "Identifier" ? s.local.name : s.local.value;
|
|
1100
|
+
const exportedName = s.exported.type === "Identifier" ? s.exported.name : s.exported.value;
|
|
1101
|
+
return `export ${typeKeyword}{${localName === exportedName ? localName : `${localName} as ${exportedName}`}} from '${source}'`;
|
|
1102
|
+
}).join("\n");
|
|
1103
|
+
return fixer.replaceText(node, specifiers);
|
|
1104
|
+
},
|
|
1105
|
+
messageId: "individualReExports",
|
|
1106
|
+
node
|
|
1107
|
+
});
|
|
1108
|
+
} };
|
|
1109
|
+
},
|
|
1110
|
+
meta: {
|
|
1111
|
+
docs: { description: "Enforce individual exports instead of grouped exports." },
|
|
1112
|
+
fixable: "code",
|
|
1113
|
+
messages: { individualReExports: "Use individual exports instead of grouped exports." },
|
|
1114
|
+
schema: [],
|
|
1115
|
+
type: "suggestion"
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
//#endregion
|
|
1119
|
+
//#region src/rules/interfacePropertyLineBreak/formatTypeLiteral.ts
|
|
1120
|
+
function formatTypeLiteral(sourceCode, typeLiteral, baseIndent) {
|
|
1121
|
+
const members = typeLiteral.members;
|
|
1122
|
+
if (members.length === 0) return "{}";
|
|
1123
|
+
const memberTexts = members.map((member) => {
|
|
1124
|
+
if (member.type === "TSPropertySignature") return sourceCode.getText(member).replace(/,\s*$/, "");
|
|
1125
|
+
return sourceCode.getText(member).replace(/,\s*$/, "");
|
|
1126
|
+
});
|
|
1127
|
+
const innerIndent = baseIndent + " ";
|
|
1128
|
+
return [
|
|
1129
|
+
"{",
|
|
1130
|
+
innerIndent + memberTexts.join(`\n${innerIndent}`),
|
|
1131
|
+
`${baseIndent}}`
|
|
1132
|
+
].join("\n");
|
|
1133
|
+
}
|
|
1134
|
+
//#endregion
|
|
1135
|
+
//#region src/rules/interfacePropertyLineBreak/checkMultilineMembers.ts
|
|
1136
|
+
function checkMultilineMembers(sourceCode, context, members, maxLength) {
|
|
1137
|
+
for (const member of members) {
|
|
1138
|
+
const memberLine = member.loc.start.line;
|
|
1139
|
+
const lineLength = getLineLength(sourceCode, memberLine);
|
|
1140
|
+
if (lineLength > maxLength) {
|
|
1141
|
+
let fix;
|
|
1142
|
+
if (member.type === "TSPropertySignature" && member.typeAnnotation && member.typeAnnotation.typeAnnotation.type === "TSTypeLiteral") {
|
|
1143
|
+
const typeLiteral = member.typeAnnotation.typeAnnotation;
|
|
1144
|
+
fix = (fixer) => {
|
|
1145
|
+
const formatted = formatTypeLiteral(sourceCode, typeLiteral, getLineIndent(sourceCode, memberLine));
|
|
1146
|
+
return fixer.replaceText(typeLiteral, formatted);
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
context.report({
|
|
1150
|
+
data: { maxLength },
|
|
1151
|
+
fix,
|
|
1152
|
+
loc: {
|
|
1153
|
+
end: {
|
|
1154
|
+
column: lineLength,
|
|
1155
|
+
line: memberLine
|
|
1156
|
+
},
|
|
1157
|
+
start: {
|
|
1158
|
+
column: 0,
|
|
1159
|
+
line: memberLine
|
|
1160
|
+
}
|
|
1161
|
+
},
|
|
1162
|
+
messageId: "exceedsMaxLength"
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
//#endregion
|
|
1168
|
+
//#region src/rules/interfacePropertyLineBreak/checkSingleLineMembers.ts
|
|
1169
|
+
function checkSingleLineMembers(sourceCode, context, members, parens, maxLength) {
|
|
1170
|
+
const { closingBrace, openingBrace } = parens;
|
|
1171
|
+
const lineLength = getLineLength(sourceCode, openingBrace.loc.start.line);
|
|
1172
|
+
if (lineLength <= maxLength) return;
|
|
1173
|
+
if (members.length === 1) {
|
|
1174
|
+
context.report({
|
|
1175
|
+
data: { maxLength },
|
|
1176
|
+
loc: {
|
|
1177
|
+
end: {
|
|
1178
|
+
column: lineLength,
|
|
1179
|
+
line: closingBrace.loc.end.line
|
|
1180
|
+
},
|
|
1181
|
+
start: {
|
|
1182
|
+
column: 0,
|
|
1183
|
+
line: openingBrace.loc.start.line
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1186
|
+
messageId: "exceedsMaxLength"
|
|
1187
|
+
});
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
context.report({
|
|
1191
|
+
data: { maxLength },
|
|
1192
|
+
fix: (fixer) => {
|
|
1193
|
+
const indent = sourceCode.getText().match(/^[\t ]*/)?.[0] ?? "";
|
|
1194
|
+
const fixed = [
|
|
1195
|
+
"{\n",
|
|
1196
|
+
`${indent} ${members.map((member, index) => {
|
|
1197
|
+
const memberText = sourceCode.getText(member).replace(/,\s*$/, "");
|
|
1198
|
+
if (!(index === members.length - 1)) return memberText + ",";
|
|
1199
|
+
return memberText;
|
|
1200
|
+
}).join(`\n${indent} `)}\n`,
|
|
1201
|
+
`${indent}}`
|
|
1202
|
+
].join("");
|
|
1203
|
+
return fixer.replaceTextRange([openingBrace.range[0], closingBrace.range[1]], fixed);
|
|
1204
|
+
},
|
|
1205
|
+
loc: {
|
|
1206
|
+
end: {
|
|
1207
|
+
column: lineLength,
|
|
1208
|
+
line: closingBrace.loc.end.line
|
|
1209
|
+
},
|
|
1210
|
+
start: {
|
|
1211
|
+
column: 0,
|
|
1212
|
+
line: openingBrace.loc.start.line
|
|
1213
|
+
}
|
|
1214
|
+
},
|
|
1215
|
+
messageId: "multipleOnSameLine"
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
//#endregion
|
|
1219
|
+
//#region src/rules/interfacePropertyLineBreak/defaultOptions.ts
|
|
1220
|
+
var defaultOptions$3 = { maxLength: 80 };
|
|
1221
|
+
//#endregion
|
|
1222
|
+
//#region src/rules/interfacePropertyLineBreak/getBraces.ts
|
|
1223
|
+
function getBraces$1(sourceCode, body) {
|
|
1224
|
+
const openingBrace = sourceCode.getTokenBefore(body.body[0]);
|
|
1225
|
+
const closingBrace = sourceCode.getTokenAfter(body.body[body.body.length - 1]);
|
|
1226
|
+
if (!openingBrace || !closingBrace) return null;
|
|
1227
|
+
return {
|
|
1228
|
+
closingBrace,
|
|
1229
|
+
openingBrace
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
//#endregion
|
|
1233
|
+
//#region src/rules/interfacePropertyLineBreak/checkInterface.ts
|
|
1234
|
+
function checkInterface(sourceCode, context, node) {
|
|
1235
|
+
const maxLength = (context.options[0] ?? {}).maxLength ?? defaultOptions$3.maxLength;
|
|
1236
|
+
const body = node.body;
|
|
1237
|
+
if (!body || body.body.length === 0) return;
|
|
1238
|
+
const braces = getBraces$1(sourceCode, body);
|
|
1239
|
+
if (!braces) return;
|
|
1240
|
+
if (braces.openingBrace.loc.start.line === braces.closingBrace.loc.end.line) checkSingleLineMembers(sourceCode, context, body.body, braces, maxLength);
|
|
1241
|
+
else checkMultilineMembers(sourceCode, context, body.body, maxLength);
|
|
1242
|
+
}
|
|
1243
|
+
//#endregion
|
|
1244
|
+
//#region src/rules/interfacePropertyLineBreak/index.ts
|
|
1245
|
+
var interfacePropertyLineBreak = {
|
|
1246
|
+
create(context) {
|
|
1247
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
1248
|
+
return { TSInterfaceDeclaration(node) {
|
|
1249
|
+
checkInterface(sourceCode, context, node);
|
|
1250
|
+
} };
|
|
1251
|
+
},
|
|
1252
|
+
meta: {
|
|
1253
|
+
docs: { description: "Enforce each interface member to be on its own line when line exceeds max length." },
|
|
1254
|
+
fixable: "code",
|
|
1255
|
+
messages: {
|
|
1256
|
+
exceedsMaxLength: "Interface line exceeds {{maxLength}} characters",
|
|
1257
|
+
multipleOnSameLine: "Interface members should each be on their own line when line exceeds {{maxLength}} characters"
|
|
1258
|
+
},
|
|
1259
|
+
schema: [{
|
|
1260
|
+
additionalProperties: false,
|
|
1261
|
+
properties: { maxLength: { type: "number" } },
|
|
1262
|
+
type: "object"
|
|
1263
|
+
}],
|
|
1264
|
+
type: "layout"
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
//#endregion
|
|
1268
|
+
//#region src/rules/maxDeclarationsPerFile/collectVariableDeclarators.ts
|
|
1269
|
+
function collectVariableDeclarators(node, types) {
|
|
1270
|
+
for (const declarator of node.declarations) if (declarator.id.type === "Identifier" && declarator.id.name) types.add(declarator.id.name);
|
|
1271
|
+
}
|
|
1272
|
+
//#endregion
|
|
1273
|
+
//#region src/rules/maxDeclarationsPerFile/isTopLevel.ts
|
|
1274
|
+
function isTopLevel(node) {
|
|
1275
|
+
if (node.parent?.type === "Program") return true;
|
|
1276
|
+
if (node.parent?.type === "ExportNamedDeclaration" && node.parent.parent?.type === "Program") return true;
|
|
1277
|
+
return false;
|
|
1278
|
+
}
|
|
1279
|
+
//#endregion
|
|
1280
|
+
//#region src/rules/maxDeclarationsPerFile/handleClassDeclaration.ts
|
|
1281
|
+
function handleClassDeclaration(node, functions) {
|
|
1282
|
+
if (isTopLevel(node) && node.id?.name) functions.add(node.id.name);
|
|
1283
|
+
}
|
|
1284
|
+
//#endregion
|
|
1285
|
+
//#region src/rules/maxDeclarationsPerFile/handleFunctionDeclaration.ts
|
|
1286
|
+
function handleFunctionDeclaration(node, functions) {
|
|
1287
|
+
if (isTopLevel(node) && node.id?.name) functions.add(node.id.name);
|
|
1288
|
+
}
|
|
1289
|
+
//#endregion
|
|
1290
|
+
//#region src/rules/maxDeclarationsPerFile/handleTSDeclareFunction.ts
|
|
1291
|
+
function handleTSDeclareFunction(node, functions) {
|
|
1292
|
+
if (isTopLevel(node) && node.id?.name) functions.add(node.id.name);
|
|
1293
|
+
}
|
|
1294
|
+
//#endregion
|
|
1295
|
+
//#region src/rules/maxDeclarationsPerFile/handleTSEnumDeclaration.ts
|
|
1296
|
+
function handleTSEnumDeclaration(node, types) {
|
|
1297
|
+
if (isTopLevel(node) && node.id?.name) types.add(node.id.name);
|
|
1298
|
+
}
|
|
1299
|
+
//#endregion
|
|
1300
|
+
//#region src/rules/maxDeclarationsPerFile/handleTSInterfaceDeclaration.ts
|
|
1301
|
+
function handleTSInterfaceDeclaration(node, types) {
|
|
1302
|
+
if (isTopLevel(node) && node.id?.name) types.add(node.id.name);
|
|
1303
|
+
}
|
|
1304
|
+
//#endregion
|
|
1305
|
+
//#region src/rules/maxDeclarationsPerFile/handleTSTypeAliasDeclaration.ts
|
|
1306
|
+
function handleTSTypeAliasDeclaration(node, types) {
|
|
1307
|
+
if (isTopLevel(node) && node.id?.name) types.add(node.id.name);
|
|
1308
|
+
}
|
|
1309
|
+
//#endregion
|
|
1310
|
+
//#region src/rules/maxDeclarationsPerFile/isExempt.ts
|
|
1311
|
+
function isExempt$1(filename) {
|
|
1312
|
+
const name = path.basename(filename, path.extname(filename));
|
|
1313
|
+
const isTest = name.endsWith(".test");
|
|
1314
|
+
const isSpec = name.endsWith(".spec");
|
|
1315
|
+
const isConfig = name.endsWith(".config");
|
|
1316
|
+
return isTest || isSpec || isConfig;
|
|
1317
|
+
}
|
|
1318
|
+
//#endregion
|
|
1319
|
+
//#region src/rules/maxDeclarationsPerFile/isExportedDeclaration.ts
|
|
1320
|
+
function isExportedDeclaration(parent) {
|
|
1321
|
+
return parent?.type === "ExportNamedDeclaration";
|
|
1322
|
+
}
|
|
1323
|
+
//#endregion
|
|
1324
|
+
//#region src/rules/maxDeclarationsPerFile/index.ts
|
|
1325
|
+
var maxDeclarationsPerFile = {
|
|
1326
|
+
create(context) {
|
|
1327
|
+
const filename = context.filename;
|
|
1328
|
+
if (isExempt$1(filename)) return {};
|
|
1329
|
+
const functions = /* @__PURE__ */ new Set();
|
|
1330
|
+
const types = /* @__PURE__ */ new Set();
|
|
1331
|
+
return {
|
|
1332
|
+
ClassDeclaration(node) {
|
|
1333
|
+
handleClassDeclaration(node, functions);
|
|
1334
|
+
},
|
|
1335
|
+
FunctionDeclaration(node) {
|
|
1336
|
+
handleFunctionDeclaration(node, functions);
|
|
1337
|
+
},
|
|
1338
|
+
"Program:exit"(_programNode) {
|
|
1339
|
+
const totalDeclarations = functions.size + types.size;
|
|
1340
|
+
if (totalDeclarations > 1) context.report({
|
|
1341
|
+
data: {
|
|
1342
|
+
count: totalDeclarations,
|
|
1343
|
+
functions: functions.size,
|
|
1344
|
+
types: types.size
|
|
1345
|
+
},
|
|
1346
|
+
messageId: "tooManyDeclarations",
|
|
1347
|
+
node: _programNode
|
|
1348
|
+
});
|
|
1349
|
+
},
|
|
1350
|
+
TSDeclareFunction(node) {
|
|
1351
|
+
handleTSDeclareFunction(node, functions);
|
|
1352
|
+
},
|
|
1353
|
+
TSEnumDeclaration(node) {
|
|
1354
|
+
handleTSEnumDeclaration(node, types);
|
|
1355
|
+
},
|
|
1356
|
+
TSInterfaceDeclaration(node) {
|
|
1357
|
+
handleTSInterfaceDeclaration(node, types);
|
|
1358
|
+
},
|
|
1359
|
+
TSTypeAliasDeclaration(node) {
|
|
1360
|
+
handleTSTypeAliasDeclaration(node, types);
|
|
1361
|
+
},
|
|
1362
|
+
VariableDeclaration(node) {
|
|
1363
|
+
if (!isTopLevel(node)) return;
|
|
1364
|
+
const parent = node.parent;
|
|
1365
|
+
if (!isExportedDeclaration(parent) && !node.declare) return;
|
|
1366
|
+
collectVariableDeclarators(node, types);
|
|
1367
|
+
},
|
|
1368
|
+
"VariableDeclaration > VariableDeclarator > ArrowFunctionExpression"(_node) {
|
|
1369
|
+
if (!isTopLevel(_node.parent?.parent)) return;
|
|
1370
|
+
const declarator = _node.parent;
|
|
1371
|
+
if (declarator.id.type === "Identifier" && declarator.id.name) functions.add(declarator.id.name);
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
},
|
|
1375
|
+
meta: {
|
|
1376
|
+
docs: { description: "Enforce single top-level declaration per file." },
|
|
1377
|
+
messages: { tooManyDeclarations: "File has {{count}} declarations. Put each function/class/const/type declaration in its own file." },
|
|
1378
|
+
schema: [],
|
|
1379
|
+
type: "suggestion"
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1382
|
+
//#endregion
|
|
1383
|
+
//#region src/rules/multilineUnionTypeAliases/createFix.ts
|
|
1384
|
+
function createFix(fixer, node, sourceCode) {
|
|
1385
|
+
const result = `\n${node.types.map((t) => sourceCode.getText(t)).map((t) => ` | ${t}`).join("\n")}`;
|
|
1386
|
+
return fixer.replaceText(node, result);
|
|
1387
|
+
}
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region src/rules/multilineUnionTypeAliases/isMultiline.ts
|
|
1390
|
+
function isMultiline(unionType) {
|
|
1391
|
+
const { end, start } = unionType.loc ?? {};
|
|
1392
|
+
return start?.line !== end?.line;
|
|
1393
|
+
}
|
|
1394
|
+
//#endregion
|
|
1395
|
+
//#region src/rules/multilineUnionTypeAliases/index.ts
|
|
1396
|
+
var multilineUnionTypeAliases = {
|
|
1397
|
+
create(context) {
|
|
1398
|
+
return { TSUnionType(node) {
|
|
1399
|
+
if (node.types.length < 2) return;
|
|
1400
|
+
const parent = node.parent;
|
|
1401
|
+
if (!parent || parent.type !== "TSTypeAliasDeclaration") return;
|
|
1402
|
+
const sourceCode = context.sourceCode;
|
|
1403
|
+
if (sourceCode.getText(node).trim().startsWith("|")) return;
|
|
1404
|
+
if (!isMultiline(node)) {
|
|
1405
|
+
context.report({
|
|
1406
|
+
fix: (fixer) => createFix(fixer, node, sourceCode),
|
|
1407
|
+
messageId: "singleLine",
|
|
1408
|
+
node
|
|
1409
|
+
});
|
|
1410
|
+
return;
|
|
1411
|
+
}
|
|
1412
|
+
context.report({
|
|
1413
|
+
fix: (fixer) => createFix(fixer, node, sourceCode),
|
|
1414
|
+
messageId: "missingPipes",
|
|
1415
|
+
node
|
|
1416
|
+
});
|
|
1417
|
+
} };
|
|
1418
|
+
},
|
|
1419
|
+
meta: {
|
|
1420
|
+
docs: { description: "Enforce union type aliases with multiple members to be on multiple lines." },
|
|
1421
|
+
fixable: "code",
|
|
1422
|
+
messages: {
|
|
1423
|
+
missingPipes: "Multiline union type aliases should have leading pipes on each member",
|
|
1424
|
+
singleLine: "Union type aliases with multiple members should be on multiple lines"
|
|
1425
|
+
},
|
|
1426
|
+
schema: [],
|
|
1427
|
+
type: "layout"
|
|
1428
|
+
}
|
|
1429
|
+
};
|
|
1430
|
+
//#endregion
|
|
1431
|
+
//#region src/rules/namingConvention/isExempt.ts
|
|
1432
|
+
function isExempt(name) {
|
|
1433
|
+
return name.startsWith("_");
|
|
1434
|
+
}
|
|
1435
|
+
//#endregion
|
|
1436
|
+
//#region src/rules/namingConvention/isPascalCase.ts
|
|
1437
|
+
function isPascalCase(name) {
|
|
1438
|
+
if (!/^[A-Z]/.test(name)) return false;
|
|
1439
|
+
return /^[A-Z][\dA-Za-z]*$/.test(name);
|
|
1440
|
+
}
|
|
1441
|
+
//#endregion
|
|
1442
|
+
//#region src/rules/namingConvention/isSeparator.ts
|
|
1443
|
+
function isSeparator(char) {
|
|
1444
|
+
return char === "_" || char === "-" || char === " ";
|
|
1445
|
+
}
|
|
1446
|
+
//#endregion
|
|
1447
|
+
//#region src/rules/namingConvention/isWordBoundary.ts
|
|
1448
|
+
function isWordBoundary(char, currentWord, prevChar, nextChar) {
|
|
1449
|
+
if (!currentWord) return false;
|
|
1450
|
+
const isUpper = /[A-Z]/.test(char);
|
|
1451
|
+
const prevIsUpper = /[A-Z]/.test(prevChar);
|
|
1452
|
+
const nextIsLower = /[a-z]/.test(nextChar);
|
|
1453
|
+
if (isUpper) return !prevIsUpper || prevIsUpper && nextIsLower;
|
|
1454
|
+
return false;
|
|
1455
|
+
}
|
|
1456
|
+
//#endregion
|
|
1457
|
+
//#region src/rules/namingConvention/capitalize.ts
|
|
1458
|
+
function capitalize(word) {
|
|
1459
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
1460
|
+
}
|
|
1461
|
+
//#endregion
|
|
1462
|
+
//#region src/rules/namingConvention/wordsToCamelCase.ts
|
|
1463
|
+
function wordsToCamelCase(words) {
|
|
1464
|
+
if (words.length === 0) return "";
|
|
1465
|
+
if (words.length === 1) return words[0].toLowerCase();
|
|
1466
|
+
return words[0].toLowerCase() + words.slice(1).map(capitalize).join("");
|
|
1467
|
+
}
|
|
1468
|
+
//#endregion
|
|
1469
|
+
//#region src/rules/namingConvention/toCamelCase.ts
|
|
1470
|
+
function toCamelCase(name) {
|
|
1471
|
+
const words = [];
|
|
1472
|
+
let currentWord = "";
|
|
1473
|
+
for (let i = 0; i < name.length; i++) {
|
|
1474
|
+
const char = name[i];
|
|
1475
|
+
const prevChar = i > 0 ? name[i - 1] : "";
|
|
1476
|
+
const nextChar = i < name.length - 1 ? name[i + 1] : "";
|
|
1477
|
+
if (isSeparator(char)) {
|
|
1478
|
+
if (currentWord) {
|
|
1479
|
+
words.push(currentWord.toLowerCase());
|
|
1480
|
+
currentWord = "";
|
|
1481
|
+
}
|
|
1482
|
+
continue;
|
|
1483
|
+
}
|
|
1484
|
+
if (isWordBoundary(char, currentWord, prevChar, nextChar)) {
|
|
1485
|
+
words.push(currentWord.toLowerCase());
|
|
1486
|
+
currentWord = char;
|
|
1487
|
+
continue;
|
|
1488
|
+
}
|
|
1489
|
+
currentWord += char;
|
|
1490
|
+
}
|
|
1491
|
+
if (currentWord) words.push(currentWord.toLowerCase());
|
|
1492
|
+
return wordsToCamelCase(words);
|
|
1493
|
+
}
|
|
1494
|
+
//#endregion
|
|
1495
|
+
//#region src/rules/namingConvention/toPascalCase.ts
|
|
1496
|
+
function toPascalCase$1(name) {
|
|
1497
|
+
const camelCase = toCamelCase(name);
|
|
1498
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
1499
|
+
}
|
|
1500
|
+
//#endregion
|
|
1501
|
+
//#region src/rules/namingConvention/checkClass.ts
|
|
1502
|
+
function checkClass(id, context) {
|
|
1503
|
+
if (!id) return;
|
|
1504
|
+
const name = id.name;
|
|
1505
|
+
if (isExempt(name)) return;
|
|
1506
|
+
if (!isPascalCase(name)) context.report({
|
|
1507
|
+
data: {
|
|
1508
|
+
name,
|
|
1509
|
+
type: "Class"
|
|
1510
|
+
},
|
|
1511
|
+
fix(fixer) {
|
|
1512
|
+
return fixer.replaceText(id, toPascalCase$1(name));
|
|
1513
|
+
},
|
|
1514
|
+
messageId: "notPascalCase",
|
|
1515
|
+
node: id
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
//#endregion
|
|
1519
|
+
//#region src/rules/namingConvention/checkNamedEntity.ts
|
|
1520
|
+
function checkNamedEntity(name, node, type, context) {
|
|
1521
|
+
if (isExempt(name)) return;
|
|
1522
|
+
if (!isPascalCase(name)) context.report({
|
|
1523
|
+
data: {
|
|
1524
|
+
name,
|
|
1525
|
+
type
|
|
1526
|
+
},
|
|
1527
|
+
fix(fixer) {
|
|
1528
|
+
return fixer.replaceText(node, toPascalCase$1(name));
|
|
1529
|
+
},
|
|
1530
|
+
messageId: "notPascalCase",
|
|
1531
|
+
node
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
//#endregion
|
|
1535
|
+
//#region src/rules/namingConvention/isCamelCase.ts
|
|
1536
|
+
function isCamelCase(name) {
|
|
1537
|
+
if (!/^[a-z]/.test(name)) return false;
|
|
1538
|
+
return /^[a-z][\dA-Za-z]*$/.test(name);
|
|
1539
|
+
}
|
|
1540
|
+
//#endregion
|
|
1541
|
+
//#region src/rules/namingConvention/isUpperCase.ts
|
|
1542
|
+
function isUpperCase(name) {
|
|
1543
|
+
return /^[A-Z][\dA-Z_]*$/.test(name);
|
|
1544
|
+
}
|
|
1545
|
+
//#endregion
|
|
1546
|
+
//#region src/rules/namingConvention/checkConstant.ts
|
|
1547
|
+
function checkConstant(name, node, context) {
|
|
1548
|
+
if (!isCamelCase(name) && !isUpperCase(name)) context.report({
|
|
1549
|
+
data: { name },
|
|
1550
|
+
messageId: "notUpperCase",
|
|
1551
|
+
node
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
//#endregion
|
|
1555
|
+
//#region src/rules/namingConvention/checkVariable.ts
|
|
1556
|
+
function checkVariable(name, node, context) {
|
|
1557
|
+
if (!isCamelCase(name)) context.report({
|
|
1558
|
+
data: { name },
|
|
1559
|
+
fix(fixer) {
|
|
1560
|
+
return fixer.replaceText(node, toCamelCase(name));
|
|
1561
|
+
},
|
|
1562
|
+
messageId: "notCamelCase",
|
|
1563
|
+
node
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
//#endregion
|
|
1567
|
+
//#region src/rules/namingConvention/isFunction.ts
|
|
1568
|
+
function isFunction(init) {
|
|
1569
|
+
if (!init) return false;
|
|
1570
|
+
return init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression";
|
|
1571
|
+
}
|
|
1572
|
+
//#endregion
|
|
1573
|
+
//#region src/rules/namingConvention/checkVariableDeclarator.ts
|
|
1574
|
+
function checkVariableDeclarator(node, context) {
|
|
1575
|
+
const id = node.id;
|
|
1576
|
+
const name = id.name;
|
|
1577
|
+
if (isExempt(name)) return;
|
|
1578
|
+
if (isFunction(node.init)) return;
|
|
1579
|
+
const parent = node.parent;
|
|
1580
|
+
if (parent?.type !== "VariableDeclaration") return;
|
|
1581
|
+
if (parent.kind === "const") checkConstant(name, id, context);
|
|
1582
|
+
else checkVariable(name, id, context);
|
|
1583
|
+
}
|
|
1584
|
+
//#endregion
|
|
1585
|
+
//#region src/rules/namingConvention/getFunctionName.ts
|
|
1586
|
+
function getFunctionName(node, parent) {
|
|
1587
|
+
if (node.type === "FunctionDeclaration" && node.id) return node.id.name;
|
|
1588
|
+
if ((node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") && parent?.type === "VariableDeclarator" && parent.id.type === "Identifier") return parent.id.name;
|
|
1589
|
+
return null;
|
|
1590
|
+
}
|
|
1591
|
+
//#endregion
|
|
1592
|
+
//#region src/rules/namingConvention/getReturnTypeText.ts
|
|
1593
|
+
function getReturnTypeText(sourceCode, node) {
|
|
1594
|
+
if (!node.returnType) return void 0;
|
|
1595
|
+
return sourceCode.getText(node.returnType.typeAnnotation);
|
|
1596
|
+
}
|
|
1597
|
+
//#endregion
|
|
1598
|
+
//#region src/rules/namingConvention/isReactComponent.ts
|
|
1599
|
+
function isReactComponent(returnTypeText) {
|
|
1600
|
+
if (!returnTypeText) return false;
|
|
1601
|
+
return [
|
|
1602
|
+
"JSX.Element",
|
|
1603
|
+
"React.JSX.Element",
|
|
1604
|
+
"ReactElement",
|
|
1605
|
+
"ReactNode"
|
|
1606
|
+
].some((pattern) => returnTypeText.includes(pattern));
|
|
1607
|
+
}
|
|
1608
|
+
//#endregion
|
|
1609
|
+
//#region src/rules/namingConvention/messageIds.ts
|
|
1610
|
+
var messageIds$4 = {
|
|
1611
|
+
notCamelCase: "Function \"{{name}}\" should use camelCase",
|
|
1612
|
+
notPascalCase: "{{type}} \"{{name}}\" should use PascalCase",
|
|
1613
|
+
notUpperCase: "Constant \"{{name}}\" should use UPPER_CASE"
|
|
1614
|
+
};
|
|
1615
|
+
//#endregion
|
|
1616
|
+
//#region src/rules/namingConvention/getFunctionIdentifierNodeForFixer.ts
|
|
1617
|
+
function getFunctionIdentifierNodeForFixer(node, parent) {
|
|
1618
|
+
if (node.type === "FunctionDeclaration") return node.id;
|
|
1619
|
+
if (parent?.type === "VariableDeclarator") return parent.id;
|
|
1620
|
+
return null;
|
|
1621
|
+
}
|
|
1622
|
+
//#endregion
|
|
1623
|
+
//#region src/rules/namingConvention/getFunctionNameForFixer.ts
|
|
1624
|
+
function getFunctionNameForFixer(node, parent) {
|
|
1625
|
+
if (node.type === "FunctionDeclaration" && node.id) return node.id.name;
|
|
1626
|
+
if (parent?.type === "VariableDeclarator" && parent.id.type === "Identifier") return parent.id.name;
|
|
1627
|
+
return "";
|
|
1628
|
+
}
|
|
1629
|
+
//#endregion
|
|
1630
|
+
//#region src/rules/namingConvention/createFunctionFixer.ts
|
|
1631
|
+
function createFunctionFixer(node, parent, convert) {
|
|
1632
|
+
return (fixer) => {
|
|
1633
|
+
const fixedName = convert(getFunctionNameForFixer(node, parent));
|
|
1634
|
+
const identifierNode = getFunctionIdentifierNodeForFixer(node, parent);
|
|
1635
|
+
if (identifierNode) return fixer.replaceText(identifierNode, fixedName);
|
|
1636
|
+
return null;
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
//#endregion
|
|
1640
|
+
//#region src/rules/namingConvention/getFunctionReportNode.ts
|
|
1641
|
+
function getFunctionReportNode(node, parent) {
|
|
1642
|
+
if (node.type === "FunctionDeclaration") return node;
|
|
1643
|
+
return parent ?? node;
|
|
1644
|
+
}
|
|
1645
|
+
//#endregion
|
|
1646
|
+
//#region src/rules/namingConvention/reportComponentViolation.ts
|
|
1647
|
+
function reportComponentViolation(node, parent, name, context) {
|
|
1648
|
+
if (isPascalCase(name)) return;
|
|
1649
|
+
context.report({
|
|
1650
|
+
data: {
|
|
1651
|
+
name,
|
|
1652
|
+
type: "React component"
|
|
1653
|
+
},
|
|
1654
|
+
fix: createFunctionFixer(node, parent, toPascalCase$1),
|
|
1655
|
+
messageId: "notPascalCase",
|
|
1656
|
+
node: getFunctionReportNode(node, parent)
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
//#endregion
|
|
1660
|
+
//#region src/rules/namingConvention/reportFunctionViolation.ts
|
|
1661
|
+
function reportFunctionViolation(node, parent, name, context) {
|
|
1662
|
+
if (isCamelCase(name)) return;
|
|
1663
|
+
context.report({
|
|
1664
|
+
data: { name },
|
|
1665
|
+
fix: createFunctionFixer(node, parent, toCamelCase),
|
|
1666
|
+
messageId: "notCamelCase",
|
|
1667
|
+
node: getFunctionReportNode(node, parent)
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
//#endregion
|
|
1671
|
+
//#region src/rules/namingConvention/index.ts
|
|
1672
|
+
var namingConvention = {
|
|
1673
|
+
create(context) {
|
|
1674
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
1675
|
+
return {
|
|
1676
|
+
ArrowFunctionExpression(node) {
|
|
1677
|
+
checkFunction(node, node.parent);
|
|
1678
|
+
},
|
|
1679
|
+
ClassDeclaration(node) {
|
|
1680
|
+
checkClass(node.id, context);
|
|
1681
|
+
},
|
|
1682
|
+
ClassExpression(node) {
|
|
1683
|
+
checkClass(node.id, context);
|
|
1684
|
+
},
|
|
1685
|
+
FunctionDeclaration(node) {
|
|
1686
|
+
checkFunction(node);
|
|
1687
|
+
},
|
|
1688
|
+
FunctionExpression(node) {
|
|
1689
|
+
checkFunction(node, node.parent);
|
|
1690
|
+
},
|
|
1691
|
+
TSEnumDeclaration(node) {
|
|
1692
|
+
checkNamedEntity(node.id.name, node.id, "Enum", context);
|
|
1693
|
+
},
|
|
1694
|
+
TSInterfaceDeclaration(node) {
|
|
1695
|
+
checkNamedEntity(node.id.name, node.id, "Interface", context);
|
|
1696
|
+
},
|
|
1697
|
+
TSTypeAliasDeclaration(node) {
|
|
1698
|
+
if (node.id.type !== "Identifier") return;
|
|
1699
|
+
checkNamedEntity(node.id.name, node.id, "Type", context);
|
|
1700
|
+
},
|
|
1701
|
+
VariableDeclarator(node) {
|
|
1702
|
+
if (node.id.type !== "Identifier") return;
|
|
1703
|
+
checkVariableDeclarator(node, context);
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
function checkFunction(node, parent) {
|
|
1707
|
+
const name = getFunctionName(node, parent);
|
|
1708
|
+
if (!name || isExempt(name)) return;
|
|
1709
|
+
if (isReactComponent(getReturnTypeText(sourceCode, node))) reportComponentViolation(node, parent, name, context);
|
|
1710
|
+
else reportFunctionViolation(node, parent, name, context);
|
|
1711
|
+
}
|
|
1712
|
+
},
|
|
1713
|
+
meta: {
|
|
1714
|
+
docs: { description: "Enforce consistent naming conventions." },
|
|
1715
|
+
fixable: "code",
|
|
1716
|
+
messages: messageIds$4,
|
|
1717
|
+
schema: [],
|
|
1718
|
+
type: "suggestion"
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
//#endregion
|
|
1722
|
+
//#region src/rules/noInlineObjectTypes/checkTypeParameters.ts
|
|
1723
|
+
function checkTypeParameters(node, containsInline) {
|
|
1724
|
+
if (!("typeParameters" in node) || !node.typeParameters) return null;
|
|
1725
|
+
for (const param of node.typeParameters.params) {
|
|
1726
|
+
const result = containsInline(param);
|
|
1727
|
+
if (result) return result;
|
|
1728
|
+
}
|
|
1729
|
+
return null;
|
|
1730
|
+
}
|
|
1731
|
+
//#endregion
|
|
1732
|
+
//#region src/rules/noInlineObjectTypes/checkUnionOrIntersectionTypes.ts
|
|
1733
|
+
function checkUnionOrIntersectionTypes(node, containsInline) {
|
|
1734
|
+
for (const type of node.types) {
|
|
1735
|
+
const result = containsInline(type);
|
|
1736
|
+
if (result) return result;
|
|
1737
|
+
}
|
|
1738
|
+
return null;
|
|
1739
|
+
}
|
|
1740
|
+
//#endregion
|
|
1741
|
+
//#region src/rules/noInlineObjectTypes/isInlineObjectType.ts
|
|
1742
|
+
function isInlineObjectType(node) {
|
|
1743
|
+
return node.type === "TSTypeLiteral";
|
|
1744
|
+
}
|
|
1745
|
+
//#endregion
|
|
1746
|
+
//#region src/rules/noInlineObjectTypes/containsInlineObjectType.ts
|
|
1747
|
+
function containsInlineObjectType(node) {
|
|
1748
|
+
if (isInlineObjectType(node)) return node;
|
|
1749
|
+
if (node.type === "TSIntersectionType" || node.type === "TSUnionType") {
|
|
1750
|
+
const result = checkUnionOrIntersectionTypes(node, containsInlineObjectType);
|
|
1751
|
+
if (result) return result;
|
|
1752
|
+
}
|
|
1753
|
+
if (node.type === "TSArrayType") return containsInlineObjectType(node.elementType);
|
|
1754
|
+
const typeParamResult = checkTypeParameters(node, containsInlineObjectType);
|
|
1755
|
+
if (typeParamResult) return typeParamResult;
|
|
1756
|
+
if (node.type === "TSTypeAnnotation") return containsInlineObjectType(node.typeAnnotation);
|
|
1757
|
+
return null;
|
|
1758
|
+
}
|
|
1759
|
+
//#endregion
|
|
1760
|
+
//#region src/rules/noInlineObjectTypes/toPascalCase.ts
|
|
1761
|
+
function toPascalCase(str) {
|
|
1762
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1763
|
+
}
|
|
1764
|
+
//#endregion
|
|
1765
|
+
//#region src/rules/noInlineObjectTypes/getInlineTypeName.ts
|
|
1766
|
+
function getInlineTypeName(usedNames, _existingInterfaces, parameterName) {
|
|
1767
|
+
const baseName = parameterName ? toPascalCase(parameterName) : "InlineType";
|
|
1768
|
+
if (!usedNames.has(baseName)) {
|
|
1769
|
+
usedNames.add(baseName);
|
|
1770
|
+
return baseName;
|
|
1771
|
+
}
|
|
1772
|
+
let counter = 2;
|
|
1773
|
+
while (usedNames.has(`${baseName}${counter}`)) counter++;
|
|
1774
|
+
const name = `${baseName}${counter}`;
|
|
1775
|
+
usedNames.add(name);
|
|
1776
|
+
return name;
|
|
1777
|
+
}
|
|
1778
|
+
//#endregion
|
|
1779
|
+
//#region src/rules/noInlineObjectTypes/getParameterNameFromFunction.ts
|
|
1780
|
+
function getParameterNameFromFunction(parent) {
|
|
1781
|
+
if (parent.type === "ArrowFunctionExpression" || parent.type === "FunctionDeclaration" || parent.type === "FunctionExpression") return parent.id?.name;
|
|
1782
|
+
}
|
|
1783
|
+
//#endregion
|
|
1784
|
+
//#region src/rules/noInlineObjectTypes/getParameterNameFromIdentifier.ts
|
|
1785
|
+
function getParameterNameFromIdentifier(parent) {
|
|
1786
|
+
const grandParent = parent.parent;
|
|
1787
|
+
if (grandParent?.type === "ArrowFunctionExpression" || grandParent?.type === "FunctionDeclaration" || grandParent?.type === "FunctionExpression") return parent.name;
|
|
1788
|
+
}
|
|
1789
|
+
//#endregion
|
|
1790
|
+
//#region src/rules/noInlineObjectTypes/getParameterNameFromObjectPattern.ts
|
|
1791
|
+
function getParameterNameFromObjectPattern(parent) {
|
|
1792
|
+
const grandParent = parent.parent;
|
|
1793
|
+
if (grandParent?.type === "ArrowFunctionExpression" || grandParent?.type === "FunctionDeclaration" || grandParent?.type === "FunctionExpression") return "Options";
|
|
1794
|
+
}
|
|
1795
|
+
//#endregion
|
|
1796
|
+
//#region src/rules/noInlineObjectTypes/getTopLevelDeclaration.ts
|
|
1797
|
+
function getTopLevelDeclaration(node) {
|
|
1798
|
+
let current = node;
|
|
1799
|
+
const topLevelTypes = new Set([
|
|
1800
|
+
"ArrowFunctionExpression",
|
|
1801
|
+
"FunctionDeclaration",
|
|
1802
|
+
"FunctionExpression",
|
|
1803
|
+
"TSInterfaceDeclaration",
|
|
1804
|
+
"TSTypeAliasDeclaration",
|
|
1805
|
+
"VariableDeclaration"
|
|
1806
|
+
]);
|
|
1807
|
+
while (current) {
|
|
1808
|
+
if (topLevelTypes.has(current.type)) {
|
|
1809
|
+
const parent = current.parent;
|
|
1810
|
+
if (parent?.type === "ExportNamedDeclaration" && parent) return {
|
|
1811
|
+
insertLocation: parent,
|
|
1812
|
+
isExported: true,
|
|
1813
|
+
node: current
|
|
1814
|
+
};
|
|
1815
|
+
return {
|
|
1816
|
+
insertLocation: current,
|
|
1817
|
+
isExported: false,
|
|
1818
|
+
node: current
|
|
1819
|
+
};
|
|
1820
|
+
}
|
|
1821
|
+
current = current.parent;
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
//#endregion
|
|
1825
|
+
//#region src/rules/noInlineObjectTypes/handleInlineType.ts
|
|
1826
|
+
function handleInlineType(node, typeLiteral, inlineTypes) {
|
|
1827
|
+
const result = getTopLevelDeclaration(node);
|
|
1828
|
+
if (!result) return;
|
|
1829
|
+
let parameterName;
|
|
1830
|
+
const parent = node.parent;
|
|
1831
|
+
if (parent?.type === "Identifier") parameterName = getParameterNameFromIdentifier(parent);
|
|
1832
|
+
else if (parent?.type === "ObjectPattern") parameterName = getParameterNameFromObjectPattern(parent);
|
|
1833
|
+
else parameterName = getParameterNameFromFunction(parent);
|
|
1834
|
+
inlineTypes.push({
|
|
1835
|
+
annotationNode: node,
|
|
1836
|
+
insertLocation: result.insertLocation,
|
|
1837
|
+
isExported: result.isExported,
|
|
1838
|
+
location: result.node,
|
|
1839
|
+
parameterName,
|
|
1840
|
+
typeLiteral
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
//#endregion
|
|
1844
|
+
//#region src/rules/noInlineObjectTypes/isIdentifierInFunction.ts
|
|
1845
|
+
function isIdentifierInFunction(parent) {
|
|
1846
|
+
return parent?.type === "Identifier" && (parent.parent?.type === "FunctionDeclaration" || parent.parent?.type === "FunctionExpression" || parent.parent?.type === "ArrowFunctionExpression");
|
|
1847
|
+
}
|
|
1848
|
+
//#endregion
|
|
1849
|
+
//#region src/rules/noInlineObjectTypes/isPropertySignatureInTypeLiteral.ts
|
|
1850
|
+
function isPropertySignatureInTypeLiteral(parent) {
|
|
1851
|
+
return parent?.type === "TSPropertySignature" && (parent.parent?.type === "TSTypeLiteral" || parent.parent?.type === "TSInterfaceBody");
|
|
1852
|
+
}
|
|
1853
|
+
//#endregion
|
|
1854
|
+
//#region src/rules/noInlineObjectTypes/traverseUpForTypeLiteral.ts
|
|
1855
|
+
function traverseUpForTypeLiteral(current) {
|
|
1856
|
+
const skipTypes = new Set([
|
|
1857
|
+
"TSArrayType",
|
|
1858
|
+
"TSIntersectionType",
|
|
1859
|
+
"TSPropertySignature",
|
|
1860
|
+
"TSTypeReference",
|
|
1861
|
+
"TSUnionType"
|
|
1862
|
+
]);
|
|
1863
|
+
while (current) {
|
|
1864
|
+
if (current.type === "TSTypeLiteral") return true;
|
|
1865
|
+
if (skipTypes.has(current.type)) {
|
|
1866
|
+
current = current.parent;
|
|
1867
|
+
continue;
|
|
1868
|
+
}
|
|
1869
|
+
break;
|
|
1870
|
+
}
|
|
1871
|
+
return false;
|
|
1872
|
+
}
|
|
1873
|
+
//#endregion
|
|
1874
|
+
//#region src/rules/noInlineObjectTypes/isNestedTypeAnnotation.ts
|
|
1875
|
+
function isNestedTypeAnnotation(node) {
|
|
1876
|
+
const parent = node.parent;
|
|
1877
|
+
if (isPropertySignatureInTypeLiteral(parent)) return true;
|
|
1878
|
+
if (isIdentifierInFunction(parent)) return false;
|
|
1879
|
+
if (parent?.type === "ArrowFunctionExpression" || parent?.type === "FunctionDeclaration" || parent?.type === "FunctionExpression") return false;
|
|
1880
|
+
return traverseUpForTypeLiteral(parent);
|
|
1881
|
+
}
|
|
1882
|
+
//#endregion
|
|
1883
|
+
//#region src/rules/noInlineObjectTypes/prepareFix.ts
|
|
1884
|
+
function prepareFix(sourceCode, inlineTypes) {
|
|
1885
|
+
const interfaceBlock = inlineTypes.map(({ name, typeLiteral }) => {
|
|
1886
|
+
return `interface ${name} ${sourceCode.getText(typeLiteral)}`;
|
|
1887
|
+
}).join("\n");
|
|
1888
|
+
const replacements = inlineTypes.map(({ name, typeLiteral }) => ({
|
|
1889
|
+
name,
|
|
1890
|
+
typeLiteral
|
|
1891
|
+
}));
|
|
1892
|
+
return {
|
|
1893
|
+
firstUsageLocation: inlineTypes[0].typeLiteral,
|
|
1894
|
+
interfaceBlock,
|
|
1895
|
+
replacements
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
//#endregion
|
|
1899
|
+
//#region src/rules/noInlineObjectTypes/index.ts
|
|
1900
|
+
var noInlineObjectTypes = {
|
|
1901
|
+
create(context) {
|
|
1902
|
+
const sourceCode = context.sourceCode;
|
|
1903
|
+
const inlineTypes = [];
|
|
1904
|
+
return {
|
|
1905
|
+
TSTypeAnnotation(node) {
|
|
1906
|
+
if (isNestedTypeAnnotation(node)) return;
|
|
1907
|
+
const typeLiteral = containsInlineObjectType(node);
|
|
1908
|
+
if (!typeLiteral) return;
|
|
1909
|
+
handleInlineType(node, typeLiteral, inlineTypes);
|
|
1910
|
+
},
|
|
1911
|
+
"Program:exit"() {
|
|
1912
|
+
if (inlineTypes.length === 0) return;
|
|
1913
|
+
const usedNames = /* @__PURE__ */ new Set();
|
|
1914
|
+
const locations = [...new Set(inlineTypes.map((t) => t.insertLocation))];
|
|
1915
|
+
for (const loc of locations) {
|
|
1916
|
+
const typesAtLocation = inlineTypes.filter((t) => t.insertLocation === loc);
|
|
1917
|
+
const fixResult = prepareFix(sourceCode, typesAtLocation.map((entry) => {
|
|
1918
|
+
return {
|
|
1919
|
+
name: getInlineTypeName(usedNames, [], entry.parameterName),
|
|
1920
|
+
parameterName: entry.parameterName,
|
|
1921
|
+
typeLiteral: entry.typeLiteral
|
|
1922
|
+
};
|
|
1923
|
+
}));
|
|
1924
|
+
context.report({
|
|
1925
|
+
fix(fixer) {
|
|
1926
|
+
const fixes = [];
|
|
1927
|
+
for (const replacement of fixResult.replacements) fixes.push(fixer.replaceText(replacement.typeLiteral, replacement.name));
|
|
1928
|
+
if (typesAtLocation[0].isExported && typesAtLocation[0].insertLocation.type === "ExportNamedDeclaration") fixes.push(fixer.insertTextAfter(typesAtLocation[0].insertLocation, `\n${fixResult.interfaceBlock}`));
|
|
1929
|
+
else fixes.push(fixer.insertTextBefore(loc, `${fixResult.interfaceBlock}\n`));
|
|
1930
|
+
return fixes;
|
|
1931
|
+
},
|
|
1932
|
+
messageId: "inlineObjectType",
|
|
1933
|
+
node: typesAtLocation[0].annotationNode
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
},
|
|
1939
|
+
meta: {
|
|
1940
|
+
docs: { description: "Disallow inline object type literals in type annotations." },
|
|
1941
|
+
fixable: "code",
|
|
1942
|
+
messages: { inlineObjectType: "Inline object types are not allowed. Use a named interface or type instead." },
|
|
1943
|
+
schema: [],
|
|
1944
|
+
type: "suggestion"
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
//#endregion
|
|
1948
|
+
//#region src/rules/noUnnecessaryBraces/getReplacementText.ts
|
|
1949
|
+
function getReplacementText(statementText, baseIndent, hasElseAfter) {
|
|
1950
|
+
const statementIndent = `${baseIndent} `;
|
|
1951
|
+
if (hasElseAfter) return `\n${statementIndent}${statementText}\n${baseIndent}`;
|
|
1952
|
+
return `\n${statementIndent}${statementText}`;
|
|
1953
|
+
}
|
|
1954
|
+
//#endregion
|
|
1955
|
+
//#region src/rules/noUnnecessaryBraces/checkBlockStatement.ts
|
|
1956
|
+
function checkBlockStatement(node, context) {
|
|
1957
|
+
if (node.body.length !== 1) return;
|
|
1958
|
+
const statement = node.body[0];
|
|
1959
|
+
const sourceCode = context.getSourceCode();
|
|
1960
|
+
if (isSingleLineStatement(statement, sourceCode)) context.report({
|
|
1961
|
+
fix(fixer) {
|
|
1962
|
+
const statementText = sourceCode.getText(statement);
|
|
1963
|
+
const tokenBefore = sourceCode.getTokenBefore(node);
|
|
1964
|
+
const baseIndent = getLineIndent(sourceCode, tokenBefore?.loc?.start?.line ?? node.loc?.start?.line ?? 1);
|
|
1965
|
+
const range = [tokenBefore ? tokenBefore.range[1] : node.range[0], node.range[1]];
|
|
1966
|
+
const tokenAfter = sourceCode.getTokenAfter(node);
|
|
1967
|
+
const replacementText = getReplacementText(statementText, baseIndent, tokenAfter && tokenAfter.value === "else");
|
|
1968
|
+
return fixer.replaceTextRange(range, replacementText);
|
|
1969
|
+
},
|
|
1970
|
+
messageId: "unnecessaryBraces",
|
|
1971
|
+
node
|
|
1972
|
+
});
|
|
1973
|
+
}
|
|
1974
|
+
//#endregion
|
|
1975
|
+
//#region src/rules/shared/detectIndentStep.ts
|
|
1976
|
+
function detectIndentStep(sourceCode) {
|
|
1977
|
+
const lines = sourceCode.getText().split("\n");
|
|
1978
|
+
const indentCounts = /* @__PURE__ */ new Map();
|
|
1979
|
+
for (const line of lines) {
|
|
1980
|
+
const match = line.match(/^( *)/);
|
|
1981
|
+
if (match) {
|
|
1982
|
+
const spaces = match[1].length;
|
|
1983
|
+
if (spaces > 0) indentCounts.set(spaces, (indentCounts.get(spaces) ?? 0) + 1);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
const sortedIndents = Array.from(indentCounts.entries()).filter(([spaces]) => spaces > 0).sort((a, b) => a[0] - b[0]);
|
|
1987
|
+
if (sortedIndents.length === 0) return 2;
|
|
1988
|
+
const minIndent = sortedIndents[0][0];
|
|
1989
|
+
for (const step of [2, 4]) if (sortedIndents.every(([n]) => n % step === 0)) return step;
|
|
1990
|
+
return minIndent;
|
|
1991
|
+
}
|
|
1992
|
+
//#endregion
|
|
1993
|
+
//#region src/rules/shared/reindentText.ts
|
|
1994
|
+
function reindentText(text, newBaseIndent, indentStep) {
|
|
1995
|
+
const lines = text.split("\n");
|
|
1996
|
+
let minIndent = Infinity;
|
|
1997
|
+
for (let i = 1; i < lines.length; i++) {
|
|
1998
|
+
const line = lines[i];
|
|
1999
|
+
if (line.trim() === "") continue;
|
|
2000
|
+
const match = line.match(/^( *)/);
|
|
2001
|
+
if (match) minIndent = Math.min(minIndent, match[1].length);
|
|
2002
|
+
}
|
|
2003
|
+
if (minIndent === Infinity) return lines.map((line) => {
|
|
2004
|
+
if (line.trim() === "") return "";
|
|
2005
|
+
return newBaseIndent + indentStep + line.trimStart();
|
|
2006
|
+
}).join("\n");
|
|
2007
|
+
return lines.map((line, index) => {
|
|
2008
|
+
if (line.trim() === "") return "";
|
|
2009
|
+
if (index === 0) return newBaseIndent + indentStep + line.trimStart();
|
|
2010
|
+
const relativeIndent = line.slice(minIndent);
|
|
2011
|
+
return newBaseIndent + indentStep + relativeIndent;
|
|
2012
|
+
}).join("\n");
|
|
2013
|
+
}
|
|
2014
|
+
//#endregion
|
|
2015
|
+
//#region src/rules/noUnnecessaryBraces/checkNonBlockStatement.ts
|
|
2016
|
+
function checkNonBlockStatement(node, context) {
|
|
2017
|
+
if (node.type === "BlockStatement") return;
|
|
2018
|
+
const sourceCode = context.getSourceCode();
|
|
2019
|
+
if (!isSingleLineStatement(node, sourceCode)) context.report({
|
|
2020
|
+
fix(fixer) {
|
|
2021
|
+
const statementText = sourceCode.getText(node);
|
|
2022
|
+
const baseIndent = getLineIndent(sourceCode, node.parent?.loc?.start?.line ?? node.loc?.start?.line ?? 1);
|
|
2023
|
+
const indentStepSize = detectIndentStep(sourceCode);
|
|
2024
|
+
const fixed = `{\n${reindentText(statementText, baseIndent, " ".repeat(indentStepSize))}\n${baseIndent}}`;
|
|
2025
|
+
return [fixer.replaceText(node, fixed)];
|
|
2026
|
+
},
|
|
2027
|
+
messageId: "missingBraces",
|
|
2028
|
+
node
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
2031
|
+
//#endregion
|
|
2032
|
+
//#region src/rules/noUnnecessaryBraces/checkDoWhileStatement.ts
|
|
2033
|
+
function checkDoWhileStatement(node, context) {
|
|
2034
|
+
if (node.body.type === "BlockStatement") checkBlockStatement(node.body, context);
|
|
2035
|
+
else checkNonBlockStatement(node.body, context);
|
|
2036
|
+
}
|
|
2037
|
+
//#endregion
|
|
2038
|
+
//#region src/rules/noUnnecessaryBraces/checkForInStatement.ts
|
|
2039
|
+
function checkForInStatement(node, context) {
|
|
2040
|
+
if (node.body.type === "BlockStatement") checkBlockStatement(node.body, context);
|
|
2041
|
+
else checkNonBlockStatement(node.body, context);
|
|
2042
|
+
}
|
|
2043
|
+
//#endregion
|
|
2044
|
+
//#region src/rules/noUnnecessaryBraces/checkForOfStatement.ts
|
|
2045
|
+
function checkForOfStatement(node, context) {
|
|
2046
|
+
if (node.body.type === "BlockStatement") checkBlockStatement(node.body, context);
|
|
2047
|
+
else checkNonBlockStatement(node.body, context);
|
|
2048
|
+
}
|
|
2049
|
+
//#endregion
|
|
2050
|
+
//#region src/rules/noUnnecessaryBraces/checkForStatement.ts
|
|
2051
|
+
function checkForStatement(node, context) {
|
|
2052
|
+
if (node.body.type === "BlockStatement") checkBlockStatement(node.body, context);
|
|
2053
|
+
else checkNonBlockStatement(node.body, context);
|
|
2054
|
+
}
|
|
2055
|
+
//#endregion
|
|
2056
|
+
//#region src/rules/noUnnecessaryBraces/checkIfStatement.ts
|
|
2057
|
+
function checkIfStatement(node, context) {
|
|
2058
|
+
if (node.consequent.type === "BlockStatement") checkBlockStatement(node.consequent, context);
|
|
2059
|
+
else checkNonBlockStatement(node.consequent, context);
|
|
2060
|
+
if (!node.alternate) return;
|
|
2061
|
+
if (node.alternate.type === "IfStatement") return;
|
|
2062
|
+
if (node.alternate.type === "BlockStatement") checkBlockStatement(node.alternate, context);
|
|
2063
|
+
else checkNonBlockStatement(node.alternate, context);
|
|
2064
|
+
}
|
|
2065
|
+
//#endregion
|
|
2066
|
+
//#region src/rules/noUnnecessaryBraces/checkWhileStatement.ts
|
|
2067
|
+
function checkWhileStatement(node, context) {
|
|
2068
|
+
if (node.body.type === "BlockStatement") checkBlockStatement(node.body, context);
|
|
2069
|
+
else checkNonBlockStatement(node.body, context);
|
|
2070
|
+
}
|
|
2071
|
+
//#endregion
|
|
2072
|
+
//#region src/rules/noUnnecessaryBraces/index.ts
|
|
2073
|
+
var noUnnecessaryBraces = {
|
|
2074
|
+
create(context) {
|
|
2075
|
+
return {
|
|
2076
|
+
DoWhileStatement: (node) => checkDoWhileStatement(node, context),
|
|
2077
|
+
ForInStatement: (node) => checkForInStatement(node, context),
|
|
2078
|
+
ForOfStatement: (node) => checkForOfStatement(node, context),
|
|
2079
|
+
ForStatement: (node) => checkForStatement(node, context),
|
|
2080
|
+
IfStatement: (node) => checkIfStatement(node, context),
|
|
2081
|
+
WhileStatement: (node) => checkWhileStatement(node, context)
|
|
2082
|
+
};
|
|
2083
|
+
},
|
|
2084
|
+
meta: {
|
|
2085
|
+
docs: { description: "Enforce consistent brace usage for single-statement control bodies." },
|
|
2086
|
+
fixable: "code",
|
|
2087
|
+
messages: {
|
|
2088
|
+
missingBraces: "Multi-line statement must be wrapped in braces",
|
|
2089
|
+
unnecessaryBraces: "Unnecessary braces around single-line statement"
|
|
2090
|
+
},
|
|
2091
|
+
schema: [],
|
|
2092
|
+
type: "suggestion"
|
|
2093
|
+
}
|
|
2094
|
+
};
|
|
2095
|
+
//#endregion
|
|
2096
|
+
//#region src/rules/objectPropertyLineBreak/isShorthandProperty.ts
|
|
2097
|
+
function isShorthandProperty(property) {
|
|
2098
|
+
return property.shorthand;
|
|
2099
|
+
}
|
|
2100
|
+
//#endregion
|
|
2101
|
+
//#region src/rules/objectPropertyLineBreak/areAllShorthand.ts
|
|
2102
|
+
function areAllShorthand(properties) {
|
|
2103
|
+
return properties.every(isShorthandProperty);
|
|
2104
|
+
}
|
|
2105
|
+
//#endregion
|
|
2106
|
+
//#region src/rules/objectPropertyLineBreak/getPropertyText.ts
|
|
2107
|
+
function getPropertyText(sourceCode, property) {
|
|
2108
|
+
return sourceCode.getText(property);
|
|
2109
|
+
}
|
|
2110
|
+
//#endregion
|
|
2111
|
+
//#region src/rules/objectPropertyLineBreak/getInlineObjectLength.ts
|
|
2112
|
+
function getInlineObjectLength(sourceCode, properties) {
|
|
2113
|
+
if (properties.length === 0) return 2;
|
|
2114
|
+
const propsTotal = properties.map((p) => getPropertyText(sourceCode, p).length).reduce((a, b) => a + b, 0);
|
|
2115
|
+
const commas = Math.max(0, properties.length - 1);
|
|
2116
|
+
return 2 + propsTotal + commas;
|
|
2117
|
+
}
|
|
2118
|
+
//#endregion
|
|
2119
|
+
//#region src/rules/objectPropertyLineBreak/checkMultiline.ts
|
|
2120
|
+
function checkMultiline(sourceCode, context, node, braces, maxLength) {
|
|
2121
|
+
const properties = node.properties;
|
|
2122
|
+
if (!areAllShorthand(properties)) return;
|
|
2123
|
+
if (getInlineObjectLength(sourceCode, properties) > maxLength) return;
|
|
2124
|
+
context.report({
|
|
2125
|
+
fix(fixer) {
|
|
2126
|
+
const names = [];
|
|
2127
|
+
for (const prop of properties) if (prop.key.type === "Identifier") names.push(prop.key.name);
|
|
2128
|
+
else names.push(sourceCode.getText(prop));
|
|
2129
|
+
return fixer.replaceText(node, `{${names.join(", ")}}`);
|
|
2130
|
+
},
|
|
2131
|
+
messageId: "multilineCanBeSingleLine",
|
|
2132
|
+
node: properties[0]
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
//#endregion
|
|
2136
|
+
//#region src/rules/objectPropertyLineBreak/buildMultilineFix.ts
|
|
2137
|
+
function buildMultilineFix(fixer, braces, properties, sourceCode) {
|
|
2138
|
+
const indentStep = detectIndentStep(sourceCode);
|
|
2139
|
+
const lineIndent = sourceCode.getLines()[braces.openingBrace.loc.start.line - 1].match(/^\s*/)?.[0] ?? "";
|
|
2140
|
+
const indent = lineIndent + " ".repeat(indentStep);
|
|
2141
|
+
const lines = ["{"];
|
|
2142
|
+
for (const prop of properties) {
|
|
2143
|
+
const propText = sourceCode.getText(prop);
|
|
2144
|
+
lines.push(`${indent}${propText},`);
|
|
2145
|
+
}
|
|
2146
|
+
lines.push(`${lineIndent}}`);
|
|
2147
|
+
return fixer.replaceTextRange([braces.openingBrace.range[0], braces.closingBrace.range[1]], lines.join("\n"));
|
|
2148
|
+
}
|
|
2149
|
+
//#endregion
|
|
2150
|
+
//#region src/rules/objectPropertyLineBreak/getPropertyName.ts
|
|
2151
|
+
function getPropertyName(sourceCode, prop) {
|
|
2152
|
+
if (prop.key.type === "Identifier") return prop.key.name;
|
|
2153
|
+
return sourceCode.getText(prop);
|
|
2154
|
+
}
|
|
2155
|
+
//#endregion
|
|
2156
|
+
//#region src/rules/objectPropertyLineBreak/buildShorthandFix.ts
|
|
2157
|
+
function buildShorthandFix(fixer, braces, properties, sourceCode) {
|
|
2158
|
+
const names = properties.map((p) => getPropertyName(sourceCode, p));
|
|
2159
|
+
return fixer.replaceTextRange([braces.openingBrace.range[0], braces.closingBrace.range[1]], `{${names.join(", ")}}`);
|
|
2160
|
+
}
|
|
2161
|
+
//#endregion
|
|
2162
|
+
//#region src/rules/objectPropertyLineBreak/canConvertToShorthand.ts
|
|
2163
|
+
function canConvertToShorthand(property) {
|
|
2164
|
+
if (property.shorthand) return true;
|
|
2165
|
+
if (property.kind !== "init") return false;
|
|
2166
|
+
if (property.key.type !== "Identifier") return false;
|
|
2167
|
+
if (property.value.type !== "Identifier") return false;
|
|
2168
|
+
return property.key.name === property.value.name;
|
|
2169
|
+
}
|
|
2170
|
+
//#endregion
|
|
2171
|
+
//#region src/rules/objectPropertyLineBreak/shouldCollapseToShorthand.ts
|
|
2172
|
+
function shouldCollapseToShorthand(properties, sourceCode, maxLength) {
|
|
2173
|
+
const anyShorthand = properties.some((p) => p.shorthand);
|
|
2174
|
+
const allCanConvert = properties.every(canConvertToShorthand);
|
|
2175
|
+
const shorthandLength = allCanConvert ? getInlineObjectLength(sourceCode, properties) : Infinity;
|
|
2176
|
+
return !anyShorthand && allCanConvert && shorthandLength <= maxLength;
|
|
2177
|
+
}
|
|
2178
|
+
//#endregion
|
|
2179
|
+
//#region src/rules/objectPropertyLineBreak/checkSingleLine.ts
|
|
2180
|
+
function checkSingleLine(sourceCode, context, properties, braces, maxLength) {
|
|
2181
|
+
if (properties.length === 1) return;
|
|
2182
|
+
const allShorthand = areAllShorthand(properties);
|
|
2183
|
+
const inlineLength = getInlineObjectLength(sourceCode, properties);
|
|
2184
|
+
if (allShorthand && inlineLength <= maxLength) return;
|
|
2185
|
+
if (!allShorthand) {
|
|
2186
|
+
if (shouldCollapseToShorthand(properties, sourceCode, maxLength)) {
|
|
2187
|
+
context.report({
|
|
2188
|
+
fix: (fixer) => buildShorthandFix(fixer, braces, properties, sourceCode),
|
|
2189
|
+
messageId: "mixedPropertiesNotAllowed",
|
|
2190
|
+
node: properties[0]
|
|
2191
|
+
});
|
|
2192
|
+
return;
|
|
2193
|
+
}
|
|
2194
|
+
context.report({
|
|
2195
|
+
fix: (fixer) => buildMultilineFix(fixer, braces, properties, sourceCode),
|
|
2196
|
+
messageId: "mixedPropertiesNotAllowed",
|
|
2197
|
+
node: properties[0]
|
|
2198
|
+
});
|
|
2199
|
+
return;
|
|
2200
|
+
}
|
|
2201
|
+
context.report({
|
|
2202
|
+
fix: (fixer) => buildMultilineFix(fixer, braces, properties, sourceCode),
|
|
2203
|
+
messageId: "singleLineExceedsMaxLength",
|
|
2204
|
+
node: properties[0]
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
//#endregion
|
|
2208
|
+
//#region src/rules/objectPropertyLineBreak/defaultOptions.ts
|
|
2209
|
+
var defaultOptions$2 = { maxLength: 80 };
|
|
2210
|
+
//#endregion
|
|
2211
|
+
//#region src/rules/objectPropertyLineBreak/getBraces.ts
|
|
2212
|
+
function getBraces(sourceCode, node) {
|
|
2213
|
+
const properties = node.properties;
|
|
2214
|
+
if (properties.length === 0) return null;
|
|
2215
|
+
const firstProp = properties[0];
|
|
2216
|
+
const lastProp = properties[properties.length - 1];
|
|
2217
|
+
const openingBrace = sourceCode.getTokenBefore(firstProp);
|
|
2218
|
+
const closingBrace = sourceCode.getTokenAfter(lastProp);
|
|
2219
|
+
if (!openingBrace || !closingBrace) return null;
|
|
2220
|
+
return {
|
|
2221
|
+
closingBrace,
|
|
2222
|
+
openingBrace
|
|
2223
|
+
};
|
|
2224
|
+
}
|
|
2225
|
+
//#endregion
|
|
2226
|
+
//#region src/rules/objectPropertyLineBreak/checkObject.ts
|
|
2227
|
+
function checkObject(sourceCode, context, node) {
|
|
2228
|
+
const maxLength = (context.options[0] ?? {}).maxLength ?? defaultOptions$2.maxLength;
|
|
2229
|
+
const properties = node.properties;
|
|
2230
|
+
if (properties.length === 0) return;
|
|
2231
|
+
const braces = getBraces(sourceCode, node);
|
|
2232
|
+
if (!braces) return;
|
|
2233
|
+
if (braces.openingBrace.loc.start.line === braces.closingBrace.loc.end.line) checkSingleLine(sourceCode, context, properties, braces, maxLength);
|
|
2234
|
+
else checkMultiline(sourceCode, context, node, braces, maxLength);
|
|
2235
|
+
}
|
|
2236
|
+
//#endregion
|
|
2237
|
+
//#region src/rules/objectPropertyLineBreak/index.ts
|
|
2238
|
+
var objectPropertyLineBreak = {
|
|
2239
|
+
create(context) {
|
|
2240
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
2241
|
+
return { ObjectExpression(node) {
|
|
2242
|
+
checkObject(sourceCode, context, node);
|
|
2243
|
+
} };
|
|
2244
|
+
},
|
|
2245
|
+
meta: {
|
|
2246
|
+
docs: { description: "Enforce object literal formatting based on complexity and line length." },
|
|
2247
|
+
fixable: "code",
|
|
2248
|
+
messages: {
|
|
2249
|
+
mixedPropertiesNotAllowed: "mixedPropertiesNotAllowed",
|
|
2250
|
+
multilineCanBeSingleLine: "multilineCanBeSingleLine",
|
|
2251
|
+
singleLineExceedsMaxLength: "singleLineExceedsMaxLength"
|
|
2252
|
+
},
|
|
2253
|
+
schema: [{
|
|
2254
|
+
additionalProperties: false,
|
|
2255
|
+
properties: { maxLength: { type: "number" } },
|
|
2256
|
+
type: "object"
|
|
2257
|
+
}],
|
|
2258
|
+
type: "layout"
|
|
2259
|
+
}
|
|
2260
|
+
};
|
|
2261
|
+
//#endregion
|
|
2262
|
+
//#region src/rules/oneExportPerFile/index.ts
|
|
2263
|
+
var oneExportPerFile = {
|
|
2264
|
+
create(context) {
|
|
2265
|
+
const filename = context.filename;
|
|
2266
|
+
if (isExempt$2(filename)) return {};
|
|
2267
|
+
let exportCount = 0;
|
|
2268
|
+
return {
|
|
2269
|
+
ExportDefaultDeclaration(_node) {
|
|
2270
|
+
exportCount++;
|
|
2271
|
+
},
|
|
2272
|
+
ExportNamedDeclaration(_node) {
|
|
2273
|
+
exportCount++;
|
|
2274
|
+
},
|
|
2275
|
+
"Program:exit"(programNode) {
|
|
2276
|
+
if (exportCount > 1) context.report({
|
|
2277
|
+
data: { count: exportCount },
|
|
2278
|
+
messageId: "tooManyExports",
|
|
2279
|
+
node: programNode
|
|
2280
|
+
});
|
|
2281
|
+
}
|
|
2282
|
+
};
|
|
2283
|
+
},
|
|
2284
|
+
meta: {
|
|
2285
|
+
docs: { description: "Enforce single export per file." },
|
|
2286
|
+
messages: { tooManyExports: "Only one export is allowed per file. Found {{count}} exports." },
|
|
2287
|
+
schema: [],
|
|
2288
|
+
type: "suggestion"
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2291
|
+
//#endregion
|
|
2292
|
+
//#region src/rules/preferInlineExport/isValidExportSpecifier.ts
|
|
2293
|
+
function isValidExportSpecifier(specifier, localDeclarations) {
|
|
2294
|
+
if (specifier.local.type !== "Identifier") return false;
|
|
2295
|
+
if (specifier.exported.type !== "Identifier") return false;
|
|
2296
|
+
if (specifier.local.name !== specifier.exported.name) return false;
|
|
2297
|
+
return localDeclarations.has(specifier.local.name);
|
|
2298
|
+
}
|
|
2299
|
+
//#endregion
|
|
2300
|
+
//#region src/rules/preferInlineExport/canInlineSpecifiers.ts
|
|
2301
|
+
function canInlineSpecifiers(specifiers, localDeclarations) {
|
|
2302
|
+
return specifiers.every((spec) => isValidExportSpecifier(spec, localDeclarations));
|
|
2303
|
+
}
|
|
2304
|
+
//#endregion
|
|
2305
|
+
//#region src/rules/preferInlineExport/getDeclarationName.ts
|
|
2306
|
+
function getDeclarationName(node) {
|
|
2307
|
+
if (node.type !== "VariableDeclaration") return node.id?.name ?? null;
|
|
2308
|
+
const declarations = node.declarations;
|
|
2309
|
+
if (declarations.length === 1) {
|
|
2310
|
+
const id = declarations[0].id;
|
|
2311
|
+
if (id.type === "Identifier") return id.name;
|
|
2312
|
+
}
|
|
2313
|
+
return null;
|
|
2314
|
+
}
|
|
2315
|
+
//#endregion
|
|
2316
|
+
//#region src/rules/preferInlineExport/isExportableDeclaration.ts
|
|
2317
|
+
function isExportableDeclaration(node) {
|
|
2318
|
+
const type = node.type;
|
|
2319
|
+
return type === "TSInterfaceDeclaration" || type === "TSTypeAliasDeclaration" || type === "ClassDeclaration" || type === "FunctionDeclaration" || type === "VariableDeclaration";
|
|
2320
|
+
}
|
|
2321
|
+
//#endregion
|
|
2322
|
+
//#region src/rules/preferInlineExport/index.ts
|
|
2323
|
+
var preferInlineExport = {
|
|
2324
|
+
create(context) {
|
|
2325
|
+
const localDeclarations = /* @__PURE__ */ new Map();
|
|
2326
|
+
function visitDeclaration(node) {
|
|
2327
|
+
if (!isExportableDeclaration(node)) return;
|
|
2328
|
+
const name = getDeclarationName(node);
|
|
2329
|
+
if (name) localDeclarations.set(name, {
|
|
2330
|
+
name,
|
|
2331
|
+
node
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
return {
|
|
2335
|
+
ClassDeclaration: visitDeclaration,
|
|
2336
|
+
ExportNamedDeclaration(node) {
|
|
2337
|
+
if (node.source) return;
|
|
2338
|
+
if (!node.specifiers || node.specifiers.length === 0) return;
|
|
2339
|
+
if (!canInlineSpecifiers(node.specifiers, localDeclarations)) return;
|
|
2340
|
+
context.report({
|
|
2341
|
+
fix(fixer) {
|
|
2342
|
+
const fixes = [];
|
|
2343
|
+
for (const specifier of node.specifiers) {
|
|
2344
|
+
const name = specifier.local.name;
|
|
2345
|
+
const decl = localDeclarations.get(name);
|
|
2346
|
+
if (decl) fixes.push(fixer.insertTextBefore(decl.node, "export "));
|
|
2347
|
+
}
|
|
2348
|
+
fixes.push(fixer.remove(node));
|
|
2349
|
+
return fixes;
|
|
2350
|
+
},
|
|
2351
|
+
messageId: "preferInline",
|
|
2352
|
+
node
|
|
2353
|
+
});
|
|
2354
|
+
},
|
|
2355
|
+
FunctionDeclaration: visitDeclaration,
|
|
2356
|
+
TSInterfaceDeclaration: visitDeclaration,
|
|
2357
|
+
TSTypeAliasDeclaration: visitDeclaration,
|
|
2358
|
+
VariableDeclaration: visitDeclaration
|
|
2359
|
+
};
|
|
2360
|
+
},
|
|
2361
|
+
meta: {
|
|
2362
|
+
docs: { description: "Enforce using inline export syntax instead of separate export statements." },
|
|
2363
|
+
fixable: "code",
|
|
2364
|
+
messages: { preferInline: "Use inline export instead of separate export statement" },
|
|
2365
|
+
schema: [],
|
|
2366
|
+
type: "suggestion"
|
|
2367
|
+
}
|
|
2368
|
+
};
|
|
2369
|
+
//#endregion
|
|
2370
|
+
//#region src/rules/singleLineArrowFunctionParameters/buildCollapsedParams.ts
|
|
2371
|
+
function buildCollapsedParams(sourceCode, params) {
|
|
2372
|
+
return `(${params.map((param, index) => {
|
|
2373
|
+
const text = sourceCode.getText(param);
|
|
2374
|
+
return index === params.length - 1 ? text : text + ",";
|
|
2375
|
+
}).join(" ")})`;
|
|
2376
|
+
}
|
|
2377
|
+
//#endregion
|
|
2378
|
+
//#region src/rules/singleLineArrowFunctionParameters/calculateCollapsedLength.ts
|
|
2379
|
+
function calculateCollapsedLength(sourceCode, openingParen, collapsedParams, returnType) {
|
|
2380
|
+
let returnTypeText = "";
|
|
2381
|
+
if (returnType) returnTypeText = sourceCode.getText(returnType);
|
|
2382
|
+
const textAfterClosingParen = sourceCode.getText().split("\n")[openingParen.loc.start.line - 1].slice(openingParen.loc.start.column);
|
|
2383
|
+
return openingParen.loc.start.column + collapsedParams.length + returnTypeText.length + textAfterClosingParen.length;
|
|
2384
|
+
}
|
|
2385
|
+
//#endregion
|
|
2386
|
+
//#region src/rules/singleLineArrowFunctionParameters/defaultOptions.ts
|
|
2387
|
+
var defaultOptions$1 = { maxLength: 80 };
|
|
2388
|
+
//#endregion
|
|
2389
|
+
//#region src/rules/singleLineArrowFunctionParameters/getArrowFunctionParens.ts
|
|
2390
|
+
function getArrowFunctionParens(sourceCode, params) {
|
|
2391
|
+
if (params.length === 0) return null;
|
|
2392
|
+
const firstParam = params[0];
|
|
2393
|
+
const lastParam = params[params.length - 1];
|
|
2394
|
+
const openingParen = sourceCode.getTokenBefore(firstParam);
|
|
2395
|
+
let closingParen = sourceCode.getTokenAfter(lastParam);
|
|
2396
|
+
while (closingParen && closingParen.value === ",") closingParen = sourceCode.getTokenAfter(closingParen);
|
|
2397
|
+
if (!openingParen || !closingParen) return null;
|
|
2398
|
+
if (openingParen.value !== "(" || closingParen.value !== ")") return null;
|
|
2399
|
+
return {
|
|
2400
|
+
closingParen,
|
|
2401
|
+
openingParen
|
|
2402
|
+
};
|
|
2403
|
+
}
|
|
2404
|
+
//#endregion
|
|
2405
|
+
//#region src/rules/singleLineArrowFunctionParameters/isShorthand.ts
|
|
2406
|
+
function isShorthand(sourceCode, node) {
|
|
2407
|
+
if (node.params.length !== 1) return false;
|
|
2408
|
+
const firstParam = node.params[0];
|
|
2409
|
+
const tokenBefore = sourceCode.getTokenBefore(firstParam);
|
|
2410
|
+
return !tokenBefore || tokenBefore.value !== "(";
|
|
2411
|
+
}
|
|
2412
|
+
//#endregion
|
|
2413
|
+
//#region src/rules/singleLineArrowFunctionParameters/reportViolation.ts
|
|
2414
|
+
function reportViolation(context, node, collapsedParams, returnTypeText, arrowToken, openingParen) {
|
|
2415
|
+
context.report({
|
|
2416
|
+
fix: (fixer) => fixer.replaceTextRange([openingParen.range[0], arrowToken.range[1]], collapsedParams + returnTypeText + " =>"),
|
|
2417
|
+
messageId: "singleLine",
|
|
2418
|
+
node
|
|
2419
|
+
});
|
|
2420
|
+
}
|
|
2421
|
+
//#endregion
|
|
2422
|
+
//#region src/rules/singleLineArrowFunctionParameters/checkArrowFunction.ts
|
|
2423
|
+
function checkArrowFunction(sourceCode, context, node) {
|
|
2424
|
+
const maxLength = (context.options[0] ?? {}).maxLength ?? defaultOptions$1.maxLength;
|
|
2425
|
+
if (isShorthand(sourceCode, node)) return;
|
|
2426
|
+
const parens = getArrowFunctionParens(sourceCode, node.params);
|
|
2427
|
+
if (!parens) return;
|
|
2428
|
+
const { closingParen, openingParen } = parens;
|
|
2429
|
+
if (openingParen.loc.start.line === closingParen.loc.end.line) return;
|
|
2430
|
+
const arrowToken = sourceCode.getTokenAfter(closingParen, (token) => token.value === "=>");
|
|
2431
|
+
if (!arrowToken) return;
|
|
2432
|
+
const collapsedParams = buildCollapsedParams(sourceCode, node.params);
|
|
2433
|
+
if (calculateCollapsedLength(sourceCode, openingParen, collapsedParams, node.returnType) <= maxLength) reportViolation(context, node, collapsedParams, node.returnType ? sourceCode.getText(node.returnType) : "", arrowToken, openingParen);
|
|
2434
|
+
}
|
|
2435
|
+
//#endregion
|
|
2436
|
+
//#region src/rules/singleLineArrowFunctionParameters/index.ts
|
|
2437
|
+
var singleLineArrowFunctionParameters = {
|
|
2438
|
+
create(context) {
|
|
2439
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
2440
|
+
return { ArrowFunctionExpression(node) {
|
|
2441
|
+
if (node.params.length === 0) return;
|
|
2442
|
+
checkArrowFunction(sourceCode, context, node);
|
|
2443
|
+
} };
|
|
2444
|
+
},
|
|
2445
|
+
meta: {
|
|
2446
|
+
docs: { description: "Enforce arrow function parameters to be on a single line when they fit." },
|
|
2447
|
+
fixable: "code",
|
|
2448
|
+
messages: { singleLine: "Arrow function parameters can be on a single line" },
|
|
2449
|
+
schema: [{
|
|
2450
|
+
additionalProperties: false,
|
|
2451
|
+
properties: { maxLength: { type: "number" } },
|
|
2452
|
+
type: "object"
|
|
2453
|
+
}],
|
|
2454
|
+
type: "layout"
|
|
2455
|
+
}
|
|
2456
|
+
};
|
|
2457
|
+
//#endregion
|
|
2458
|
+
//#region src/rules/singleLineFunctionParameters/defaultOptions.ts
|
|
2459
|
+
var defaultOptions = { maxLength: 80 };
|
|
2460
|
+
//#endregion
|
|
2461
|
+
//#region src/rules/singleLineFunctionParameters/getParens.ts
|
|
2462
|
+
function getParens(sourceCode, nodes) {
|
|
2463
|
+
if (nodes.length === 0) return null;
|
|
2464
|
+
const firstNode = nodes[0];
|
|
2465
|
+
const lastNode = nodes[nodes.length - 1];
|
|
2466
|
+
const openingParen = sourceCode.getTokenBefore(firstNode, (token) => token.value === "(");
|
|
2467
|
+
const closingParen = sourceCode.getTokenAfter(lastNode, (token) => token.value === ")");
|
|
2468
|
+
if (!openingParen || !closingParen) return null;
|
|
2469
|
+
return {
|
|
2470
|
+
closingParen,
|
|
2471
|
+
openingParen
|
|
2472
|
+
};
|
|
2473
|
+
}
|
|
2474
|
+
//#endregion
|
|
2475
|
+
//#region src/rules/singleLineFunctionParameters/checkFunction.ts
|
|
2476
|
+
function checkFunction(sourceCode, context, node) {
|
|
2477
|
+
const maxLength = (context.options[0] ?? {}).maxLength ?? defaultOptions.maxLength;
|
|
2478
|
+
const params = node.params;
|
|
2479
|
+
if (params.length === 0) return;
|
|
2480
|
+
const parens = getParens(sourceCode, params);
|
|
2481
|
+
if (!isValidParens(parens)) return;
|
|
2482
|
+
if (parens.openingParen.loc.start.line === parens.closingParen.loc.end.line) return;
|
|
2483
|
+
const paramsText = params.map((param, index) => {
|
|
2484
|
+
const text = sourceCode.getText(param);
|
|
2485
|
+
if (index === params.length - 1) return text;
|
|
2486
|
+
const comma = sourceCode.getTokenAfter(param, (token) => token.value === ",");
|
|
2487
|
+
if (comma && comma.loc.end.line === param.loc.end.line) return text + ",";
|
|
2488
|
+
return text;
|
|
2489
|
+
}).join(" ");
|
|
2490
|
+
const closingLine = parens.closingParen.loc.end.line;
|
|
2491
|
+
const closingCol = parens.closingParen.loc.end.column;
|
|
2492
|
+
const closingLineText = getLineLength(sourceCode, closingLine) > closingCol ? sourceCode.getText().split("\n")[closingLine - 1].slice(closingCol) : "";
|
|
2493
|
+
if (parens.openingParen.loc.start.column + 1 + paramsText.length + 1 + closingLineText.length <= maxLength) context.report({
|
|
2494
|
+
fix: (fixer) => fixer.replaceTextRange([parens.openingParen.range[0], parens.closingParen.range[1]], `(${paramsText})`),
|
|
2495
|
+
messageId: "singleLine",
|
|
2496
|
+
node
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
//#endregion
|
|
2500
|
+
//#region src/rules/singleLineFunctionParameters/index.ts
|
|
2501
|
+
var singleLineFunctionParameters = {
|
|
2502
|
+
create(context) {
|
|
2503
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
2504
|
+
return {
|
|
2505
|
+
FunctionDeclaration(node) {
|
|
2506
|
+
checkFunction(sourceCode, context, node);
|
|
2507
|
+
},
|
|
2508
|
+
FunctionExpression(node) {
|
|
2509
|
+
checkFunction(sourceCode, context, node);
|
|
2510
|
+
},
|
|
2511
|
+
TSCallSignatureDeclaration(node) {
|
|
2512
|
+
checkFunction(sourceCode, context, node);
|
|
2513
|
+
},
|
|
2514
|
+
TSFunctionType(node) {
|
|
2515
|
+
checkFunction(sourceCode, context, node);
|
|
2516
|
+
},
|
|
2517
|
+
TSMethodSignature(node) {
|
|
2518
|
+
checkFunction(sourceCode, context, node);
|
|
2519
|
+
}
|
|
2520
|
+
};
|
|
2521
|
+
},
|
|
2522
|
+
meta: {
|
|
2523
|
+
docs: { description: "Enforce function parameters to be on a single line when they fit." },
|
|
2524
|
+
fixable: "code",
|
|
2525
|
+
messages: { singleLine: "Function parameters can be on a single line" },
|
|
2526
|
+
schema: [{
|
|
2527
|
+
additionalProperties: false,
|
|
2528
|
+
properties: { maxLength: { type: "number" } },
|
|
2529
|
+
type: "object"
|
|
2530
|
+
}],
|
|
2531
|
+
type: "layout"
|
|
2532
|
+
}
|
|
2533
|
+
};
|
|
2534
|
+
//#endregion
|
|
2535
|
+
//#region src/rules/singleLineImports/formatAttributes.ts
|
|
2536
|
+
function formatAttributes(attributes) {
|
|
2537
|
+
if (attributes.length === 0) return "";
|
|
2538
|
+
return ` with {${attributes.map((attr) => {
|
|
2539
|
+
return `${attr.key.type === "Identifier" ? attr.key.name : attr.key.value}: '${attr.value.value}'`;
|
|
2540
|
+
}).join(", ")}}`;
|
|
2541
|
+
}
|
|
2542
|
+
//#endregion
|
|
2543
|
+
//#region src/rules/singleLineImports/formatNamed.ts
|
|
2544
|
+
function formatNamed(specifiers, sourceCode) {
|
|
2545
|
+
return specifiers.map((s) => sourceCode.getText(s)).join(", ");
|
|
2546
|
+
}
|
|
2547
|
+
//#endregion
|
|
2548
|
+
//#region src/rules/singleLineImports/formatSpecifiers.ts
|
|
2549
|
+
function formatSpecifiers(declaration, sourceCode) {
|
|
2550
|
+
const defaultSpecifier = declaration.specifiers.find((s) => s.type === "ImportDefaultSpecifier");
|
|
2551
|
+
const namespaceSpecifier = declaration.specifiers.find((s) => s.type === "ImportNamespaceSpecifier");
|
|
2552
|
+
const namedSpecifiers = declaration.specifiers.filter((s) => s.type === "ImportSpecifier");
|
|
2553
|
+
if (namespaceSpecifier) return `* as ${namespaceSpecifier.local.name}`;
|
|
2554
|
+
if (defaultSpecifier && namedSpecifiers.length > 0) return `${defaultSpecifier.local.name}, {${formatNamed(namedSpecifiers, sourceCode)}}`;
|
|
2555
|
+
if (defaultSpecifier) return defaultSpecifier.local.name;
|
|
2556
|
+
if (namedSpecifiers.length === 0) return "";
|
|
2557
|
+
return `{${formatNamed(namedSpecifiers, sourceCode)}}`;
|
|
2558
|
+
}
|
|
2559
|
+
//#endregion
|
|
2560
|
+
//#region src/rules/singleLineImports/createImportFix.ts
|
|
2561
|
+
function createImportFix$1(fixer, declaration, sourceCode) {
|
|
2562
|
+
const source = declaration.source.value;
|
|
2563
|
+
const prefix = declaration.importKind === "type" ? "import type " : "import ";
|
|
2564
|
+
const specifiers = formatSpecifiers(declaration, sourceCode);
|
|
2565
|
+
const attributes = formatAttributes(declaration.attributes);
|
|
2566
|
+
if (specifiers === "") {
|
|
2567
|
+
const result = `${prefix}'${source}'${attributes}`;
|
|
2568
|
+
return fixer.replaceText(declaration, result);
|
|
2569
|
+
}
|
|
2570
|
+
const result = `${prefix}${specifiers} from '${source}'${attributes}`;
|
|
2571
|
+
return fixer.replaceText(declaration, result);
|
|
2572
|
+
}
|
|
2573
|
+
//#endregion
|
|
2574
|
+
//#region src/rules/singleLineImports/isMultilineImport.ts
|
|
2575
|
+
function isMultilineImport(declaration) {
|
|
2576
|
+
const { end, start } = declaration.loc ?? {};
|
|
2577
|
+
return start?.line !== end?.line;
|
|
2578
|
+
}
|
|
2579
|
+
//#endregion
|
|
2580
|
+
//#region src/rules/singleLineImports/index.ts
|
|
2581
|
+
var singleLineImports = {
|
|
2582
|
+
create(context) {
|
|
2583
|
+
return { ImportDeclaration(node) {
|
|
2584
|
+
if (!isMultilineImport(node)) return;
|
|
2585
|
+
context.report({
|
|
2586
|
+
fix: (fixer) => createImportFix$1(fixer, node, context.sourceCode),
|
|
2587
|
+
messageId: "multiline",
|
|
2588
|
+
node
|
|
2589
|
+
});
|
|
2590
|
+
} };
|
|
2591
|
+
},
|
|
2592
|
+
meta: {
|
|
2593
|
+
docs: { description: "Enforce imports to be on a single line." },
|
|
2594
|
+
fixable: "code",
|
|
2595
|
+
messages: { multiline: "Import should be on a single line" },
|
|
2596
|
+
schema: [],
|
|
2597
|
+
type: "layout"
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
//#endregion
|
|
2601
|
+
//#region src/rules/singleLineReExports/createReExportFix.ts
|
|
2602
|
+
function createReExportFix$1(fixer, declaration, sourceCode) {
|
|
2603
|
+
const source = declaration.source.value;
|
|
2604
|
+
if (declaration.type === "ExportAllDeclaration") {
|
|
2605
|
+
const result = `export ${declaration.exported ? `* as ${sourceCode.getText(declaration.exported)}` : "*"} from '${source}'${formatAttributes(declaration.attributes)}`;
|
|
2606
|
+
return fixer.replaceText(declaration, result);
|
|
2607
|
+
}
|
|
2608
|
+
const result = `${declaration.exportKind === "type" ? "export type " : "export "}{${declaration.specifiers.map((s) => sourceCode.getText(s)).join(", ")}} from '${source}'${formatAttributes(declaration.attributes)}`;
|
|
2609
|
+
return fixer.replaceText(declaration, result);
|
|
2610
|
+
}
|
|
2611
|
+
//#endregion
|
|
2612
|
+
//#region src/rules/singleLineReExports/isMultilineReExport.ts
|
|
2613
|
+
function isMultilineReExport(declaration) {
|
|
2614
|
+
const { end, start } = declaration.loc ?? {};
|
|
2615
|
+
return start?.line !== end?.line;
|
|
2616
|
+
}
|
|
2617
|
+
//#endregion
|
|
2618
|
+
//#region src/rules/singleLineReExports/index.ts
|
|
2619
|
+
var singleLineReExports = {
|
|
2620
|
+
create(context) {
|
|
2621
|
+
const checkDeclaration = (node, declaration) => {
|
|
2622
|
+
if (!declaration.source) return;
|
|
2623
|
+
if (!isMultilineReExport(declaration)) return;
|
|
2624
|
+
context.report({
|
|
2625
|
+
fix: (fixer) => createReExportFix$1(fixer, declaration, context.sourceCode),
|
|
2626
|
+
messageId: "multiline",
|
|
2627
|
+
node
|
|
2628
|
+
});
|
|
2629
|
+
};
|
|
2630
|
+
return {
|
|
2631
|
+
ExportAllDeclaration: (node) => {
|
|
2632
|
+
checkDeclaration(node, node);
|
|
2633
|
+
},
|
|
2634
|
+
ExportNamedDeclaration: (node) => {
|
|
2635
|
+
checkDeclaration(node, node);
|
|
2636
|
+
}
|
|
2637
|
+
};
|
|
2638
|
+
},
|
|
2639
|
+
meta: {
|
|
2640
|
+
docs: { description: "Enforce re-exports to be on a single line." },
|
|
2641
|
+
fixable: "code",
|
|
2642
|
+
messages: { multiline: "Re-export should be on a single line" },
|
|
2643
|
+
schema: [],
|
|
2644
|
+
type: "layout"
|
|
2645
|
+
}
|
|
2646
|
+
};
|
|
2647
|
+
//#endregion
|
|
2648
|
+
//#region src/rules/sortedImports/categorizeImport.ts
|
|
2649
|
+
function categorizeImport(declaration) {
|
|
2650
|
+
if (declaration.specifiers.some((s) => s.type === "ImportNamespaceSpecifier")) return declaration.importKind === "type" ? "type-namespace" : "namespace";
|
|
2651
|
+
if (declaration.specifiers.some((s) => s.type === "ImportDefaultSpecifier")) return declaration.importKind === "type" ? "type-default" : "default";
|
|
2652
|
+
if (declaration.importKind === "type") return "type-named";
|
|
2653
|
+
if (declaration.specifiers.length === 0) return "side-effect";
|
|
2654
|
+
return "named";
|
|
2655
|
+
}
|
|
2656
|
+
//#endregion
|
|
2657
|
+
//#region src/rules/sortedImports/getImportSortKey.ts
|
|
2658
|
+
function getImportSortKey(declaration) {
|
|
2659
|
+
const group = categorizeImport(declaration);
|
|
2660
|
+
if (group === "side-effect") return declaration.source.value;
|
|
2661
|
+
if (group === "namespace" || group === "type-namespace") return `*${declaration.specifiers.find((s) => s.type === "ImportNamespaceSpecifier")?.local.name ?? ""}`;
|
|
2662
|
+
if (group === "default" || group === "type-default") return declaration.specifiers.find((s) => s.type === "ImportDefaultSpecifier")?.local.name ?? "";
|
|
2663
|
+
return declaration.specifiers[0].local.name;
|
|
2664
|
+
}
|
|
2665
|
+
//#endregion
|
|
2666
|
+
//#region src/rules/sortedImports/categorizeImports.ts
|
|
2667
|
+
function categorizeImports(declarations) {
|
|
2668
|
+
return declarations.map((declaration) => ({
|
|
2669
|
+
declaration,
|
|
2670
|
+
group: categorizeImport(declaration),
|
|
2671
|
+
sortKey: getImportSortKey(declaration)
|
|
2672
|
+
}));
|
|
2673
|
+
}
|
|
2674
|
+
//#endregion
|
|
2675
|
+
//#region src/lib/compare.ts
|
|
2676
|
+
function compare(a, b) {
|
|
2677
|
+
return a.localeCompare(b, "en", { sensitivity: "case" });
|
|
2678
|
+
}
|
|
2679
|
+
//#endregion
|
|
2680
|
+
//#region src/rules/sortedImports/importGroupOrder.ts
|
|
2681
|
+
var importGroupOrder = [
|
|
2682
|
+
"side-effect",
|
|
2683
|
+
"namespace",
|
|
2684
|
+
"default",
|
|
2685
|
+
"named",
|
|
2686
|
+
"type-namespace",
|
|
2687
|
+
"type-default",
|
|
2688
|
+
"type-named"
|
|
2689
|
+
];
|
|
2690
|
+
//#endregion
|
|
2691
|
+
//#region src/rules/sortedImports/checkAlphabeticalSorting.ts
|
|
2692
|
+
function checkAlphabeticalSorting$1(categorizedImports) {
|
|
2693
|
+
const errors = [];
|
|
2694
|
+
for (const importGroup of importGroupOrder) {
|
|
2695
|
+
const groupImports = categorizedImports.filter((c) => c.group === importGroup);
|
|
2696
|
+
const expectedSortedImports = [...groupImports].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
2697
|
+
for (let i = 0; i < groupImports.length; i++) if (groupImports[i] !== expectedSortedImports[i]) errors.push({
|
|
2698
|
+
messageId: "sortedImports",
|
|
2699
|
+
node: groupImports[i].declaration
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2702
|
+
return errors;
|
|
2703
|
+
}
|
|
2704
|
+
//#endregion
|
|
2705
|
+
//#region src/rules/sortedImports/checkGroupOrdering.ts
|
|
2706
|
+
function checkGroupOrdering$1(categorizedImports) {
|
|
2707
|
+
const errors = [];
|
|
2708
|
+
let currentGroupIndex = -1;
|
|
2709
|
+
for (const { declaration, group: importGroup } of categorizedImports) {
|
|
2710
|
+
const groupIndex = importGroupOrder.indexOf(importGroup);
|
|
2711
|
+
if (groupIndex < currentGroupIndex) errors.push({
|
|
2712
|
+
messageId: "wrongGroup",
|
|
2713
|
+
node: declaration
|
|
2714
|
+
});
|
|
2715
|
+
else currentGroupIndex = groupIndex;
|
|
2716
|
+
}
|
|
2717
|
+
return errors;
|
|
2718
|
+
}
|
|
2719
|
+
//#endregion
|
|
2720
|
+
//#region src/rules/sortedImports/getImportSpecifierName.ts
|
|
2721
|
+
function getImportSpecifierName(specifier) {
|
|
2722
|
+
return specifier.imported.type === "Identifier" ? specifier.imported.name : String(specifier.imported.value);
|
|
2723
|
+
}
|
|
2724
|
+
//#endregion
|
|
2725
|
+
//#region src/rules/sortedImports/areSpecifiersSorted.ts
|
|
2726
|
+
function areSpecifiersSorted$1(specifiers) {
|
|
2727
|
+
const names = specifiers.map((s) => getImportSpecifierName(s));
|
|
2728
|
+
const sorted = [...names].sort((a, b) => compare(a, b));
|
|
2729
|
+
return names.every((name, i) => name === sorted[i]);
|
|
2730
|
+
}
|
|
2731
|
+
//#endregion
|
|
2732
|
+
//#region src/rules/sortedImports/getImportNamedSpecifiers.ts
|
|
2733
|
+
function getImportNamedSpecifiers(declaration) {
|
|
2734
|
+
return declaration.specifiers.filter((s) => s.type === "ImportSpecifier");
|
|
2735
|
+
}
|
|
2736
|
+
//#endregion
|
|
2737
|
+
//#region src/rules/sortedImports/checkSpecifiersSorting.ts
|
|
2738
|
+
function checkSpecifiersSorting$1(categorized) {
|
|
2739
|
+
const errors = [];
|
|
2740
|
+
const namedImportDeclarations = categorized.filter((c) => c.group === "named");
|
|
2741
|
+
for (const { declaration } of namedImportDeclarations) {
|
|
2742
|
+
const namedSpecifiers = getImportNamedSpecifiers(declaration);
|
|
2743
|
+
if (namedSpecifiers.length > 1 && !areSpecifiersSorted$1(namedSpecifiers)) errors.push({
|
|
2744
|
+
messageId: "sortedNames",
|
|
2745
|
+
node: declaration
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2748
|
+
return errors;
|
|
2749
|
+
}
|
|
2750
|
+
//#endregion
|
|
2751
|
+
//#region src/rules/sortedImports/sortImportSpecifiersText.ts
|
|
2752
|
+
function sortImportSpecifiersText(specifiers, sourceCode) {
|
|
2753
|
+
return [...specifiers].sort((a, b) => {
|
|
2754
|
+
return compare(getImportSpecifierName(a), getImportSpecifierName(b));
|
|
2755
|
+
}).map((s) => sourceCode.getText(s)).join(", ");
|
|
2756
|
+
}
|
|
2757
|
+
//#endregion
|
|
2758
|
+
//#region src/rules/sortedImports/createFix/formatNamedImportSpecifiers.ts
|
|
2759
|
+
function formatNamedImportSpecifiers(declaration, sourceCode) {
|
|
2760
|
+
const specifiers = getImportNamedSpecifiers(declaration);
|
|
2761
|
+
if (specifiers.length > 1 && !areSpecifiersSorted$1(specifiers)) {
|
|
2762
|
+
const sortedSpecifiers = sortImportSpecifiersText(specifiers, sourceCode);
|
|
2763
|
+
const source = declaration.source.value;
|
|
2764
|
+
return `${declaration.importKind === "type" ? "import type " : "import "}{${sortedSpecifiers}} from '${source}'`;
|
|
2765
|
+
}
|
|
2766
|
+
return sourceCode.getText(declaration);
|
|
2767
|
+
}
|
|
2768
|
+
//#endregion
|
|
2769
|
+
//#region src/rules/sortedImports/createFix/buildSortedImportCode.ts
|
|
2770
|
+
function buildSortedImportCode(grouped, sourceCode) {
|
|
2771
|
+
const sortedCode = [];
|
|
2772
|
+
for (const group of importGroupOrder) for (const { declaration } of grouped[group] ?? []) if (group === "named" || group === "type-named") sortedCode.push(formatNamedImportSpecifiers(declaration, sourceCode));
|
|
2773
|
+
else sortedCode.push(sourceCode.getText(declaration));
|
|
2774
|
+
return sortedCode;
|
|
2775
|
+
}
|
|
2776
|
+
//#endregion
|
|
2777
|
+
//#region src/rules/sortedImports/createFix/groupImportsByType.ts
|
|
2778
|
+
function groupImportsByType(categorized) {
|
|
2779
|
+
const grouped = {
|
|
2780
|
+
default: [],
|
|
2781
|
+
named: [],
|
|
2782
|
+
namespace: [],
|
|
2783
|
+
"side-effect": [],
|
|
2784
|
+
"type-default": [],
|
|
2785
|
+
"type-named": [],
|
|
2786
|
+
"type-namespace": []
|
|
2787
|
+
};
|
|
2788
|
+
for (const item of categorized) grouped[item.group].push(item);
|
|
2789
|
+
return grouped;
|
|
2790
|
+
}
|
|
2791
|
+
//#endregion
|
|
2792
|
+
//#region src/rules/sortedImports/createFix/sortImportGroups.ts
|
|
2793
|
+
function sortImportGroups(grouped) {
|
|
2794
|
+
grouped["side-effect"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
2795
|
+
grouped["namespace"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
2796
|
+
grouped["default"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
2797
|
+
grouped["named"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
2798
|
+
grouped["type-namespace"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
2799
|
+
grouped["type-default"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
2800
|
+
grouped["type-named"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
2801
|
+
}
|
|
2802
|
+
//#endregion
|
|
2803
|
+
//#region src/rules/sortedImports/createFix/createFixForGroup.ts
|
|
2804
|
+
function createFixForGroup$1(fixer, importDeclarations, sourceCode) {
|
|
2805
|
+
if (importDeclarations.length === 0) return null;
|
|
2806
|
+
const grouped = groupImportsByType(categorizeImports(importDeclarations));
|
|
2807
|
+
sortImportGroups(grouped);
|
|
2808
|
+
const sortedCode = buildSortedImportCode(grouped, sourceCode).join("\n");
|
|
2809
|
+
const firstImport = importDeclarations[0];
|
|
2810
|
+
const lastImport = importDeclarations[importDeclarations.length - 1];
|
|
2811
|
+
return fixer.replaceTextRange([firstImport.range[0], lastImport.range[1]], sortedCode);
|
|
2812
|
+
}
|
|
2813
|
+
//#endregion
|
|
2814
|
+
//#region src/rules/sortedImports/createFix/index.ts
|
|
2815
|
+
function createImportFix(fixer, importGroups, sourceCode) {
|
|
2816
|
+
const fixes = [];
|
|
2817
|
+
for (const group of importGroups) {
|
|
2818
|
+
const fix = createFixForGroup$1(fixer, group, sourceCode);
|
|
2819
|
+
if (fix) fixes.push(fix);
|
|
2820
|
+
}
|
|
2821
|
+
return fixes;
|
|
2822
|
+
}
|
|
2823
|
+
//#endregion
|
|
2824
|
+
//#region src/rules/sortedImports/getImportGroups.ts
|
|
2825
|
+
function getImportGroups(programBody) {
|
|
2826
|
+
const groups = [];
|
|
2827
|
+
let currentImportGroup = [];
|
|
2828
|
+
for (const statement of programBody) {
|
|
2829
|
+
if (statement.type === "ImportDeclaration") {
|
|
2830
|
+
currentImportGroup.push(statement);
|
|
2831
|
+
continue;
|
|
2832
|
+
}
|
|
2833
|
+
if (currentImportGroup.length > 0) {
|
|
2834
|
+
groups.push(currentImportGroup);
|
|
2835
|
+
currentImportGroup = [];
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
if (currentImportGroup.length > 0) groups.push(currentImportGroup);
|
|
2839
|
+
return groups;
|
|
2840
|
+
}
|
|
2841
|
+
//#endregion
|
|
2842
|
+
//#region src/rules/sortedImports/index.ts
|
|
2843
|
+
var sortedImports = {
|
|
2844
|
+
create(context) {
|
|
2845
|
+
return { Program(node) {
|
|
2846
|
+
const programBody = node.body;
|
|
2847
|
+
const importGroups = getImportGroups(programBody);
|
|
2848
|
+
if (importGroups.length === 0) return;
|
|
2849
|
+
const allImportErrors = [];
|
|
2850
|
+
for (const group of importGroups) {
|
|
2851
|
+
const categorized = categorizeImports(group);
|
|
2852
|
+
const errors = [
|
|
2853
|
+
...checkGroupOrdering$1(categorized),
|
|
2854
|
+
...checkAlphabeticalSorting$1(categorized),
|
|
2855
|
+
...checkSpecifiersSorting$1(categorized)
|
|
2856
|
+
];
|
|
2857
|
+
allImportErrors.push(...errors);
|
|
2858
|
+
}
|
|
2859
|
+
for (const error of allImportErrors) context.report({
|
|
2860
|
+
fix(fixer) {
|
|
2861
|
+
const sourceCode = context.sourceCode;
|
|
2862
|
+
return createImportFix(fixer, importGroups, sourceCode);
|
|
2863
|
+
},
|
|
2864
|
+
messageId: error.messageId,
|
|
2865
|
+
node: error.node
|
|
2866
|
+
});
|
|
2867
|
+
} };
|
|
2868
|
+
},
|
|
2869
|
+
meta: {
|
|
2870
|
+
docs: { description: "Enforce sorted imports alphabetically." },
|
|
2871
|
+
fixable: "code",
|
|
2872
|
+
messages: {
|
|
2873
|
+
sortedImports: "Imports should be sorted alphabetically",
|
|
2874
|
+
sortedNames: "Named imports should be sorted alphabetically",
|
|
2875
|
+
wrongGroup: "Import is in wrong group"
|
|
2876
|
+
},
|
|
2877
|
+
schema: [],
|
|
2878
|
+
type: "suggestion"
|
|
2879
|
+
}
|
|
2880
|
+
};
|
|
2881
|
+
//#endregion
|
|
2882
|
+
//#region src/rules/sortedReExports/categorizeReExport.ts
|
|
2883
|
+
function categorizeReExport(declaration) {
|
|
2884
|
+
if (declaration.type === "ExportAllDeclaration") {
|
|
2885
|
+
if (declaration.exportKind === "type") {
|
|
2886
|
+
if (declaration.exported) return "type-namespace";
|
|
2887
|
+
return "type-all";
|
|
2888
|
+
}
|
|
2889
|
+
if (declaration.exported) return "re-export-namespace";
|
|
2890
|
+
return "re-export-all";
|
|
2891
|
+
}
|
|
2892
|
+
if (declaration.exportKind === "type") return "type-named";
|
|
2893
|
+
if (declaration.specifiers?.some((s) => s.exportKind === "type")) return "type-named";
|
|
2894
|
+
return "re-export-named";
|
|
2895
|
+
}
|
|
2896
|
+
//#endregion
|
|
2897
|
+
//#region src/rules/sortedReExports/getReExportSortKey.ts
|
|
2898
|
+
function getReExportSortKey(declaration) {
|
|
2899
|
+
const group = categorizeReExport(declaration);
|
|
2900
|
+
if (declaration.type === "ExportAllDeclaration") {
|
|
2901
|
+
if (group === "re-export-namespace") {
|
|
2902
|
+
if (declaration.exported?.type === "Identifier") return `*${declaration.exported.name}`;
|
|
2903
|
+
}
|
|
2904
|
+
return declaration.source.value;
|
|
2905
|
+
}
|
|
2906
|
+
const specifier = declaration.specifiers[0];
|
|
2907
|
+
if (!specifier) return "";
|
|
2908
|
+
return specifier.local.type === "Identifier" ? specifier.local.name : specifier.local.value;
|
|
2909
|
+
}
|
|
2910
|
+
//#endregion
|
|
2911
|
+
//#region src/rules/sortedReExports/categorizeReExports.ts
|
|
2912
|
+
function categorizeReExports(declarations) {
|
|
2913
|
+
return declarations.map((declaration) => {
|
|
2914
|
+
return {
|
|
2915
|
+
declaration,
|
|
2916
|
+
group: categorizeReExport(declaration),
|
|
2917
|
+
sortKey: getReExportSortKey(declaration)
|
|
2918
|
+
};
|
|
2919
|
+
});
|
|
2920
|
+
}
|
|
2921
|
+
//#endregion
|
|
2922
|
+
//#region src/rules/sortedReExports/reExportGroupOrder.ts
|
|
2923
|
+
var reExportGroupOrder = [
|
|
2924
|
+
"re-export-all",
|
|
2925
|
+
"re-export-namespace",
|
|
2926
|
+
"re-export-named",
|
|
2927
|
+
"type-all",
|
|
2928
|
+
"type-namespace",
|
|
2929
|
+
"type-named"
|
|
2930
|
+
];
|
|
2931
|
+
//#endregion
|
|
2932
|
+
//#region src/rules/sortedReExports/checkAlphabeticalSorting.ts
|
|
2933
|
+
function checkAlphabeticalSorting(categorized) {
|
|
2934
|
+
const errors = [];
|
|
2935
|
+
for (const group of reExportGroupOrder) {
|
|
2936
|
+
const groupReExports = categorized.filter((c) => c.group === group);
|
|
2937
|
+
const sorted = [...groupReExports].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
2938
|
+
for (let i = 0; i < groupReExports.length; i++) if (groupReExports[i] !== sorted[i]) errors.push({
|
|
2939
|
+
messageId: "sortedReExports",
|
|
2940
|
+
node: groupReExports[i].declaration
|
|
2941
|
+
});
|
|
2942
|
+
}
|
|
2943
|
+
return errors;
|
|
2944
|
+
}
|
|
2945
|
+
//#endregion
|
|
2946
|
+
//#region src/rules/sortedReExports/checkGroupOrdering.ts
|
|
2947
|
+
function checkGroupOrdering(categorized) {
|
|
2948
|
+
const errors = [];
|
|
2949
|
+
let currentGroupIndex = -1;
|
|
2950
|
+
for (const { declaration, group } of categorized) {
|
|
2951
|
+
const groupIndex = reExportGroupOrder.indexOf(group);
|
|
2952
|
+
if (groupIndex < currentGroupIndex) errors.push({
|
|
2953
|
+
messageId: "wrongGroup",
|
|
2954
|
+
node: declaration
|
|
2955
|
+
});
|
|
2956
|
+
else currentGroupIndex = groupIndex;
|
|
2957
|
+
}
|
|
2958
|
+
return errors;
|
|
2959
|
+
}
|
|
2960
|
+
//#endregion
|
|
2961
|
+
//#region src/rules/sortedReExports/getSpecifierName.ts
|
|
2962
|
+
function getSpecifierName(specifier) {
|
|
2963
|
+
return specifier.local.type === "Identifier" ? specifier.local.name : String(specifier.local.value);
|
|
2964
|
+
}
|
|
2965
|
+
//#endregion
|
|
2966
|
+
//#region src/rules/sortedReExports/areSpecifiersSorted.ts
|
|
2967
|
+
function areSpecifiersSorted(specifiers) {
|
|
2968
|
+
const names = specifiers.map((s) => getSpecifierName(s));
|
|
2969
|
+
const sorted = [...names].sort((a, b) => compare(a, b));
|
|
2970
|
+
return names.every((name, i) => name === sorted[i]);
|
|
2971
|
+
}
|
|
2972
|
+
//#endregion
|
|
2973
|
+
//#region src/rules/sortedReExports/getReExportNamedSpecifiers.ts
|
|
2974
|
+
function getReExportNamedSpecifiers(declaration) {
|
|
2975
|
+
return declaration.specifiers.filter((s) => s.type === "ExportSpecifier" && s.local.type === "Identifier");
|
|
2976
|
+
}
|
|
2977
|
+
//#endregion
|
|
2978
|
+
//#region src/rules/sortedReExports/isNamedReExport.ts
|
|
2979
|
+
function isNamedReExport(x) {
|
|
2980
|
+
return x.group !== "re-export-all" && x.group !== "re-export-namespace";
|
|
2981
|
+
}
|
|
2982
|
+
//#endregion
|
|
2983
|
+
//#region src/rules/sortedReExports/checkSpecifiersSorting.ts
|
|
2984
|
+
function checkSpecifiersSorting(categorized) {
|
|
2985
|
+
const errors = [];
|
|
2986
|
+
const namedReExports = categorized.filter(isNamedReExport);
|
|
2987
|
+
for (const { declaration } of namedReExports) {
|
|
2988
|
+
const specifiers = getReExportNamedSpecifiers(declaration);
|
|
2989
|
+
const isSorted = areSpecifiersSorted(specifiers);
|
|
2990
|
+
if (specifiers.length > 1 && !isSorted) errors.push({
|
|
2991
|
+
messageId: "sortedNames",
|
|
2992
|
+
node: declaration
|
|
2993
|
+
});
|
|
2994
|
+
}
|
|
2995
|
+
return errors;
|
|
2996
|
+
}
|
|
2997
|
+
//#endregion
|
|
2998
|
+
//#region src/rules/sortedReExports/sortSpecifiersText.ts
|
|
2999
|
+
function sortSpecifiersText(specifiers, sourceCode) {
|
|
3000
|
+
return [...specifiers].sort((a, b) => {
|
|
3001
|
+
return compare(getSpecifierName(a), getSpecifierName(b));
|
|
3002
|
+
}).map((s) => sourceCode.getText(s)).join(", ");
|
|
3003
|
+
}
|
|
3004
|
+
//#endregion
|
|
3005
|
+
//#region src/rules/sortedReExports/createFix/formatNamedReExportSpecifiers.ts
|
|
3006
|
+
function formatNamedReExportSpecifiers(declaration, sourceCode) {
|
|
3007
|
+
const specifiers = getReExportNamedSpecifiers(declaration);
|
|
3008
|
+
if (specifiers.length > 1 && !areSpecifiersSorted(specifiers)) {
|
|
3009
|
+
const sortedSpecifiers = sortSpecifiersText(specifiers, sourceCode);
|
|
3010
|
+
const source = declaration.source.value;
|
|
3011
|
+
return `${declaration.exportKind === "type" ? "export type " : "export "}{${sortedSpecifiers}} from '${source}'`;
|
|
3012
|
+
}
|
|
3013
|
+
return sourceCode.getText(declaration);
|
|
3014
|
+
}
|
|
3015
|
+
//#endregion
|
|
3016
|
+
//#region src/rules/sortedReExports/createFix/buildSortedReExportCode.ts
|
|
3017
|
+
function buildSortedReExportCode(grouped, sourceCode) {
|
|
3018
|
+
const sortedCode = [];
|
|
3019
|
+
for (const group of reExportGroupOrder) for (const item of grouped[group]) if (isNamedReExport(item)) sortedCode.push(formatNamedReExportSpecifiers(item.declaration, sourceCode));
|
|
3020
|
+
else sortedCode.push(sourceCode.getText(item.declaration));
|
|
3021
|
+
return sortedCode;
|
|
3022
|
+
}
|
|
3023
|
+
//#endregion
|
|
3024
|
+
//#region src/rules/sortedReExports/createFix/groupReExportsByType.ts
|
|
3025
|
+
function groupReExportsByType(categorized) {
|
|
3026
|
+
const grouped = {
|
|
3027
|
+
"re-export-all": [],
|
|
3028
|
+
"re-export-named": [],
|
|
3029
|
+
"re-export-namespace": [],
|
|
3030
|
+
"type-all": [],
|
|
3031
|
+
"type-named": [],
|
|
3032
|
+
"type-namespace": []
|
|
3033
|
+
};
|
|
3034
|
+
for (const item of categorized) grouped[item.group].push(item);
|
|
3035
|
+
return grouped;
|
|
3036
|
+
}
|
|
3037
|
+
//#endregion
|
|
3038
|
+
//#region src/rules/sortedReExports/createFix/sortExportGroups.ts
|
|
3039
|
+
function sortExportGroups(grouped) {
|
|
3040
|
+
grouped["re-export-all"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
3041
|
+
grouped["re-export-namespace"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
3042
|
+
grouped["re-export-named"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
3043
|
+
grouped["type-all"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
3044
|
+
grouped["type-namespace"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
3045
|
+
grouped["type-named"].sort((a, b) => compare(a.sortKey, b.sortKey));
|
|
3046
|
+
}
|
|
3047
|
+
//#endregion
|
|
3048
|
+
//#region src/rules/sortedReExports/createFix/createFixForGroup.ts
|
|
3049
|
+
function createFixForGroup(fixer, reExportDeclarations, sourceCode) {
|
|
3050
|
+
if (reExportDeclarations.length === 0) return null;
|
|
3051
|
+
const grouped = groupReExportsByType(categorizeReExports(reExportDeclarations));
|
|
3052
|
+
sortExportGroups(grouped);
|
|
3053
|
+
const sortedCode = buildSortedReExportCode(grouped, sourceCode).join("\n");
|
|
3054
|
+
const firstReExport = reExportDeclarations[0];
|
|
3055
|
+
const lastReExport = reExportDeclarations[reExportDeclarations.length - 1];
|
|
3056
|
+
return fixer.replaceTextRange([firstReExport.range[0], lastReExport.range[1]], sortedCode);
|
|
3057
|
+
}
|
|
3058
|
+
//#endregion
|
|
3059
|
+
//#region src/rules/sortedReExports/createFix/index.ts
|
|
3060
|
+
function createReExportFix(fixer, reExportGroups, sourceCode) {
|
|
3061
|
+
const fixes = [];
|
|
3062
|
+
for (const group of reExportGroups) {
|
|
3063
|
+
const fix = createFixForGroup(fixer, group, sourceCode);
|
|
3064
|
+
if (fix) fixes.push(fix);
|
|
3065
|
+
}
|
|
3066
|
+
return fixes;
|
|
3067
|
+
}
|
|
3068
|
+
//#endregion
|
|
3069
|
+
//#region src/rules/sortedReExports/isReExportDeclaration.ts
|
|
3070
|
+
function isReExportDeclaration(statement) {
|
|
3071
|
+
return statement.type === "ExportNamedDeclaration" && statement.source !== null || statement.type === "ExportAllDeclaration";
|
|
3072
|
+
}
|
|
3073
|
+
//#endregion
|
|
3074
|
+
//#region src/rules/sortedReExports/getReExportGroups.ts
|
|
3075
|
+
function getReExportGroups(programBody) {
|
|
3076
|
+
const groups = [];
|
|
3077
|
+
let currentGroup = [];
|
|
3078
|
+
for (const statement of programBody) {
|
|
3079
|
+
if (isReExportDeclaration(statement)) {
|
|
3080
|
+
currentGroup.push(statement);
|
|
3081
|
+
continue;
|
|
3082
|
+
}
|
|
3083
|
+
if (currentGroup.length > 0) {
|
|
3084
|
+
groups.push(currentGroup);
|
|
3085
|
+
currentGroup = [];
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
if (currentGroup.length > 0) groups.push(currentGroup);
|
|
3089
|
+
return groups;
|
|
3090
|
+
}
|
|
3091
|
+
//#endregion
|
|
3092
|
+
//#region src/main/customRules.ts
|
|
3093
|
+
var customRules = {
|
|
3094
|
+
plugins: { "@borela-tech": { rules: {
|
|
3095
|
+
"array-items-line-break": arrayItemsLineBreak,
|
|
3096
|
+
"brace-style-control-statements": braceStyleControlStatements,
|
|
3097
|
+
"brace-style-object-literal": braceStyleObjectLiteral,
|
|
3098
|
+
"compact-array-items": compactArrayItems,
|
|
3099
|
+
"export-filename-match": exportFilenameMatch,
|
|
3100
|
+
"function-call-argument-line-break": functionCallArgumentLineBreak,
|
|
3101
|
+
"function-cognitive-complexity": functionCognitiveComplexity,
|
|
3102
|
+
"function-parameter-line-break": functionParameterLineBreak,
|
|
3103
|
+
"imports-and-re-exports-at-top": importsAndReExportsAtTop,
|
|
3104
|
+
"individual-imports": individualImports,
|
|
3105
|
+
"individual-re-exports": individualReExports,
|
|
3106
|
+
"interface-property-line-break": interfacePropertyLineBreak,
|
|
3107
|
+
"max-declarations-per-file": maxDeclarationsPerFile,
|
|
3108
|
+
"multiline-union-type-aliases": multilineUnionTypeAliases,
|
|
3109
|
+
"naming-convention": namingConvention,
|
|
3110
|
+
"no-inline-object-types": noInlineObjectTypes,
|
|
3111
|
+
"no-unnecessary-braces": noUnnecessaryBraces,
|
|
3112
|
+
"object-property-line-break": objectPropertyLineBreak,
|
|
3113
|
+
"one-export-per-file": oneExportPerFile,
|
|
3114
|
+
"prefer-inline-export": preferInlineExport,
|
|
3115
|
+
"single-line-arrow-function-parameters": singleLineArrowFunctionParameters,
|
|
3116
|
+
"single-line-function-parameters": singleLineFunctionParameters,
|
|
3117
|
+
"single-line-imports": singleLineImports,
|
|
3118
|
+
"single-line-re-exports": singleLineReExports,
|
|
3119
|
+
"sorted-imports": sortedImports,
|
|
3120
|
+
"sorted-re-exports": {
|
|
3121
|
+
create(context) {
|
|
3122
|
+
return { Program(node) {
|
|
3123
|
+
const programBody = node.body;
|
|
3124
|
+
const reExportGroups = getReExportGroups(programBody);
|
|
3125
|
+
if (reExportGroups.length === 0) return;
|
|
3126
|
+
const allReExportErrors = [];
|
|
3127
|
+
for (const group of reExportGroups) {
|
|
3128
|
+
const categorizedReExports = categorizeReExports(group);
|
|
3129
|
+
const groupErrors = [
|
|
3130
|
+
...checkGroupOrdering(categorizedReExports),
|
|
3131
|
+
...checkAlphabeticalSorting(categorizedReExports),
|
|
3132
|
+
...checkSpecifiersSorting(categorizedReExports)
|
|
3133
|
+
];
|
|
3134
|
+
allReExportErrors.push(...groupErrors);
|
|
3135
|
+
}
|
|
3136
|
+
for (const error of allReExportErrors) context.report({
|
|
3137
|
+
fix(fixer) {
|
|
3138
|
+
const sourceCode = context.sourceCode;
|
|
3139
|
+
return createReExportFix(fixer, reExportGroups, sourceCode);
|
|
3140
|
+
},
|
|
3141
|
+
messageId: error.messageId,
|
|
3142
|
+
node: error.node
|
|
3143
|
+
});
|
|
3144
|
+
} };
|
|
3145
|
+
},
|
|
3146
|
+
meta: {
|
|
3147
|
+
docs: { description: "Enforce sorted exports alphabetically." },
|
|
3148
|
+
fixable: "code",
|
|
3149
|
+
messages: {
|
|
3150
|
+
sortedNames: "Named exports should be sorted alphabetically",
|
|
3151
|
+
sortedReExports: "Exports should be sorted alphabetically",
|
|
3152
|
+
wrongGroup: "Export is in wrong group"
|
|
3153
|
+
},
|
|
3154
|
+
schema: [],
|
|
3155
|
+
type: "suggestion"
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3158
|
+
} } },
|
|
3159
|
+
rules: {
|
|
3160
|
+
"@borela-tech/array-items-line-break": ["error", { maxLength: 80 }],
|
|
3161
|
+
"@borela-tech/brace-style-control-statements": "error",
|
|
3162
|
+
"@borela-tech/brace-style-object-literal": "error",
|
|
3163
|
+
"@borela-tech/compact-array-items": "error",
|
|
3164
|
+
"@borela-tech/export-filename-match": "error",
|
|
3165
|
+
"@borela-tech/function-call-argument-line-break": ["error", { maxLength: 80 }],
|
|
3166
|
+
"@borela-tech/function-cognitive-complexity": ["error", { maxCognitiveComplexity: 15 }],
|
|
3167
|
+
"@borela-tech/function-parameter-line-break": ["error", { maxLength: 80 }],
|
|
3168
|
+
"@borela-tech/imports-and-re-exports-at-top": "error",
|
|
3169
|
+
"@borela-tech/individual-imports": "error",
|
|
3170
|
+
"@borela-tech/individual-re-exports": "error",
|
|
3171
|
+
"@borela-tech/interface-property-line-break": ["error", { maxLength: 80 }],
|
|
3172
|
+
"@borela-tech/max-declarations-per-file": "error",
|
|
3173
|
+
"@borela-tech/multiline-union-type-aliases": "error",
|
|
3174
|
+
"@borela-tech/naming-convention": "error",
|
|
3175
|
+
"@borela-tech/no-inline-object-types": "error",
|
|
3176
|
+
"@borela-tech/no-unnecessary-braces": "error",
|
|
3177
|
+
"@borela-tech/object-property-line-break": "error",
|
|
3178
|
+
"@borela-tech/one-export-per-file": "error",
|
|
3179
|
+
"@borela-tech/prefer-inline-export": "error",
|
|
3180
|
+
"@borela-tech/single-line-arrow-function-parameters": ["error", { maxLength: 80 }],
|
|
3181
|
+
"@borela-tech/single-line-function-parameters": ["error", { maxLength: 80 }],
|
|
3182
|
+
"@borela-tech/single-line-imports": "error",
|
|
3183
|
+
"@borela-tech/single-line-re-exports": "error",
|
|
3184
|
+
"@borela-tech/sorted-imports": "error",
|
|
3185
|
+
"@borela-tech/sorted-re-exports": "error"
|
|
3186
|
+
}
|
|
3187
|
+
};
|
|
3188
|
+
//#endregion
|
|
3189
|
+
//#region src/main/generalRules.ts
|
|
3190
|
+
var generalRules = { rules: {
|
|
3191
|
+
"capitalized-comments": [
|
|
3192
|
+
"error",
|
|
3193
|
+
"always",
|
|
3194
|
+
{ ignoreConsecutiveComments: true }
|
|
3195
|
+
],
|
|
3196
|
+
complexity: ["error", 10],
|
|
3197
|
+
"no-restricted-exports": ["error", { restrictDefaultExports: { direct: true } }],
|
|
3198
|
+
"react/react-in-jsx-scope": "off"
|
|
3199
|
+
} };
|
|
3200
|
+
//#endregion
|
|
3201
|
+
//#region src/main/ignores.ts
|
|
3202
|
+
var ignores = { ignores: [
|
|
3203
|
+
"src/graphql/sdk.ts",
|
|
3204
|
+
"**/node_modules/**",
|
|
3205
|
+
"**/dist/**"
|
|
3206
|
+
] };
|
|
3207
|
+
//#endregion
|
|
3208
|
+
//#region src/main/languageOptions.ts
|
|
3209
|
+
var languageOptions = {
|
|
3210
|
+
languageOptions: { parserOptions: { projectService: true } },
|
|
3211
|
+
settings: { react: { version: "19" } }
|
|
3212
|
+
};
|
|
3213
|
+
//#endregion
|
|
3214
|
+
//#region src/main/perfectionistRules.ts
|
|
3215
|
+
var perfectionistRules = {
|
|
3216
|
+
plugins: { perfectionist },
|
|
3217
|
+
rules: {
|
|
3218
|
+
"perfectionist/sort-array-includes": ["error", {
|
|
3219
|
+
order: "asc",
|
|
3220
|
+
type: "natural"
|
|
3221
|
+
}],
|
|
3222
|
+
"perfectionist/sort-decorators": ["error", {
|
|
3223
|
+
order: "asc",
|
|
3224
|
+
type: "natural"
|
|
3225
|
+
}],
|
|
3226
|
+
"perfectionist/sort-enums": ["error", {
|
|
3227
|
+
order: "asc",
|
|
3228
|
+
type: "natural"
|
|
3229
|
+
}],
|
|
3230
|
+
"perfectionist/sort-heritage-clauses": ["error", {
|
|
3231
|
+
order: "asc",
|
|
3232
|
+
type: "natural"
|
|
3233
|
+
}],
|
|
3234
|
+
"perfectionist/sort-interfaces": ["error", {
|
|
3235
|
+
order: "asc",
|
|
3236
|
+
type: "natural"
|
|
3237
|
+
}],
|
|
3238
|
+
"perfectionist/sort-intersection-types": ["error", {
|
|
3239
|
+
order: "asc",
|
|
3240
|
+
type: "natural"
|
|
3241
|
+
}],
|
|
3242
|
+
"perfectionist/sort-jsx-props": ["error", {
|
|
3243
|
+
order: "asc",
|
|
3244
|
+
type: "natural"
|
|
3245
|
+
}],
|
|
3246
|
+
"perfectionist/sort-maps": ["error", {
|
|
3247
|
+
order: "asc",
|
|
3248
|
+
type: "natural"
|
|
3249
|
+
}],
|
|
3250
|
+
"perfectionist/sort-object-types": ["error", {
|
|
3251
|
+
order: "asc",
|
|
3252
|
+
type: "natural"
|
|
3253
|
+
}],
|
|
3254
|
+
"perfectionist/sort-objects": ["error", {
|
|
3255
|
+
order: "asc",
|
|
3256
|
+
type: "natural"
|
|
3257
|
+
}],
|
|
3258
|
+
"perfectionist/sort-sets": ["error", {
|
|
3259
|
+
order: "asc",
|
|
3260
|
+
type: "natural"
|
|
3261
|
+
}],
|
|
3262
|
+
"perfectionist/sort-switch-case": ["error", {
|
|
3263
|
+
order: "asc",
|
|
3264
|
+
type: "natural"
|
|
3265
|
+
}],
|
|
3266
|
+
"perfectionist/sort-union-types": ["error", {
|
|
3267
|
+
order: "asc",
|
|
3268
|
+
type: "natural"
|
|
3269
|
+
}]
|
|
3270
|
+
}
|
|
3271
|
+
};
|
|
3272
|
+
//#endregion
|
|
3273
|
+
//#region src/main/reactHooks.ts
|
|
3274
|
+
var reactHooks = {
|
|
3275
|
+
plugins: { "react-hooks": rule },
|
|
3276
|
+
rules: rule.configs.recommended.rules
|
|
3277
|
+
};
|
|
3278
|
+
//#endregion
|
|
3279
|
+
//#region src/main/stylisticRules.ts
|
|
3280
|
+
var stylisticRules = { rules: {
|
|
3281
|
+
"@stylistic/array-bracket-spacing": ["error", "never"],
|
|
3282
|
+
"@stylistic/arrow-parens": ["error", "as-needed"],
|
|
3283
|
+
"@stylistic/block-spacing": "off",
|
|
3284
|
+
"@stylistic/brace-style": [
|
|
3285
|
+
"error",
|
|
3286
|
+
"1tbs",
|
|
3287
|
+
{ allowSingleLine: true }
|
|
3288
|
+
],
|
|
3289
|
+
"@stylistic/indent": [
|
|
3290
|
+
"error",
|
|
3291
|
+
2,
|
|
3292
|
+
{ ignoredNodes: ["TSMappedType > *"] }
|
|
3293
|
+
],
|
|
3294
|
+
"@stylistic/jsx-tag-spacing": ["error", {
|
|
3295
|
+
afterOpening: "never",
|
|
3296
|
+
beforeClosing: "never",
|
|
3297
|
+
beforeSelfClosing: "never",
|
|
3298
|
+
closingSlash: "never"
|
|
3299
|
+
}],
|
|
3300
|
+
"@stylistic/jsx-wrap-multilines": "off",
|
|
3301
|
+
"@stylistic/lines-between-class-members": "off",
|
|
3302
|
+
"@stylistic/object-curly-newline": "off",
|
|
3303
|
+
"@stylistic/object-curly-spacing": ["error", "never"],
|
|
3304
|
+
"@stylistic/operator-linebreak": [
|
|
3305
|
+
"error",
|
|
3306
|
+
"before",
|
|
3307
|
+
{ overrides: { "=": "after" } }
|
|
3308
|
+
],
|
|
3309
|
+
"@stylistic/quote-props": ["error", "as-needed"],
|
|
3310
|
+
"@stylistic/quotes": [
|
|
3311
|
+
"error",
|
|
3312
|
+
"single",
|
|
3313
|
+
{ avoidEscape: true }
|
|
3314
|
+
],
|
|
3315
|
+
"@stylistic/semi": [
|
|
3316
|
+
"error",
|
|
3317
|
+
"never",
|
|
3318
|
+
{ beforeStatementContinuationChars: "always" }
|
|
3319
|
+
]
|
|
3320
|
+
} };
|
|
3321
|
+
//#endregion
|
|
3322
|
+
//#region src/main/typescriptRules.ts
|
|
3323
|
+
var typescriptRules = { rules: {
|
|
3324
|
+
"@typescript-eslint/consistent-indexed-object-style": "off",
|
|
3325
|
+
"@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "separate-type-imports" }],
|
|
3326
|
+
"@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: true }],
|
|
3327
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
3328
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
3329
|
+
argsIgnorePattern: "^_",
|
|
3330
|
+
caughtErrorsIgnorePattern: "^_",
|
|
3331
|
+
varsIgnorePattern: "^_"
|
|
3332
|
+
}]
|
|
3333
|
+
} };
|
|
3334
|
+
//#endregion
|
|
3335
|
+
//#region node_modules/globals/globals.json
|
|
3336
|
+
var globals_exports = /* @__PURE__ */ __exportAll({
|
|
3337
|
+
amd: () => amd,
|
|
3338
|
+
applescript: () => applescript,
|
|
3339
|
+
atomtest: () => atomtest,
|
|
3340
|
+
browser: () => browser,
|
|
3341
|
+
builtin: () => builtin,
|
|
3342
|
+
commonjs: () => commonjs,
|
|
3343
|
+
couch: () => couch,
|
|
3344
|
+
default: () => globals_default,
|
|
3345
|
+
devtools: () => devtools,
|
|
3346
|
+
embertest: () => embertest,
|
|
3347
|
+
es2015: () => es2015,
|
|
3348
|
+
es2017: () => es2017,
|
|
3349
|
+
es2020: () => es2020,
|
|
3350
|
+
es2021: () => es2021,
|
|
3351
|
+
es5: () => es5,
|
|
3352
|
+
greasemonkey: () => greasemonkey,
|
|
3353
|
+
jasmine: () => jasmine,
|
|
3354
|
+
jest: () => jest,
|
|
3355
|
+
jquery: () => jquery,
|
|
3356
|
+
meteor: () => meteor,
|
|
3357
|
+
mocha: () => mocha,
|
|
3358
|
+
mongo: () => mongo,
|
|
3359
|
+
nashorn: () => nashorn,
|
|
3360
|
+
node: () => node,
|
|
3361
|
+
nodeBuiltin: () => nodeBuiltin,
|
|
3362
|
+
phantomjs: () => phantomjs,
|
|
3363
|
+
prototypejs: () => prototypejs,
|
|
3364
|
+
protractor: () => protractor,
|
|
3365
|
+
qunit: () => qunit,
|
|
3366
|
+
rhino: () => rhino,
|
|
3367
|
+
serviceworker: () => serviceworker,
|
|
3368
|
+
shelljs: () => shelljs,
|
|
3369
|
+
webextensions: () => webextensions,
|
|
3370
|
+
worker: () => worker,
|
|
3371
|
+
wsh: () => wsh,
|
|
3372
|
+
yui: () => yui
|
|
3373
|
+
});
|
|
3374
|
+
var builtin, es5, es2015, es2017, es2020, es2021, browser, worker, node, nodeBuiltin, commonjs, amd, mocha, jasmine, jest, qunit, phantomjs, couch, rhino, nashorn, wsh, jquery, yui, shelljs, prototypejs, meteor, mongo, applescript, serviceworker, atomtest, embertest, protractor, webextensions, greasemonkey, devtools, globals_default;
|
|
3375
|
+
var init_globals = __esmMin((() => {
|
|
3376
|
+
builtin = {
|
|
3377
|
+
"AggregateError": false,
|
|
3378
|
+
"Array": false,
|
|
3379
|
+
"ArrayBuffer": false,
|
|
3380
|
+
"Atomics": false,
|
|
3381
|
+
"BigInt": false,
|
|
3382
|
+
"BigInt64Array": false,
|
|
3383
|
+
"BigUint64Array": false,
|
|
3384
|
+
"Boolean": false,
|
|
3385
|
+
"constructor": false,
|
|
3386
|
+
"DataView": false,
|
|
3387
|
+
"Date": false,
|
|
3388
|
+
"decodeURI": false,
|
|
3389
|
+
"decodeURIComponent": false,
|
|
3390
|
+
"encodeURI": false,
|
|
3391
|
+
"encodeURIComponent": false,
|
|
3392
|
+
"Error": false,
|
|
3393
|
+
"escape": false,
|
|
3394
|
+
"eval": false,
|
|
3395
|
+
"EvalError": false,
|
|
3396
|
+
"FinalizationRegistry": false,
|
|
3397
|
+
"Float32Array": false,
|
|
3398
|
+
"Float64Array": false,
|
|
3399
|
+
"Function": false,
|
|
3400
|
+
"globalThis": false,
|
|
3401
|
+
"hasOwnProperty": false,
|
|
3402
|
+
"Infinity": false,
|
|
3403
|
+
"Int16Array": false,
|
|
3404
|
+
"Int32Array": false,
|
|
3405
|
+
"Int8Array": false,
|
|
3406
|
+
"isFinite": false,
|
|
3407
|
+
"isNaN": false,
|
|
3408
|
+
"isPrototypeOf": false,
|
|
3409
|
+
"JSON": false,
|
|
3410
|
+
"Map": false,
|
|
3411
|
+
"Math": false,
|
|
3412
|
+
"NaN": false,
|
|
3413
|
+
"Number": false,
|
|
3414
|
+
"Object": false,
|
|
3415
|
+
"parseFloat": false,
|
|
3416
|
+
"parseInt": false,
|
|
3417
|
+
"Promise": false,
|
|
3418
|
+
"propertyIsEnumerable": false,
|
|
3419
|
+
"Proxy": false,
|
|
3420
|
+
"RangeError": false,
|
|
3421
|
+
"ReferenceError": false,
|
|
3422
|
+
"Reflect": false,
|
|
3423
|
+
"RegExp": false,
|
|
3424
|
+
"Set": false,
|
|
3425
|
+
"SharedArrayBuffer": false,
|
|
3426
|
+
"String": false,
|
|
3427
|
+
"Symbol": false,
|
|
3428
|
+
"SyntaxError": false,
|
|
3429
|
+
"toLocaleString": false,
|
|
3430
|
+
"toString": false,
|
|
3431
|
+
"TypeError": false,
|
|
3432
|
+
"Uint16Array": false,
|
|
3433
|
+
"Uint32Array": false,
|
|
3434
|
+
"Uint8Array": false,
|
|
3435
|
+
"Uint8ClampedArray": false,
|
|
3436
|
+
"undefined": false,
|
|
3437
|
+
"unescape": false,
|
|
3438
|
+
"URIError": false,
|
|
3439
|
+
"valueOf": false,
|
|
3440
|
+
"WeakMap": false,
|
|
3441
|
+
"WeakRef": false,
|
|
3442
|
+
"WeakSet": false
|
|
3443
|
+
};
|
|
3444
|
+
es5 = {
|
|
3445
|
+
"Array": false,
|
|
3446
|
+
"Boolean": false,
|
|
3447
|
+
"constructor": false,
|
|
3448
|
+
"Date": false,
|
|
3449
|
+
"decodeURI": false,
|
|
3450
|
+
"decodeURIComponent": false,
|
|
3451
|
+
"encodeURI": false,
|
|
3452
|
+
"encodeURIComponent": false,
|
|
3453
|
+
"Error": false,
|
|
3454
|
+
"escape": false,
|
|
3455
|
+
"eval": false,
|
|
3456
|
+
"EvalError": false,
|
|
3457
|
+
"Function": false,
|
|
3458
|
+
"hasOwnProperty": false,
|
|
3459
|
+
"Infinity": false,
|
|
3460
|
+
"isFinite": false,
|
|
3461
|
+
"isNaN": false,
|
|
3462
|
+
"isPrototypeOf": false,
|
|
3463
|
+
"JSON": false,
|
|
3464
|
+
"Math": false,
|
|
3465
|
+
"NaN": false,
|
|
3466
|
+
"Number": false,
|
|
3467
|
+
"Object": false,
|
|
3468
|
+
"parseFloat": false,
|
|
3469
|
+
"parseInt": false,
|
|
3470
|
+
"propertyIsEnumerable": false,
|
|
3471
|
+
"RangeError": false,
|
|
3472
|
+
"ReferenceError": false,
|
|
3473
|
+
"RegExp": false,
|
|
3474
|
+
"String": false,
|
|
3475
|
+
"SyntaxError": false,
|
|
3476
|
+
"toLocaleString": false,
|
|
3477
|
+
"toString": false,
|
|
3478
|
+
"TypeError": false,
|
|
3479
|
+
"undefined": false,
|
|
3480
|
+
"unescape": false,
|
|
3481
|
+
"URIError": false,
|
|
3482
|
+
"valueOf": false
|
|
3483
|
+
};
|
|
3484
|
+
es2015 = {
|
|
3485
|
+
"Array": false,
|
|
3486
|
+
"ArrayBuffer": false,
|
|
3487
|
+
"Boolean": false,
|
|
3488
|
+
"constructor": false,
|
|
3489
|
+
"DataView": false,
|
|
3490
|
+
"Date": false,
|
|
3491
|
+
"decodeURI": false,
|
|
3492
|
+
"decodeURIComponent": false,
|
|
3493
|
+
"encodeURI": false,
|
|
3494
|
+
"encodeURIComponent": false,
|
|
3495
|
+
"Error": false,
|
|
3496
|
+
"escape": false,
|
|
3497
|
+
"eval": false,
|
|
3498
|
+
"EvalError": false,
|
|
3499
|
+
"Float32Array": false,
|
|
3500
|
+
"Float64Array": false,
|
|
3501
|
+
"Function": false,
|
|
3502
|
+
"hasOwnProperty": false,
|
|
3503
|
+
"Infinity": false,
|
|
3504
|
+
"Int16Array": false,
|
|
3505
|
+
"Int32Array": false,
|
|
3506
|
+
"Int8Array": false,
|
|
3507
|
+
"isFinite": false,
|
|
3508
|
+
"isNaN": false,
|
|
3509
|
+
"isPrototypeOf": false,
|
|
3510
|
+
"JSON": false,
|
|
3511
|
+
"Map": false,
|
|
3512
|
+
"Math": false,
|
|
3513
|
+
"NaN": false,
|
|
3514
|
+
"Number": false,
|
|
3515
|
+
"Object": false,
|
|
3516
|
+
"parseFloat": false,
|
|
3517
|
+
"parseInt": false,
|
|
3518
|
+
"Promise": false,
|
|
3519
|
+
"propertyIsEnumerable": false,
|
|
3520
|
+
"Proxy": false,
|
|
3521
|
+
"RangeError": false,
|
|
3522
|
+
"ReferenceError": false,
|
|
3523
|
+
"Reflect": false,
|
|
3524
|
+
"RegExp": false,
|
|
3525
|
+
"Set": false,
|
|
3526
|
+
"String": false,
|
|
3527
|
+
"Symbol": false,
|
|
3528
|
+
"SyntaxError": false,
|
|
3529
|
+
"toLocaleString": false,
|
|
3530
|
+
"toString": false,
|
|
3531
|
+
"TypeError": false,
|
|
3532
|
+
"Uint16Array": false,
|
|
3533
|
+
"Uint32Array": false,
|
|
3534
|
+
"Uint8Array": false,
|
|
3535
|
+
"Uint8ClampedArray": false,
|
|
3536
|
+
"undefined": false,
|
|
3537
|
+
"unescape": false,
|
|
3538
|
+
"URIError": false,
|
|
3539
|
+
"valueOf": false,
|
|
3540
|
+
"WeakMap": false,
|
|
3541
|
+
"WeakSet": false
|
|
3542
|
+
};
|
|
3543
|
+
es2017 = {
|
|
3544
|
+
"Array": false,
|
|
3545
|
+
"ArrayBuffer": false,
|
|
3546
|
+
"Atomics": false,
|
|
3547
|
+
"Boolean": false,
|
|
3548
|
+
"constructor": false,
|
|
3549
|
+
"DataView": false,
|
|
3550
|
+
"Date": false,
|
|
3551
|
+
"decodeURI": false,
|
|
3552
|
+
"decodeURIComponent": false,
|
|
3553
|
+
"encodeURI": false,
|
|
3554
|
+
"encodeURIComponent": false,
|
|
3555
|
+
"Error": false,
|
|
3556
|
+
"escape": false,
|
|
3557
|
+
"eval": false,
|
|
3558
|
+
"EvalError": false,
|
|
3559
|
+
"Float32Array": false,
|
|
3560
|
+
"Float64Array": false,
|
|
3561
|
+
"Function": false,
|
|
3562
|
+
"hasOwnProperty": false,
|
|
3563
|
+
"Infinity": false,
|
|
3564
|
+
"Int16Array": false,
|
|
3565
|
+
"Int32Array": false,
|
|
3566
|
+
"Int8Array": false,
|
|
3567
|
+
"isFinite": false,
|
|
3568
|
+
"isNaN": false,
|
|
3569
|
+
"isPrototypeOf": false,
|
|
3570
|
+
"JSON": false,
|
|
3571
|
+
"Map": false,
|
|
3572
|
+
"Math": false,
|
|
3573
|
+
"NaN": false,
|
|
3574
|
+
"Number": false,
|
|
3575
|
+
"Object": false,
|
|
3576
|
+
"parseFloat": false,
|
|
3577
|
+
"parseInt": false,
|
|
3578
|
+
"Promise": false,
|
|
3579
|
+
"propertyIsEnumerable": false,
|
|
3580
|
+
"Proxy": false,
|
|
3581
|
+
"RangeError": false,
|
|
3582
|
+
"ReferenceError": false,
|
|
3583
|
+
"Reflect": false,
|
|
3584
|
+
"RegExp": false,
|
|
3585
|
+
"Set": false,
|
|
3586
|
+
"SharedArrayBuffer": false,
|
|
3587
|
+
"String": false,
|
|
3588
|
+
"Symbol": false,
|
|
3589
|
+
"SyntaxError": false,
|
|
3590
|
+
"toLocaleString": false,
|
|
3591
|
+
"toString": false,
|
|
3592
|
+
"TypeError": false,
|
|
3593
|
+
"Uint16Array": false,
|
|
3594
|
+
"Uint32Array": false,
|
|
3595
|
+
"Uint8Array": false,
|
|
3596
|
+
"Uint8ClampedArray": false,
|
|
3597
|
+
"undefined": false,
|
|
3598
|
+
"unescape": false,
|
|
3599
|
+
"URIError": false,
|
|
3600
|
+
"valueOf": false,
|
|
3601
|
+
"WeakMap": false,
|
|
3602
|
+
"WeakSet": false
|
|
3603
|
+
};
|
|
3604
|
+
es2020 = {
|
|
3605
|
+
"Array": false,
|
|
3606
|
+
"ArrayBuffer": false,
|
|
3607
|
+
"Atomics": false,
|
|
3608
|
+
"BigInt": false,
|
|
3609
|
+
"BigInt64Array": false,
|
|
3610
|
+
"BigUint64Array": false,
|
|
3611
|
+
"Boolean": false,
|
|
3612
|
+
"constructor": false,
|
|
3613
|
+
"DataView": false,
|
|
3614
|
+
"Date": false,
|
|
3615
|
+
"decodeURI": false,
|
|
3616
|
+
"decodeURIComponent": false,
|
|
3617
|
+
"encodeURI": false,
|
|
3618
|
+
"encodeURIComponent": false,
|
|
3619
|
+
"Error": false,
|
|
3620
|
+
"escape": false,
|
|
3621
|
+
"eval": false,
|
|
3622
|
+
"EvalError": false,
|
|
3623
|
+
"Float32Array": false,
|
|
3624
|
+
"Float64Array": false,
|
|
3625
|
+
"Function": false,
|
|
3626
|
+
"globalThis": false,
|
|
3627
|
+
"hasOwnProperty": false,
|
|
3628
|
+
"Infinity": false,
|
|
3629
|
+
"Int16Array": false,
|
|
3630
|
+
"Int32Array": false,
|
|
3631
|
+
"Int8Array": false,
|
|
3632
|
+
"isFinite": false,
|
|
3633
|
+
"isNaN": false,
|
|
3634
|
+
"isPrototypeOf": false,
|
|
3635
|
+
"JSON": false,
|
|
3636
|
+
"Map": false,
|
|
3637
|
+
"Math": false,
|
|
3638
|
+
"NaN": false,
|
|
3639
|
+
"Number": false,
|
|
3640
|
+
"Object": false,
|
|
3641
|
+
"parseFloat": false,
|
|
3642
|
+
"parseInt": false,
|
|
3643
|
+
"Promise": false,
|
|
3644
|
+
"propertyIsEnumerable": false,
|
|
3645
|
+
"Proxy": false,
|
|
3646
|
+
"RangeError": false,
|
|
3647
|
+
"ReferenceError": false,
|
|
3648
|
+
"Reflect": false,
|
|
3649
|
+
"RegExp": false,
|
|
3650
|
+
"Set": false,
|
|
3651
|
+
"SharedArrayBuffer": false,
|
|
3652
|
+
"String": false,
|
|
3653
|
+
"Symbol": false,
|
|
3654
|
+
"SyntaxError": false,
|
|
3655
|
+
"toLocaleString": false,
|
|
3656
|
+
"toString": false,
|
|
3657
|
+
"TypeError": false,
|
|
3658
|
+
"Uint16Array": false,
|
|
3659
|
+
"Uint32Array": false,
|
|
3660
|
+
"Uint8Array": false,
|
|
3661
|
+
"Uint8ClampedArray": false,
|
|
3662
|
+
"undefined": false,
|
|
3663
|
+
"unescape": false,
|
|
3664
|
+
"URIError": false,
|
|
3665
|
+
"valueOf": false,
|
|
3666
|
+
"WeakMap": false,
|
|
3667
|
+
"WeakSet": false
|
|
3668
|
+
};
|
|
3669
|
+
es2021 = {
|
|
3670
|
+
"AggregateError": false,
|
|
3671
|
+
"Array": false,
|
|
3672
|
+
"ArrayBuffer": false,
|
|
3673
|
+
"Atomics": false,
|
|
3674
|
+
"BigInt": false,
|
|
3675
|
+
"BigInt64Array": false,
|
|
3676
|
+
"BigUint64Array": false,
|
|
3677
|
+
"Boolean": false,
|
|
3678
|
+
"constructor": false,
|
|
3679
|
+
"DataView": false,
|
|
3680
|
+
"Date": false,
|
|
3681
|
+
"decodeURI": false,
|
|
3682
|
+
"decodeURIComponent": false,
|
|
3683
|
+
"encodeURI": false,
|
|
3684
|
+
"encodeURIComponent": false,
|
|
3685
|
+
"Error": false,
|
|
3686
|
+
"escape": false,
|
|
3687
|
+
"eval": false,
|
|
3688
|
+
"EvalError": false,
|
|
3689
|
+
"FinalizationRegistry": false,
|
|
3690
|
+
"Float32Array": false,
|
|
3691
|
+
"Float64Array": false,
|
|
3692
|
+
"Function": false,
|
|
3693
|
+
"globalThis": false,
|
|
3694
|
+
"hasOwnProperty": false,
|
|
3695
|
+
"Infinity": false,
|
|
3696
|
+
"Int16Array": false,
|
|
3697
|
+
"Int32Array": false,
|
|
3698
|
+
"Int8Array": false,
|
|
3699
|
+
"isFinite": false,
|
|
3700
|
+
"isNaN": false,
|
|
3701
|
+
"isPrototypeOf": false,
|
|
3702
|
+
"JSON": false,
|
|
3703
|
+
"Map": false,
|
|
3704
|
+
"Math": false,
|
|
3705
|
+
"NaN": false,
|
|
3706
|
+
"Number": false,
|
|
3707
|
+
"Object": false,
|
|
3708
|
+
"parseFloat": false,
|
|
3709
|
+
"parseInt": false,
|
|
3710
|
+
"Promise": false,
|
|
3711
|
+
"propertyIsEnumerable": false,
|
|
3712
|
+
"Proxy": false,
|
|
3713
|
+
"RangeError": false,
|
|
3714
|
+
"ReferenceError": false,
|
|
3715
|
+
"Reflect": false,
|
|
3716
|
+
"RegExp": false,
|
|
3717
|
+
"Set": false,
|
|
3718
|
+
"SharedArrayBuffer": false,
|
|
3719
|
+
"String": false,
|
|
3720
|
+
"Symbol": false,
|
|
3721
|
+
"SyntaxError": false,
|
|
3722
|
+
"toLocaleString": false,
|
|
3723
|
+
"toString": false,
|
|
3724
|
+
"TypeError": false,
|
|
3725
|
+
"Uint16Array": false,
|
|
3726
|
+
"Uint32Array": false,
|
|
3727
|
+
"Uint8Array": false,
|
|
3728
|
+
"Uint8ClampedArray": false,
|
|
3729
|
+
"undefined": false,
|
|
3730
|
+
"unescape": false,
|
|
3731
|
+
"URIError": false,
|
|
3732
|
+
"valueOf": false,
|
|
3733
|
+
"WeakMap": false,
|
|
3734
|
+
"WeakRef": false,
|
|
3735
|
+
"WeakSet": false
|
|
3736
|
+
};
|
|
3737
|
+
browser = /* @__PURE__ */ JSON.parse("{\"AbortController\":false,\"AbortSignal\":false,\"addEventListener\":false,\"alert\":false,\"AnalyserNode\":false,\"Animation\":false,\"AnimationEffectReadOnly\":false,\"AnimationEffectTiming\":false,\"AnimationEffectTimingReadOnly\":false,\"AnimationEvent\":false,\"AnimationPlaybackEvent\":false,\"AnimationTimeline\":false,\"applicationCache\":false,\"ApplicationCache\":false,\"ApplicationCacheErrorEvent\":false,\"atob\":false,\"Attr\":false,\"Audio\":false,\"AudioBuffer\":false,\"AudioBufferSourceNode\":false,\"AudioContext\":false,\"AudioDestinationNode\":false,\"AudioListener\":false,\"AudioNode\":false,\"AudioParam\":false,\"AudioProcessingEvent\":false,\"AudioScheduledSourceNode\":false,\"AudioWorkletGlobalScope\":false,\"AudioWorkletNode\":false,\"AudioWorkletProcessor\":false,\"BarProp\":false,\"BaseAudioContext\":false,\"BatteryManager\":false,\"BeforeUnloadEvent\":false,\"BiquadFilterNode\":false,\"Blob\":false,\"BlobEvent\":false,\"blur\":false,\"BroadcastChannel\":false,\"btoa\":false,\"BudgetService\":false,\"ByteLengthQueuingStrategy\":false,\"Cache\":false,\"caches\":false,\"CacheStorage\":false,\"cancelAnimationFrame\":false,\"cancelIdleCallback\":false,\"CanvasCaptureMediaStreamTrack\":false,\"CanvasGradient\":false,\"CanvasPattern\":false,\"CanvasRenderingContext2D\":false,\"ChannelMergerNode\":false,\"ChannelSplitterNode\":false,\"CharacterData\":false,\"clearInterval\":false,\"clearTimeout\":false,\"clientInformation\":false,\"ClipboardEvent\":false,\"ClipboardItem\":false,\"close\":false,\"closed\":false,\"CloseEvent\":false,\"Comment\":false,\"CompositionEvent\":false,\"CompressionStream\":false,\"confirm\":false,\"console\":false,\"ConstantSourceNode\":false,\"ConvolverNode\":false,\"CountQueuingStrategy\":false,\"createImageBitmap\":false,\"Credential\":false,\"CredentialsContainer\":false,\"crypto\":false,\"Crypto\":false,\"CryptoKey\":false,\"CSS\":false,\"CSSConditionRule\":false,\"CSSFontFaceRule\":false,\"CSSGroupingRule\":false,\"CSSImportRule\":false,\"CSSKeyframeRule\":false,\"CSSKeyframesRule\":false,\"CSSMatrixComponent\":false,\"CSSMediaRule\":false,\"CSSNamespaceRule\":false,\"CSSPageRule\":false,\"CSSPerspective\":false,\"CSSRotate\":false,\"CSSRule\":false,\"CSSRuleList\":false,\"CSSScale\":false,\"CSSSkew\":false,\"CSSSkewX\":false,\"CSSSkewY\":false,\"CSSStyleDeclaration\":false,\"CSSStyleRule\":false,\"CSSStyleSheet\":false,\"CSSSupportsRule\":false,\"CSSTransformValue\":false,\"CSSTranslate\":false,\"CustomElementRegistry\":false,\"customElements\":false,\"CustomEvent\":false,\"DataTransfer\":false,\"DataTransferItem\":false,\"DataTransferItemList\":false,\"DecompressionStream\":false,\"defaultstatus\":false,\"defaultStatus\":false,\"DelayNode\":false,\"DeviceMotionEvent\":false,\"DeviceOrientationEvent\":false,\"devicePixelRatio\":false,\"dispatchEvent\":false,\"document\":false,\"Document\":false,\"DocumentFragment\":false,\"DocumentType\":false,\"DOMError\":false,\"DOMException\":false,\"DOMImplementation\":false,\"DOMMatrix\":false,\"DOMMatrixReadOnly\":false,\"DOMParser\":false,\"DOMPoint\":false,\"DOMPointReadOnly\":false,\"DOMQuad\":false,\"DOMRect\":false,\"DOMRectList\":false,\"DOMRectReadOnly\":false,\"DOMStringList\":false,\"DOMStringMap\":false,\"DOMTokenList\":false,\"DragEvent\":false,\"DynamicsCompressorNode\":false,\"Element\":false,\"ErrorEvent\":false,\"event\":false,\"Event\":false,\"EventSource\":false,\"EventTarget\":false,\"external\":false,\"fetch\":false,\"File\":false,\"FileList\":false,\"FileReader\":false,\"find\":false,\"focus\":false,\"FocusEvent\":false,\"FontFace\":false,\"FontFaceSetLoadEvent\":false,\"FormData\":false,\"FormDataEvent\":false,\"frameElement\":false,\"frames\":false,\"GainNode\":false,\"Gamepad\":false,\"GamepadButton\":false,\"GamepadEvent\":false,\"getComputedStyle\":false,\"getSelection\":false,\"HashChangeEvent\":false,\"Headers\":false,\"history\":false,\"History\":false,\"HTMLAllCollection\":false,\"HTMLAnchorElement\":false,\"HTMLAreaElement\":false,\"HTMLAudioElement\":false,\"HTMLBaseElement\":false,\"HTMLBodyElement\":false,\"HTMLBRElement\":false,\"HTMLButtonElement\":false,\"HTMLCanvasElement\":false,\"HTMLCollection\":false,\"HTMLContentElement\":false,\"HTMLDataElement\":false,\"HTMLDataListElement\":false,\"HTMLDetailsElement\":false,\"HTMLDialogElement\":false,\"HTMLDirectoryElement\":false,\"HTMLDivElement\":false,\"HTMLDListElement\":false,\"HTMLDocument\":false,\"HTMLElement\":false,\"HTMLEmbedElement\":false,\"HTMLFieldSetElement\":false,\"HTMLFontElement\":false,\"HTMLFormControlsCollection\":false,\"HTMLFormElement\":false,\"HTMLFrameElement\":false,\"HTMLFrameSetElement\":false,\"HTMLHeadElement\":false,\"HTMLHeadingElement\":false,\"HTMLHRElement\":false,\"HTMLHtmlElement\":false,\"HTMLIFrameElement\":false,\"HTMLImageElement\":false,\"HTMLInputElement\":false,\"HTMLLabelElement\":false,\"HTMLLegendElement\":false,\"HTMLLIElement\":false,\"HTMLLinkElement\":false,\"HTMLMapElement\":false,\"HTMLMarqueeElement\":false,\"HTMLMediaElement\":false,\"HTMLMenuElement\":false,\"HTMLMetaElement\":false,\"HTMLMeterElement\":false,\"HTMLModElement\":false,\"HTMLObjectElement\":false,\"HTMLOListElement\":false,\"HTMLOptGroupElement\":false,\"HTMLOptionElement\":false,\"HTMLOptionsCollection\":false,\"HTMLOutputElement\":false,\"HTMLParagraphElement\":false,\"HTMLParamElement\":false,\"HTMLPictureElement\":false,\"HTMLPreElement\":false,\"HTMLProgressElement\":false,\"HTMLQuoteElement\":false,\"HTMLScriptElement\":false,\"HTMLSelectElement\":false,\"HTMLShadowElement\":false,\"HTMLSlotElement\":false,\"HTMLSourceElement\":false,\"HTMLSpanElement\":false,\"HTMLStyleElement\":false,\"HTMLTableCaptionElement\":false,\"HTMLTableCellElement\":false,\"HTMLTableColElement\":false,\"HTMLTableElement\":false,\"HTMLTableRowElement\":false,\"HTMLTableSectionElement\":false,\"HTMLTemplateElement\":false,\"HTMLTextAreaElement\":false,\"HTMLTimeElement\":false,\"HTMLTitleElement\":false,\"HTMLTrackElement\":false,\"HTMLUListElement\":false,\"HTMLUnknownElement\":false,\"HTMLVideoElement\":false,\"IDBCursor\":false,\"IDBCursorWithValue\":false,\"IDBDatabase\":false,\"IDBFactory\":false,\"IDBIndex\":false,\"IDBKeyRange\":false,\"IDBObjectStore\":false,\"IDBOpenDBRequest\":false,\"IDBRequest\":false,\"IDBTransaction\":false,\"IDBVersionChangeEvent\":false,\"IdleDeadline\":false,\"IIRFilterNode\":false,\"Image\":false,\"ImageBitmap\":false,\"ImageBitmapRenderingContext\":false,\"ImageCapture\":false,\"ImageData\":false,\"indexedDB\":false,\"innerHeight\":false,\"innerWidth\":false,\"InputEvent\":false,\"IntersectionObserver\":false,\"IntersectionObserverEntry\":false,\"Intl\":false,\"isSecureContext\":false,\"KeyboardEvent\":false,\"KeyframeEffect\":false,\"KeyframeEffectReadOnly\":false,\"length\":false,\"localStorage\":false,\"location\":true,\"Location\":false,\"locationbar\":false,\"matchMedia\":false,\"MediaDeviceInfo\":false,\"MediaDevices\":false,\"MediaElementAudioSourceNode\":false,\"MediaEncryptedEvent\":false,\"MediaError\":false,\"MediaKeyMessageEvent\":false,\"MediaKeySession\":false,\"MediaKeyStatusMap\":false,\"MediaKeySystemAccess\":false,\"MediaList\":false,\"MediaMetadata\":false,\"MediaQueryList\":false,\"MediaQueryListEvent\":false,\"MediaRecorder\":false,\"MediaSettingsRange\":false,\"MediaSource\":false,\"MediaStream\":false,\"MediaStreamAudioDestinationNode\":false,\"MediaStreamAudioSourceNode\":false,\"MediaStreamConstraints\":false,\"MediaStreamEvent\":false,\"MediaStreamTrack\":false,\"MediaStreamTrackEvent\":false,\"menubar\":false,\"MessageChannel\":false,\"MessageEvent\":false,\"MessagePort\":false,\"MIDIAccess\":false,\"MIDIConnectionEvent\":false,\"MIDIInput\":false,\"MIDIInputMap\":false,\"MIDIMessageEvent\":false,\"MIDIOutput\":false,\"MIDIOutputMap\":false,\"MIDIPort\":false,\"MimeType\":false,\"MimeTypeArray\":false,\"MouseEvent\":false,\"moveBy\":false,\"moveTo\":false,\"MutationEvent\":false,\"MutationObserver\":false,\"MutationRecord\":false,\"name\":false,\"NamedNodeMap\":false,\"NavigationPreloadManager\":false,\"navigator\":false,\"Navigator\":false,\"NavigatorUAData\":false,\"NetworkInformation\":false,\"Node\":false,\"NodeFilter\":false,\"NodeIterator\":false,\"NodeList\":false,\"Notification\":false,\"OfflineAudioCompletionEvent\":false,\"OfflineAudioContext\":false,\"offscreenBuffering\":false,\"OffscreenCanvas\":true,\"OffscreenCanvasRenderingContext2D\":false,\"onabort\":true,\"onafterprint\":true,\"onanimationend\":true,\"onanimationiteration\":true,\"onanimationstart\":true,\"onappinstalled\":true,\"onauxclick\":true,\"onbeforeinstallprompt\":true,\"onbeforeprint\":true,\"onbeforeunload\":true,\"onblur\":true,\"oncancel\":true,\"oncanplay\":true,\"oncanplaythrough\":true,\"onchange\":true,\"onclick\":true,\"onclose\":true,\"oncontextmenu\":true,\"oncuechange\":true,\"ondblclick\":true,\"ondevicemotion\":true,\"ondeviceorientation\":true,\"ondeviceorientationabsolute\":true,\"ondrag\":true,\"ondragend\":true,\"ondragenter\":true,\"ondragleave\":true,\"ondragover\":true,\"ondragstart\":true,\"ondrop\":true,\"ondurationchange\":true,\"onemptied\":true,\"onended\":true,\"onerror\":true,\"onfocus\":true,\"ongotpointercapture\":true,\"onhashchange\":true,\"oninput\":true,\"oninvalid\":true,\"onkeydown\":true,\"onkeypress\":true,\"onkeyup\":true,\"onlanguagechange\":true,\"onload\":true,\"onloadeddata\":true,\"onloadedmetadata\":true,\"onloadstart\":true,\"onlostpointercapture\":true,\"onmessage\":true,\"onmessageerror\":true,\"onmousedown\":true,\"onmouseenter\":true,\"onmouseleave\":true,\"onmousemove\":true,\"onmouseout\":true,\"onmouseover\":true,\"onmouseup\":true,\"onmousewheel\":true,\"onoffline\":true,\"ononline\":true,\"onpagehide\":true,\"onpageshow\":true,\"onpause\":true,\"onplay\":true,\"onplaying\":true,\"onpointercancel\":true,\"onpointerdown\":true,\"onpointerenter\":true,\"onpointerleave\":true,\"onpointermove\":true,\"onpointerout\":true,\"onpointerover\":true,\"onpointerup\":true,\"onpopstate\":true,\"onprogress\":true,\"onratechange\":true,\"onrejectionhandled\":true,\"onreset\":true,\"onresize\":true,\"onscroll\":true,\"onsearch\":true,\"onseeked\":true,\"onseeking\":true,\"onselect\":true,\"onstalled\":true,\"onstorage\":true,\"onsubmit\":true,\"onsuspend\":true,\"ontimeupdate\":true,\"ontoggle\":true,\"ontransitionend\":true,\"onunhandledrejection\":true,\"onunload\":true,\"onvolumechange\":true,\"onwaiting\":true,\"onwheel\":true,\"open\":false,\"openDatabase\":false,\"opener\":false,\"Option\":false,\"origin\":false,\"OscillatorNode\":false,\"outerHeight\":false,\"outerWidth\":false,\"OverconstrainedError\":false,\"PageTransitionEvent\":false,\"pageXOffset\":false,\"pageYOffset\":false,\"PannerNode\":false,\"parent\":false,\"Path2D\":false,\"PaymentAddress\":false,\"PaymentRequest\":false,\"PaymentRequestUpdateEvent\":false,\"PaymentResponse\":false,\"performance\":false,\"Performance\":false,\"PerformanceEntry\":false,\"PerformanceLongTaskTiming\":false,\"PerformanceMark\":false,\"PerformanceMeasure\":false,\"PerformanceNavigation\":false,\"PerformanceNavigationTiming\":false,\"PerformanceObserver\":false,\"PerformanceObserverEntryList\":false,\"PerformancePaintTiming\":false,\"PerformanceResourceTiming\":false,\"PerformanceTiming\":false,\"PeriodicWave\":false,\"Permissions\":false,\"PermissionStatus\":false,\"personalbar\":false,\"PhotoCapabilities\":false,\"Plugin\":false,\"PluginArray\":false,\"PointerEvent\":false,\"PopStateEvent\":false,\"postMessage\":false,\"Presentation\":false,\"PresentationAvailability\":false,\"PresentationConnection\":false,\"PresentationConnectionAvailableEvent\":false,\"PresentationConnectionCloseEvent\":false,\"PresentationConnectionList\":false,\"PresentationReceiver\":false,\"PresentationRequest\":false,\"print\":false,\"ProcessingInstruction\":false,\"ProgressEvent\":false,\"PromiseRejectionEvent\":false,\"prompt\":false,\"PushManager\":false,\"PushSubscription\":false,\"PushSubscriptionOptions\":false,\"queueMicrotask\":false,\"RadioNodeList\":false,\"Range\":false,\"ReadableByteStreamController\":false,\"ReadableStream\":false,\"ReadableStreamBYOBReader\":false,\"ReadableStreamBYOBRequest\":false,\"ReadableStreamDefaultController\":false,\"ReadableStreamDefaultReader\":false,\"registerProcessor\":false,\"RemotePlayback\":false,\"removeEventListener\":false,\"reportError\":false,\"Request\":false,\"requestAnimationFrame\":false,\"requestIdleCallback\":false,\"resizeBy\":false,\"ResizeObserver\":false,\"ResizeObserverEntry\":false,\"resizeTo\":false,\"Response\":false,\"RTCCertificate\":false,\"RTCDataChannel\":false,\"RTCDataChannelEvent\":false,\"RTCDtlsTransport\":false,\"RTCIceCandidate\":false,\"RTCIceGatherer\":false,\"RTCIceTransport\":false,\"RTCPeerConnection\":false,\"RTCPeerConnectionIceEvent\":false,\"RTCRtpContributingSource\":false,\"RTCRtpReceiver\":false,\"RTCRtpSender\":false,\"RTCSctpTransport\":false,\"RTCSessionDescription\":false,\"RTCStatsReport\":false,\"RTCTrackEvent\":false,\"screen\":false,\"Screen\":false,\"screenLeft\":false,\"ScreenOrientation\":false,\"screenTop\":false,\"screenX\":false,\"screenY\":false,\"ScriptProcessorNode\":false,\"scroll\":false,\"scrollbars\":false,\"scrollBy\":false,\"scrollTo\":false,\"scrollX\":false,\"scrollY\":false,\"SecurityPolicyViolationEvent\":false,\"Selection\":false,\"self\":false,\"ServiceWorker\":false,\"ServiceWorkerContainer\":false,\"ServiceWorkerRegistration\":false,\"sessionStorage\":false,\"setInterval\":false,\"setTimeout\":false,\"ShadowRoot\":false,\"SharedWorker\":false,\"SourceBuffer\":false,\"SourceBufferList\":false,\"speechSynthesis\":false,\"SpeechSynthesisEvent\":false,\"SpeechSynthesisUtterance\":false,\"StaticRange\":false,\"status\":false,\"statusbar\":false,\"StereoPannerNode\":false,\"stop\":false,\"Storage\":false,\"StorageEvent\":false,\"StorageManager\":false,\"structuredClone\":false,\"styleMedia\":false,\"StyleSheet\":false,\"StyleSheetList\":false,\"SubmitEvent\":false,\"SubtleCrypto\":false,\"SVGAElement\":false,\"SVGAngle\":false,\"SVGAnimatedAngle\":false,\"SVGAnimatedBoolean\":false,\"SVGAnimatedEnumeration\":false,\"SVGAnimatedInteger\":false,\"SVGAnimatedLength\":false,\"SVGAnimatedLengthList\":false,\"SVGAnimatedNumber\":false,\"SVGAnimatedNumberList\":false,\"SVGAnimatedPreserveAspectRatio\":false,\"SVGAnimatedRect\":false,\"SVGAnimatedString\":false,\"SVGAnimatedTransformList\":false,\"SVGAnimateElement\":false,\"SVGAnimateMotionElement\":false,\"SVGAnimateTransformElement\":false,\"SVGAnimationElement\":false,\"SVGCircleElement\":false,\"SVGClipPathElement\":false,\"SVGComponentTransferFunctionElement\":false,\"SVGDefsElement\":false,\"SVGDescElement\":false,\"SVGDiscardElement\":false,\"SVGElement\":false,\"SVGEllipseElement\":false,\"SVGFEBlendElement\":false,\"SVGFEColorMatrixElement\":false,\"SVGFEComponentTransferElement\":false,\"SVGFECompositeElement\":false,\"SVGFEConvolveMatrixElement\":false,\"SVGFEDiffuseLightingElement\":false,\"SVGFEDisplacementMapElement\":false,\"SVGFEDistantLightElement\":false,\"SVGFEDropShadowElement\":false,\"SVGFEFloodElement\":false,\"SVGFEFuncAElement\":false,\"SVGFEFuncBElement\":false,\"SVGFEFuncGElement\":false,\"SVGFEFuncRElement\":false,\"SVGFEGaussianBlurElement\":false,\"SVGFEImageElement\":false,\"SVGFEMergeElement\":false,\"SVGFEMergeNodeElement\":false,\"SVGFEMorphologyElement\":false,\"SVGFEOffsetElement\":false,\"SVGFEPointLightElement\":false,\"SVGFESpecularLightingElement\":false,\"SVGFESpotLightElement\":false,\"SVGFETileElement\":false,\"SVGFETurbulenceElement\":false,\"SVGFilterElement\":false,\"SVGForeignObjectElement\":false,\"SVGGElement\":false,\"SVGGeometryElement\":false,\"SVGGradientElement\":false,\"SVGGraphicsElement\":false,\"SVGImageElement\":false,\"SVGLength\":false,\"SVGLengthList\":false,\"SVGLinearGradientElement\":false,\"SVGLineElement\":false,\"SVGMarkerElement\":false,\"SVGMaskElement\":false,\"SVGMatrix\":false,\"SVGMetadataElement\":false,\"SVGMPathElement\":false,\"SVGNumber\":false,\"SVGNumberList\":false,\"SVGPathElement\":false,\"SVGPatternElement\":false,\"SVGPoint\":false,\"SVGPointList\":false,\"SVGPolygonElement\":false,\"SVGPolylineElement\":false,\"SVGPreserveAspectRatio\":false,\"SVGRadialGradientElement\":false,\"SVGRect\":false,\"SVGRectElement\":false,\"SVGScriptElement\":false,\"SVGSetElement\":false,\"SVGStopElement\":false,\"SVGStringList\":false,\"SVGStyleElement\":false,\"SVGSVGElement\":false,\"SVGSwitchElement\":false,\"SVGSymbolElement\":false,\"SVGTextContentElement\":false,\"SVGTextElement\":false,\"SVGTextPathElement\":false,\"SVGTextPositioningElement\":false,\"SVGTitleElement\":false,\"SVGTransform\":false,\"SVGTransformList\":false,\"SVGTSpanElement\":false,\"SVGUnitTypes\":false,\"SVGUseElement\":false,\"SVGViewElement\":false,\"TaskAttributionTiming\":false,\"Text\":false,\"TextDecoder\":false,\"TextDecoderStream\":false,\"TextEncoder\":false,\"TextEncoderStream\":false,\"TextEvent\":false,\"TextMetrics\":false,\"TextTrack\":false,\"TextTrackCue\":false,\"TextTrackCueList\":false,\"TextTrackList\":false,\"TimeRanges\":false,\"ToggleEvent\":false,\"toolbar\":false,\"top\":false,\"Touch\":false,\"TouchEvent\":false,\"TouchList\":false,\"TrackEvent\":false,\"TransformStream\":false,\"TransformStreamDefaultController\":false,\"TransitionEvent\":false,\"TreeWalker\":false,\"UIEvent\":false,\"URL\":false,\"URLSearchParams\":false,\"ValidityState\":false,\"visualViewport\":false,\"VisualViewport\":false,\"VTTCue\":false,\"WaveShaperNode\":false,\"WebAssembly\":false,\"WebGL2RenderingContext\":false,\"WebGLActiveInfo\":false,\"WebGLBuffer\":false,\"WebGLContextEvent\":false,\"WebGLFramebuffer\":false,\"WebGLProgram\":false,\"WebGLQuery\":false,\"WebGLRenderbuffer\":false,\"WebGLRenderingContext\":false,\"WebGLSampler\":false,\"WebGLShader\":false,\"WebGLShaderPrecisionFormat\":false,\"WebGLSync\":false,\"WebGLTexture\":false,\"WebGLTransformFeedback\":false,\"WebGLUniformLocation\":false,\"WebGLVertexArrayObject\":false,\"WebSocket\":false,\"WheelEvent\":false,\"window\":false,\"Window\":false,\"Worker\":false,\"WritableStream\":false,\"WritableStreamDefaultController\":false,\"WritableStreamDefaultWriter\":false,\"XMLDocument\":false,\"XMLHttpRequest\":false,\"XMLHttpRequestEventTarget\":false,\"XMLHttpRequestUpload\":false,\"XMLSerializer\":false,\"XPathEvaluator\":false,\"XPathExpression\":false,\"XPathResult\":false,\"XRAnchor\":false,\"XRBoundedReferenceSpace\":false,\"XRCPUDepthInformation\":false,\"XRDepthInformation\":false,\"XRFrame\":false,\"XRInputSource\":false,\"XRInputSourceArray\":false,\"XRInputSourceEvent\":false,\"XRInputSourcesChangeEvent\":false,\"XRPose\":false,\"XRReferenceSpace\":false,\"XRReferenceSpaceEvent\":false,\"XRRenderState\":false,\"XRRigidTransform\":false,\"XRSession\":false,\"XRSessionEvent\":false,\"XRSpace\":false,\"XRSystem\":false,\"XRView\":false,\"XRViewerPose\":false,\"XRViewport\":false,\"XRWebGLBinding\":false,\"XRWebGLDepthInformation\":false,\"XRWebGLLayer\":false,\"XSLTProcessor\":false}");
|
|
3738
|
+
worker = {
|
|
3739
|
+
"addEventListener": false,
|
|
3740
|
+
"applicationCache": false,
|
|
3741
|
+
"atob": false,
|
|
3742
|
+
"Blob": false,
|
|
3743
|
+
"BroadcastChannel": false,
|
|
3744
|
+
"btoa": false,
|
|
3745
|
+
"ByteLengthQueuingStrategy": false,
|
|
3746
|
+
"Cache": false,
|
|
3747
|
+
"caches": false,
|
|
3748
|
+
"clearInterval": false,
|
|
3749
|
+
"clearTimeout": false,
|
|
3750
|
+
"close": true,
|
|
3751
|
+
"CompressionStream": false,
|
|
3752
|
+
"console": false,
|
|
3753
|
+
"CountQueuingStrategy": false,
|
|
3754
|
+
"crypto": false,
|
|
3755
|
+
"Crypto": false,
|
|
3756
|
+
"CryptoKey": false,
|
|
3757
|
+
"CustomEvent": false,
|
|
3758
|
+
"DecompressionStream": false,
|
|
3759
|
+
"ErrorEvent": false,
|
|
3760
|
+
"Event": false,
|
|
3761
|
+
"fetch": false,
|
|
3762
|
+
"File": false,
|
|
3763
|
+
"FileReaderSync": false,
|
|
3764
|
+
"FormData": false,
|
|
3765
|
+
"Headers": false,
|
|
3766
|
+
"IDBCursor": false,
|
|
3767
|
+
"IDBCursorWithValue": false,
|
|
3768
|
+
"IDBDatabase": false,
|
|
3769
|
+
"IDBFactory": false,
|
|
3770
|
+
"IDBIndex": false,
|
|
3771
|
+
"IDBKeyRange": false,
|
|
3772
|
+
"IDBObjectStore": false,
|
|
3773
|
+
"IDBOpenDBRequest": false,
|
|
3774
|
+
"IDBRequest": false,
|
|
3775
|
+
"IDBTransaction": false,
|
|
3776
|
+
"IDBVersionChangeEvent": false,
|
|
3777
|
+
"ImageData": false,
|
|
3778
|
+
"importScripts": true,
|
|
3779
|
+
"indexedDB": false,
|
|
3780
|
+
"location": false,
|
|
3781
|
+
"MessageChannel": false,
|
|
3782
|
+
"MessageEvent": false,
|
|
3783
|
+
"MessagePort": false,
|
|
3784
|
+
"name": false,
|
|
3785
|
+
"navigator": false,
|
|
3786
|
+
"Notification": false,
|
|
3787
|
+
"onclose": true,
|
|
3788
|
+
"onconnect": true,
|
|
3789
|
+
"onerror": true,
|
|
3790
|
+
"onlanguagechange": true,
|
|
3791
|
+
"onmessage": true,
|
|
3792
|
+
"onoffline": true,
|
|
3793
|
+
"ononline": true,
|
|
3794
|
+
"onrejectionhandled": true,
|
|
3795
|
+
"onunhandledrejection": true,
|
|
3796
|
+
"performance": false,
|
|
3797
|
+
"Performance": false,
|
|
3798
|
+
"PerformanceEntry": false,
|
|
3799
|
+
"PerformanceMark": false,
|
|
3800
|
+
"PerformanceMeasure": false,
|
|
3801
|
+
"PerformanceNavigation": false,
|
|
3802
|
+
"PerformanceObserver": false,
|
|
3803
|
+
"PerformanceObserverEntryList": false,
|
|
3804
|
+
"PerformanceResourceTiming": false,
|
|
3805
|
+
"PerformanceTiming": false,
|
|
3806
|
+
"postMessage": true,
|
|
3807
|
+
"Promise": false,
|
|
3808
|
+
"queueMicrotask": false,
|
|
3809
|
+
"ReadableByteStreamController": false,
|
|
3810
|
+
"ReadableStream": false,
|
|
3811
|
+
"ReadableStreamBYOBReader": false,
|
|
3812
|
+
"ReadableStreamBYOBRequest": false,
|
|
3813
|
+
"ReadableStreamDefaultController": false,
|
|
3814
|
+
"ReadableStreamDefaultReader": false,
|
|
3815
|
+
"removeEventListener": false,
|
|
3816
|
+
"reportError": false,
|
|
3817
|
+
"Request": false,
|
|
3818
|
+
"Response": false,
|
|
3819
|
+
"self": true,
|
|
3820
|
+
"ServiceWorkerRegistration": false,
|
|
3821
|
+
"setInterval": false,
|
|
3822
|
+
"setTimeout": false,
|
|
3823
|
+
"SubtleCrypto": false,
|
|
3824
|
+
"TextDecoder": false,
|
|
3825
|
+
"TextDecoderStream": false,
|
|
3826
|
+
"TextEncoder": false,
|
|
3827
|
+
"TextEncoderStream": false,
|
|
3828
|
+
"TransformStream": false,
|
|
3829
|
+
"TransformStreamDefaultController": false,
|
|
3830
|
+
"URL": false,
|
|
3831
|
+
"URLSearchParams": false,
|
|
3832
|
+
"WebAssembly": false,
|
|
3833
|
+
"WebSocket": false,
|
|
3834
|
+
"Worker": false,
|
|
3835
|
+
"WorkerGlobalScope": false,
|
|
3836
|
+
"WritableStream": false,
|
|
3837
|
+
"WritableStreamDefaultController": false,
|
|
3838
|
+
"WritableStreamDefaultWriter": false,
|
|
3839
|
+
"XMLHttpRequest": false
|
|
3840
|
+
};
|
|
3841
|
+
node = {
|
|
3842
|
+
"__dirname": false,
|
|
3843
|
+
"__filename": false,
|
|
3844
|
+
"AbortController": false,
|
|
3845
|
+
"AbortSignal": false,
|
|
3846
|
+
"atob": false,
|
|
3847
|
+
"Blob": false,
|
|
3848
|
+
"BroadcastChannel": false,
|
|
3849
|
+
"btoa": false,
|
|
3850
|
+
"Buffer": false,
|
|
3851
|
+
"ByteLengthQueuingStrategy": false,
|
|
3852
|
+
"clearImmediate": false,
|
|
3853
|
+
"clearInterval": false,
|
|
3854
|
+
"clearTimeout": false,
|
|
3855
|
+
"CompressionStream": false,
|
|
3856
|
+
"console": false,
|
|
3857
|
+
"CountQueuingStrategy": false,
|
|
3858
|
+
"crypto": false,
|
|
3859
|
+
"Crypto": false,
|
|
3860
|
+
"CryptoKey": false,
|
|
3861
|
+
"CustomEvent": false,
|
|
3862
|
+
"DecompressionStream": false,
|
|
3863
|
+
"DOMException": false,
|
|
3864
|
+
"Event": false,
|
|
3865
|
+
"EventTarget": false,
|
|
3866
|
+
"exports": true,
|
|
3867
|
+
"fetch": false,
|
|
3868
|
+
"File": false,
|
|
3869
|
+
"FormData": false,
|
|
3870
|
+
"global": false,
|
|
3871
|
+
"Headers": false,
|
|
3872
|
+
"Intl": false,
|
|
3873
|
+
"MessageChannel": false,
|
|
3874
|
+
"MessageEvent": false,
|
|
3875
|
+
"MessagePort": false,
|
|
3876
|
+
"module": false,
|
|
3877
|
+
"performance": false,
|
|
3878
|
+
"PerformanceEntry": false,
|
|
3879
|
+
"PerformanceMark": false,
|
|
3880
|
+
"PerformanceMeasure": false,
|
|
3881
|
+
"PerformanceObserver": false,
|
|
3882
|
+
"PerformanceObserverEntryList": false,
|
|
3883
|
+
"PerformanceResourceTiming": false,
|
|
3884
|
+
"process": false,
|
|
3885
|
+
"queueMicrotask": false,
|
|
3886
|
+
"ReadableByteStreamController": false,
|
|
3887
|
+
"ReadableStream": false,
|
|
3888
|
+
"ReadableStreamBYOBReader": false,
|
|
3889
|
+
"ReadableStreamBYOBRequest": false,
|
|
3890
|
+
"ReadableStreamDefaultController": false,
|
|
3891
|
+
"ReadableStreamDefaultReader": false,
|
|
3892
|
+
"Request": false,
|
|
3893
|
+
"require": false,
|
|
3894
|
+
"Response": false,
|
|
3895
|
+
"setImmediate": false,
|
|
3896
|
+
"setInterval": false,
|
|
3897
|
+
"setTimeout": false,
|
|
3898
|
+
"structuredClone": false,
|
|
3899
|
+
"SubtleCrypto": false,
|
|
3900
|
+
"TextDecoder": false,
|
|
3901
|
+
"TextDecoderStream": false,
|
|
3902
|
+
"TextEncoder": false,
|
|
3903
|
+
"TextEncoderStream": false,
|
|
3904
|
+
"TransformStream": false,
|
|
3905
|
+
"TransformStreamDefaultController": false,
|
|
3906
|
+
"URL": false,
|
|
3907
|
+
"URLSearchParams": false,
|
|
3908
|
+
"WebAssembly": false,
|
|
3909
|
+
"WritableStream": false,
|
|
3910
|
+
"WritableStreamDefaultController": false,
|
|
3911
|
+
"WritableStreamDefaultWriter": false
|
|
3912
|
+
};
|
|
3913
|
+
nodeBuiltin = {
|
|
3914
|
+
"AbortController": false,
|
|
3915
|
+
"AbortSignal": false,
|
|
3916
|
+
"atob": false,
|
|
3917
|
+
"Blob": false,
|
|
3918
|
+
"BroadcastChannel": false,
|
|
3919
|
+
"btoa": false,
|
|
3920
|
+
"Buffer": false,
|
|
3921
|
+
"ByteLengthQueuingStrategy": false,
|
|
3922
|
+
"clearImmediate": false,
|
|
3923
|
+
"clearInterval": false,
|
|
3924
|
+
"clearTimeout": false,
|
|
3925
|
+
"CompressionStream": false,
|
|
3926
|
+
"console": false,
|
|
3927
|
+
"CountQueuingStrategy": false,
|
|
3928
|
+
"crypto": false,
|
|
3929
|
+
"Crypto": false,
|
|
3930
|
+
"CryptoKey": false,
|
|
3931
|
+
"CustomEvent": false,
|
|
3932
|
+
"DecompressionStream": false,
|
|
3933
|
+
"DOMException": false,
|
|
3934
|
+
"Event": false,
|
|
3935
|
+
"EventTarget": false,
|
|
3936
|
+
"fetch": false,
|
|
3937
|
+
"File": false,
|
|
3938
|
+
"FormData": false,
|
|
3939
|
+
"global": false,
|
|
3940
|
+
"Headers": false,
|
|
3941
|
+
"Intl": false,
|
|
3942
|
+
"MessageChannel": false,
|
|
3943
|
+
"MessageEvent": false,
|
|
3944
|
+
"MessagePort": false,
|
|
3945
|
+
"performance": false,
|
|
3946
|
+
"PerformanceEntry": false,
|
|
3947
|
+
"PerformanceMark": false,
|
|
3948
|
+
"PerformanceMeasure": false,
|
|
3949
|
+
"PerformanceObserver": false,
|
|
3950
|
+
"PerformanceObserverEntryList": false,
|
|
3951
|
+
"PerformanceResourceTiming": false,
|
|
3952
|
+
"process": false,
|
|
3953
|
+
"queueMicrotask": false,
|
|
3954
|
+
"ReadableByteStreamController": false,
|
|
3955
|
+
"ReadableStream": false,
|
|
3956
|
+
"ReadableStreamBYOBReader": false,
|
|
3957
|
+
"ReadableStreamBYOBRequest": false,
|
|
3958
|
+
"ReadableStreamDefaultController": false,
|
|
3959
|
+
"ReadableStreamDefaultReader": false,
|
|
3960
|
+
"Request": false,
|
|
3961
|
+
"Response": false,
|
|
3962
|
+
"setImmediate": false,
|
|
3963
|
+
"setInterval": false,
|
|
3964
|
+
"setTimeout": false,
|
|
3965
|
+
"structuredClone": false,
|
|
3966
|
+
"SubtleCrypto": false,
|
|
3967
|
+
"TextDecoder": false,
|
|
3968
|
+
"TextDecoderStream": false,
|
|
3969
|
+
"TextEncoder": false,
|
|
3970
|
+
"TextEncoderStream": false,
|
|
3971
|
+
"TransformStream": false,
|
|
3972
|
+
"TransformStreamDefaultController": false,
|
|
3973
|
+
"URL": false,
|
|
3974
|
+
"URLSearchParams": false,
|
|
3975
|
+
"WebAssembly": false,
|
|
3976
|
+
"WritableStream": false,
|
|
3977
|
+
"WritableStreamDefaultController": false,
|
|
3978
|
+
"WritableStreamDefaultWriter": false
|
|
3979
|
+
};
|
|
3980
|
+
commonjs = {
|
|
3981
|
+
"exports": true,
|
|
3982
|
+
"global": false,
|
|
3983
|
+
"module": false,
|
|
3984
|
+
"require": false
|
|
3985
|
+
};
|
|
3986
|
+
amd = {
|
|
3987
|
+
"define": false,
|
|
3988
|
+
"require": false
|
|
3989
|
+
};
|
|
3990
|
+
mocha = {
|
|
3991
|
+
"after": false,
|
|
3992
|
+
"afterEach": false,
|
|
3993
|
+
"before": false,
|
|
3994
|
+
"beforeEach": false,
|
|
3995
|
+
"context": false,
|
|
3996
|
+
"describe": false,
|
|
3997
|
+
"it": false,
|
|
3998
|
+
"mocha": false,
|
|
3999
|
+
"run": false,
|
|
4000
|
+
"setup": false,
|
|
4001
|
+
"specify": false,
|
|
4002
|
+
"suite": false,
|
|
4003
|
+
"suiteSetup": false,
|
|
4004
|
+
"suiteTeardown": false,
|
|
4005
|
+
"teardown": false,
|
|
4006
|
+
"test": false,
|
|
4007
|
+
"xcontext": false,
|
|
4008
|
+
"xdescribe": false,
|
|
4009
|
+
"xit": false,
|
|
4010
|
+
"xspecify": false
|
|
4011
|
+
};
|
|
4012
|
+
jasmine = {
|
|
4013
|
+
"afterAll": false,
|
|
4014
|
+
"afterEach": false,
|
|
4015
|
+
"beforeAll": false,
|
|
4016
|
+
"beforeEach": false,
|
|
4017
|
+
"describe": false,
|
|
4018
|
+
"expect": false,
|
|
4019
|
+
"expectAsync": false,
|
|
4020
|
+
"fail": false,
|
|
4021
|
+
"fdescribe": false,
|
|
4022
|
+
"fit": false,
|
|
4023
|
+
"it": false,
|
|
4024
|
+
"jasmine": false,
|
|
4025
|
+
"pending": false,
|
|
4026
|
+
"runs": false,
|
|
4027
|
+
"spyOn": false,
|
|
4028
|
+
"spyOnAllFunctions": false,
|
|
4029
|
+
"spyOnProperty": false,
|
|
4030
|
+
"waits": false,
|
|
4031
|
+
"waitsFor": false,
|
|
4032
|
+
"xdescribe": false,
|
|
4033
|
+
"xit": false
|
|
4034
|
+
};
|
|
4035
|
+
jest = {
|
|
4036
|
+
"afterAll": false,
|
|
4037
|
+
"afterEach": false,
|
|
4038
|
+
"beforeAll": false,
|
|
4039
|
+
"beforeEach": false,
|
|
4040
|
+
"describe": false,
|
|
4041
|
+
"expect": false,
|
|
4042
|
+
"fdescribe": false,
|
|
4043
|
+
"fit": false,
|
|
4044
|
+
"it": false,
|
|
4045
|
+
"jest": false,
|
|
4046
|
+
"pit": false,
|
|
4047
|
+
"require": false,
|
|
4048
|
+
"test": false,
|
|
4049
|
+
"xdescribe": false,
|
|
4050
|
+
"xit": false,
|
|
4051
|
+
"xtest": false
|
|
4052
|
+
};
|
|
4053
|
+
qunit = {
|
|
4054
|
+
"asyncTest": false,
|
|
4055
|
+
"deepEqual": false,
|
|
4056
|
+
"equal": false,
|
|
4057
|
+
"expect": false,
|
|
4058
|
+
"module": false,
|
|
4059
|
+
"notDeepEqual": false,
|
|
4060
|
+
"notEqual": false,
|
|
4061
|
+
"notOk": false,
|
|
4062
|
+
"notPropEqual": false,
|
|
4063
|
+
"notStrictEqual": false,
|
|
4064
|
+
"ok": false,
|
|
4065
|
+
"propEqual": false,
|
|
4066
|
+
"QUnit": false,
|
|
4067
|
+
"raises": false,
|
|
4068
|
+
"start": false,
|
|
4069
|
+
"stop": false,
|
|
4070
|
+
"strictEqual": false,
|
|
4071
|
+
"test": false,
|
|
4072
|
+
"throws": false
|
|
4073
|
+
};
|
|
4074
|
+
phantomjs = {
|
|
4075
|
+
"console": true,
|
|
4076
|
+
"exports": true,
|
|
4077
|
+
"phantom": true,
|
|
4078
|
+
"require": true,
|
|
4079
|
+
"WebPage": true
|
|
4080
|
+
};
|
|
4081
|
+
couch = {
|
|
4082
|
+
"emit": false,
|
|
4083
|
+
"exports": false,
|
|
4084
|
+
"getRow": false,
|
|
4085
|
+
"log": false,
|
|
4086
|
+
"module": false,
|
|
4087
|
+
"provides": false,
|
|
4088
|
+
"require": false,
|
|
4089
|
+
"respond": false,
|
|
4090
|
+
"send": false,
|
|
4091
|
+
"start": false,
|
|
4092
|
+
"sum": false
|
|
4093
|
+
};
|
|
4094
|
+
rhino = {
|
|
4095
|
+
"defineClass": false,
|
|
4096
|
+
"deserialize": false,
|
|
4097
|
+
"gc": false,
|
|
4098
|
+
"help": false,
|
|
4099
|
+
"importClass": false,
|
|
4100
|
+
"importPackage": false,
|
|
4101
|
+
"java": false,
|
|
4102
|
+
"load": false,
|
|
4103
|
+
"loadClass": false,
|
|
4104
|
+
"Packages": false,
|
|
4105
|
+
"print": false,
|
|
4106
|
+
"quit": false,
|
|
4107
|
+
"readFile": false,
|
|
4108
|
+
"readUrl": false,
|
|
4109
|
+
"runCommand": false,
|
|
4110
|
+
"seal": false,
|
|
4111
|
+
"serialize": false,
|
|
4112
|
+
"spawn": false,
|
|
4113
|
+
"sync": false,
|
|
4114
|
+
"toint32": false,
|
|
4115
|
+
"version": false
|
|
4116
|
+
};
|
|
4117
|
+
nashorn = {
|
|
4118
|
+
"__DIR__": false,
|
|
4119
|
+
"__FILE__": false,
|
|
4120
|
+
"__LINE__": false,
|
|
4121
|
+
"com": false,
|
|
4122
|
+
"edu": false,
|
|
4123
|
+
"exit": false,
|
|
4124
|
+
"java": false,
|
|
4125
|
+
"Java": false,
|
|
4126
|
+
"javafx": false,
|
|
4127
|
+
"JavaImporter": false,
|
|
4128
|
+
"javax": false,
|
|
4129
|
+
"JSAdapter": false,
|
|
4130
|
+
"load": false,
|
|
4131
|
+
"loadWithNewGlobal": false,
|
|
4132
|
+
"org": false,
|
|
4133
|
+
"Packages": false,
|
|
4134
|
+
"print": false,
|
|
4135
|
+
"quit": false
|
|
4136
|
+
};
|
|
4137
|
+
wsh = {
|
|
4138
|
+
"ActiveXObject": false,
|
|
4139
|
+
"CollectGarbage": false,
|
|
4140
|
+
"Debug": false,
|
|
4141
|
+
"Enumerator": false,
|
|
4142
|
+
"GetObject": false,
|
|
4143
|
+
"RuntimeObject": false,
|
|
4144
|
+
"ScriptEngine": false,
|
|
4145
|
+
"ScriptEngineBuildVersion": false,
|
|
4146
|
+
"ScriptEngineMajorVersion": false,
|
|
4147
|
+
"ScriptEngineMinorVersion": false,
|
|
4148
|
+
"VBArray": false,
|
|
4149
|
+
"WScript": false,
|
|
4150
|
+
"WSH": false
|
|
4151
|
+
};
|
|
4152
|
+
jquery = {
|
|
4153
|
+
"$": false,
|
|
4154
|
+
"jQuery": false
|
|
4155
|
+
};
|
|
4156
|
+
yui = {
|
|
4157
|
+
"YAHOO": false,
|
|
4158
|
+
"YAHOO_config": false,
|
|
4159
|
+
"YUI": false,
|
|
4160
|
+
"YUI_config": false
|
|
4161
|
+
};
|
|
4162
|
+
shelljs = {
|
|
4163
|
+
"cat": false,
|
|
4164
|
+
"cd": false,
|
|
4165
|
+
"chmod": false,
|
|
4166
|
+
"config": false,
|
|
4167
|
+
"cp": false,
|
|
4168
|
+
"dirs": false,
|
|
4169
|
+
"echo": false,
|
|
4170
|
+
"env": false,
|
|
4171
|
+
"error": false,
|
|
4172
|
+
"exec": false,
|
|
4173
|
+
"exit": false,
|
|
4174
|
+
"find": false,
|
|
4175
|
+
"grep": false,
|
|
4176
|
+
"ln": false,
|
|
4177
|
+
"ls": false,
|
|
4178
|
+
"mkdir": false,
|
|
4179
|
+
"mv": false,
|
|
4180
|
+
"popd": false,
|
|
4181
|
+
"pushd": false,
|
|
4182
|
+
"pwd": false,
|
|
4183
|
+
"rm": false,
|
|
4184
|
+
"sed": false,
|
|
4185
|
+
"set": false,
|
|
4186
|
+
"target": false,
|
|
4187
|
+
"tempdir": false,
|
|
4188
|
+
"test": false,
|
|
4189
|
+
"touch": false,
|
|
4190
|
+
"which": false
|
|
4191
|
+
};
|
|
4192
|
+
prototypejs = {
|
|
4193
|
+
"$": false,
|
|
4194
|
+
"$$": false,
|
|
4195
|
+
"$A": false,
|
|
4196
|
+
"$break": false,
|
|
4197
|
+
"$continue": false,
|
|
4198
|
+
"$F": false,
|
|
4199
|
+
"$H": false,
|
|
4200
|
+
"$R": false,
|
|
4201
|
+
"$w": false,
|
|
4202
|
+
"Abstract": false,
|
|
4203
|
+
"Ajax": false,
|
|
4204
|
+
"Autocompleter": false,
|
|
4205
|
+
"Builder": false,
|
|
4206
|
+
"Class": false,
|
|
4207
|
+
"Control": false,
|
|
4208
|
+
"Draggable": false,
|
|
4209
|
+
"Draggables": false,
|
|
4210
|
+
"Droppables": false,
|
|
4211
|
+
"Effect": false,
|
|
4212
|
+
"Element": false,
|
|
4213
|
+
"Enumerable": false,
|
|
4214
|
+
"Event": false,
|
|
4215
|
+
"Field": false,
|
|
4216
|
+
"Form": false,
|
|
4217
|
+
"Hash": false,
|
|
4218
|
+
"Insertion": false,
|
|
4219
|
+
"ObjectRange": false,
|
|
4220
|
+
"PeriodicalExecuter": false,
|
|
4221
|
+
"Position": false,
|
|
4222
|
+
"Prototype": false,
|
|
4223
|
+
"Scriptaculous": false,
|
|
4224
|
+
"Selector": false,
|
|
4225
|
+
"Sortable": false,
|
|
4226
|
+
"SortableObserver": false,
|
|
4227
|
+
"Sound": false,
|
|
4228
|
+
"Template": false,
|
|
4229
|
+
"Toggle": false,
|
|
4230
|
+
"Try": false
|
|
4231
|
+
};
|
|
4232
|
+
meteor = {
|
|
4233
|
+
"$": false,
|
|
4234
|
+
"Accounts": false,
|
|
4235
|
+
"AccountsClient": false,
|
|
4236
|
+
"AccountsCommon": false,
|
|
4237
|
+
"AccountsServer": false,
|
|
4238
|
+
"App": false,
|
|
4239
|
+
"Assets": false,
|
|
4240
|
+
"Blaze": false,
|
|
4241
|
+
"check": false,
|
|
4242
|
+
"Cordova": false,
|
|
4243
|
+
"DDP": false,
|
|
4244
|
+
"DDPRateLimiter": false,
|
|
4245
|
+
"DDPServer": false,
|
|
4246
|
+
"Deps": false,
|
|
4247
|
+
"EJSON": false,
|
|
4248
|
+
"Email": false,
|
|
4249
|
+
"HTTP": false,
|
|
4250
|
+
"Log": false,
|
|
4251
|
+
"Match": false,
|
|
4252
|
+
"Meteor": false,
|
|
4253
|
+
"Mongo": false,
|
|
4254
|
+
"MongoInternals": false,
|
|
4255
|
+
"Npm": false,
|
|
4256
|
+
"Package": false,
|
|
4257
|
+
"Plugin": false,
|
|
4258
|
+
"process": false,
|
|
4259
|
+
"Random": false,
|
|
4260
|
+
"ReactiveDict": false,
|
|
4261
|
+
"ReactiveVar": false,
|
|
4262
|
+
"Router": false,
|
|
4263
|
+
"ServiceConfiguration": false,
|
|
4264
|
+
"Session": false,
|
|
4265
|
+
"share": false,
|
|
4266
|
+
"Spacebars": false,
|
|
4267
|
+
"Template": false,
|
|
4268
|
+
"Tinytest": false,
|
|
4269
|
+
"Tracker": false,
|
|
4270
|
+
"UI": false,
|
|
4271
|
+
"Utils": false,
|
|
4272
|
+
"WebApp": false,
|
|
4273
|
+
"WebAppInternals": false
|
|
4274
|
+
};
|
|
4275
|
+
mongo = {
|
|
4276
|
+
"_isWindows": false,
|
|
4277
|
+
"_rand": false,
|
|
4278
|
+
"BulkWriteResult": false,
|
|
4279
|
+
"cat": false,
|
|
4280
|
+
"cd": false,
|
|
4281
|
+
"connect": false,
|
|
4282
|
+
"db": false,
|
|
4283
|
+
"getHostName": false,
|
|
4284
|
+
"getMemInfo": false,
|
|
4285
|
+
"hostname": false,
|
|
4286
|
+
"ISODate": false,
|
|
4287
|
+
"listFiles": false,
|
|
4288
|
+
"load": false,
|
|
4289
|
+
"ls": false,
|
|
4290
|
+
"md5sumFile": false,
|
|
4291
|
+
"mkdir": false,
|
|
4292
|
+
"Mongo": false,
|
|
4293
|
+
"NumberInt": false,
|
|
4294
|
+
"NumberLong": false,
|
|
4295
|
+
"ObjectId": false,
|
|
4296
|
+
"PlanCache": false,
|
|
4297
|
+
"print": false,
|
|
4298
|
+
"printjson": false,
|
|
4299
|
+
"pwd": false,
|
|
4300
|
+
"quit": false,
|
|
4301
|
+
"removeFile": false,
|
|
4302
|
+
"rs": false,
|
|
4303
|
+
"sh": false,
|
|
4304
|
+
"UUID": false,
|
|
4305
|
+
"version": false,
|
|
4306
|
+
"WriteResult": false
|
|
4307
|
+
};
|
|
4308
|
+
applescript = {
|
|
4309
|
+
"$": false,
|
|
4310
|
+
"Application": false,
|
|
4311
|
+
"Automation": false,
|
|
4312
|
+
"console": false,
|
|
4313
|
+
"delay": false,
|
|
4314
|
+
"Library": false,
|
|
4315
|
+
"ObjC": false,
|
|
4316
|
+
"ObjectSpecifier": false,
|
|
4317
|
+
"Path": false,
|
|
4318
|
+
"Progress": false,
|
|
4319
|
+
"Ref": false
|
|
4320
|
+
};
|
|
4321
|
+
serviceworker = {
|
|
4322
|
+
"addEventListener": false,
|
|
4323
|
+
"applicationCache": false,
|
|
4324
|
+
"atob": false,
|
|
4325
|
+
"Blob": false,
|
|
4326
|
+
"BroadcastChannel": false,
|
|
4327
|
+
"btoa": false,
|
|
4328
|
+
"ByteLengthQueuingStrategy": false,
|
|
4329
|
+
"Cache": false,
|
|
4330
|
+
"caches": false,
|
|
4331
|
+
"CacheStorage": false,
|
|
4332
|
+
"clearInterval": false,
|
|
4333
|
+
"clearTimeout": false,
|
|
4334
|
+
"Client": false,
|
|
4335
|
+
"clients": false,
|
|
4336
|
+
"Clients": false,
|
|
4337
|
+
"close": true,
|
|
4338
|
+
"CompressionStream": false,
|
|
4339
|
+
"console": false,
|
|
4340
|
+
"CountQueuingStrategy": false,
|
|
4341
|
+
"crypto": false,
|
|
4342
|
+
"Crypto": false,
|
|
4343
|
+
"CryptoKey": false,
|
|
4344
|
+
"CustomEvent": false,
|
|
4345
|
+
"DecompressionStream": false,
|
|
4346
|
+
"ErrorEvent": false,
|
|
4347
|
+
"Event": false,
|
|
4348
|
+
"ExtendableEvent": false,
|
|
4349
|
+
"ExtendableMessageEvent": false,
|
|
4350
|
+
"fetch": false,
|
|
4351
|
+
"FetchEvent": false,
|
|
4352
|
+
"File": false,
|
|
4353
|
+
"FileReaderSync": false,
|
|
4354
|
+
"FormData": false,
|
|
4355
|
+
"Headers": false,
|
|
4356
|
+
"IDBCursor": false,
|
|
4357
|
+
"IDBCursorWithValue": false,
|
|
4358
|
+
"IDBDatabase": false,
|
|
4359
|
+
"IDBFactory": false,
|
|
4360
|
+
"IDBIndex": false,
|
|
4361
|
+
"IDBKeyRange": false,
|
|
4362
|
+
"IDBObjectStore": false,
|
|
4363
|
+
"IDBOpenDBRequest": false,
|
|
4364
|
+
"IDBRequest": false,
|
|
4365
|
+
"IDBTransaction": false,
|
|
4366
|
+
"IDBVersionChangeEvent": false,
|
|
4367
|
+
"ImageData": false,
|
|
4368
|
+
"importScripts": false,
|
|
4369
|
+
"indexedDB": false,
|
|
4370
|
+
"location": false,
|
|
4371
|
+
"MessageChannel": false,
|
|
4372
|
+
"MessageEvent": false,
|
|
4373
|
+
"MessagePort": false,
|
|
4374
|
+
"name": false,
|
|
4375
|
+
"navigator": false,
|
|
4376
|
+
"Notification": false,
|
|
4377
|
+
"onclose": true,
|
|
4378
|
+
"onconnect": true,
|
|
4379
|
+
"onerror": true,
|
|
4380
|
+
"onfetch": true,
|
|
4381
|
+
"oninstall": true,
|
|
4382
|
+
"onlanguagechange": true,
|
|
4383
|
+
"onmessage": true,
|
|
4384
|
+
"onmessageerror": true,
|
|
4385
|
+
"onnotificationclick": true,
|
|
4386
|
+
"onnotificationclose": true,
|
|
4387
|
+
"onoffline": true,
|
|
4388
|
+
"ononline": true,
|
|
4389
|
+
"onpush": true,
|
|
4390
|
+
"onpushsubscriptionchange": true,
|
|
4391
|
+
"onrejectionhandled": true,
|
|
4392
|
+
"onsync": true,
|
|
4393
|
+
"onunhandledrejection": true,
|
|
4394
|
+
"performance": false,
|
|
4395
|
+
"Performance": false,
|
|
4396
|
+
"PerformanceEntry": false,
|
|
4397
|
+
"PerformanceMark": false,
|
|
4398
|
+
"PerformanceMeasure": false,
|
|
4399
|
+
"PerformanceNavigation": false,
|
|
4400
|
+
"PerformanceObserver": false,
|
|
4401
|
+
"PerformanceObserverEntryList": false,
|
|
4402
|
+
"PerformanceResourceTiming": false,
|
|
4403
|
+
"PerformanceTiming": false,
|
|
4404
|
+
"postMessage": true,
|
|
4405
|
+
"Promise": false,
|
|
4406
|
+
"queueMicrotask": false,
|
|
4407
|
+
"ReadableByteStreamController": false,
|
|
4408
|
+
"ReadableStream": false,
|
|
4409
|
+
"ReadableStreamBYOBReader": false,
|
|
4410
|
+
"ReadableStreamBYOBRequest": false,
|
|
4411
|
+
"ReadableStreamDefaultController": false,
|
|
4412
|
+
"ReadableStreamDefaultReader": false,
|
|
4413
|
+
"registration": false,
|
|
4414
|
+
"removeEventListener": false,
|
|
4415
|
+
"Request": false,
|
|
4416
|
+
"Response": false,
|
|
4417
|
+
"self": false,
|
|
4418
|
+
"ServiceWorker": false,
|
|
4419
|
+
"ServiceWorkerContainer": false,
|
|
4420
|
+
"ServiceWorkerGlobalScope": false,
|
|
4421
|
+
"ServiceWorkerMessageEvent": false,
|
|
4422
|
+
"ServiceWorkerRegistration": false,
|
|
4423
|
+
"setInterval": false,
|
|
4424
|
+
"setTimeout": false,
|
|
4425
|
+
"skipWaiting": false,
|
|
4426
|
+
"SubtleCrypto": false,
|
|
4427
|
+
"TextDecoder": false,
|
|
4428
|
+
"TextDecoderStream": false,
|
|
4429
|
+
"TextEncoder": false,
|
|
4430
|
+
"TextEncoderStream": false,
|
|
4431
|
+
"TransformStream": false,
|
|
4432
|
+
"TransformStreamDefaultController": false,
|
|
4433
|
+
"URL": false,
|
|
4434
|
+
"URLSearchParams": false,
|
|
4435
|
+
"WebAssembly": false,
|
|
4436
|
+
"WebSocket": false,
|
|
4437
|
+
"WindowClient": false,
|
|
4438
|
+
"Worker": false,
|
|
4439
|
+
"WorkerGlobalScope": false,
|
|
4440
|
+
"WritableStream": false,
|
|
4441
|
+
"WritableStreamDefaultController": false,
|
|
4442
|
+
"WritableStreamDefaultWriter": false,
|
|
4443
|
+
"XMLHttpRequest": false
|
|
4444
|
+
};
|
|
4445
|
+
atomtest = {
|
|
4446
|
+
"advanceClock": false,
|
|
4447
|
+
"atom": false,
|
|
4448
|
+
"fakeClearInterval": false,
|
|
4449
|
+
"fakeClearTimeout": false,
|
|
4450
|
+
"fakeSetInterval": false,
|
|
4451
|
+
"fakeSetTimeout": false,
|
|
4452
|
+
"resetTimeouts": false,
|
|
4453
|
+
"waitsForPromise": false
|
|
4454
|
+
};
|
|
4455
|
+
embertest = {
|
|
4456
|
+
"andThen": false,
|
|
4457
|
+
"click": false,
|
|
4458
|
+
"currentPath": false,
|
|
4459
|
+
"currentRouteName": false,
|
|
4460
|
+
"currentURL": false,
|
|
4461
|
+
"fillIn": false,
|
|
4462
|
+
"find": false,
|
|
4463
|
+
"findAll": false,
|
|
4464
|
+
"findWithAssert": false,
|
|
4465
|
+
"keyEvent": false,
|
|
4466
|
+
"pauseTest": false,
|
|
4467
|
+
"resumeTest": false,
|
|
4468
|
+
"triggerEvent": false,
|
|
4469
|
+
"visit": false,
|
|
4470
|
+
"wait": false
|
|
4471
|
+
};
|
|
4472
|
+
protractor = {
|
|
4473
|
+
"$": false,
|
|
4474
|
+
"$$": false,
|
|
4475
|
+
"browser": false,
|
|
4476
|
+
"by": false,
|
|
4477
|
+
"By": false,
|
|
4478
|
+
"DartObject": false,
|
|
4479
|
+
"element": false,
|
|
4480
|
+
"protractor": false
|
|
4481
|
+
};
|
|
4482
|
+
webextensions = {
|
|
4483
|
+
"browser": false,
|
|
4484
|
+
"chrome": false,
|
|
4485
|
+
"opr": false
|
|
4486
|
+
};
|
|
4487
|
+
greasemonkey = {
|
|
4488
|
+
"cloneInto": false,
|
|
4489
|
+
"createObjectIn": false,
|
|
4490
|
+
"exportFunction": false,
|
|
4491
|
+
"GM": false,
|
|
4492
|
+
"GM_addElement": false,
|
|
4493
|
+
"GM_addStyle": false,
|
|
4494
|
+
"GM_addValueChangeListener": false,
|
|
4495
|
+
"GM_deleteValue": false,
|
|
4496
|
+
"GM_download": false,
|
|
4497
|
+
"GM_getResourceText": false,
|
|
4498
|
+
"GM_getResourceURL": false,
|
|
4499
|
+
"GM_getTab": false,
|
|
4500
|
+
"GM_getTabs": false,
|
|
4501
|
+
"GM_getValue": false,
|
|
4502
|
+
"GM_info": false,
|
|
4503
|
+
"GM_listValues": false,
|
|
4504
|
+
"GM_log": false,
|
|
4505
|
+
"GM_notification": false,
|
|
4506
|
+
"GM_openInTab": false,
|
|
4507
|
+
"GM_registerMenuCommand": false,
|
|
4508
|
+
"GM_removeValueChangeListener": false,
|
|
4509
|
+
"GM_saveTab": false,
|
|
4510
|
+
"GM_setClipboard": false,
|
|
4511
|
+
"GM_setValue": false,
|
|
4512
|
+
"GM_unregisterMenuCommand": false,
|
|
4513
|
+
"GM_xmlhttpRequest": false,
|
|
4514
|
+
"unsafeWindow": false
|
|
4515
|
+
};
|
|
4516
|
+
devtools = {
|
|
4517
|
+
"$": false,
|
|
4518
|
+
"$_": false,
|
|
4519
|
+
"$$": false,
|
|
4520
|
+
"$0": false,
|
|
4521
|
+
"$1": false,
|
|
4522
|
+
"$2": false,
|
|
4523
|
+
"$3": false,
|
|
4524
|
+
"$4": false,
|
|
4525
|
+
"$x": false,
|
|
4526
|
+
"chrome": false,
|
|
4527
|
+
"clear": false,
|
|
4528
|
+
"copy": false,
|
|
4529
|
+
"debug": false,
|
|
4530
|
+
"dir": false,
|
|
4531
|
+
"dirxml": false,
|
|
4532
|
+
"getEventListeners": false,
|
|
4533
|
+
"inspect": false,
|
|
4534
|
+
"keys": false,
|
|
4535
|
+
"monitor": false,
|
|
4536
|
+
"monitorEvents": false,
|
|
4537
|
+
"profile": false,
|
|
4538
|
+
"profileEnd": false,
|
|
4539
|
+
"queryObjects": false,
|
|
4540
|
+
"table": false,
|
|
4541
|
+
"undebug": false,
|
|
4542
|
+
"unmonitor": false,
|
|
4543
|
+
"unmonitorEvents": false,
|
|
4544
|
+
"values": false
|
|
4545
|
+
};
|
|
4546
|
+
globals_default = {
|
|
4547
|
+
builtin,
|
|
4548
|
+
es5,
|
|
4549
|
+
es2015,
|
|
4550
|
+
es2017,
|
|
4551
|
+
es2020,
|
|
4552
|
+
es2021,
|
|
4553
|
+
browser,
|
|
4554
|
+
worker,
|
|
4555
|
+
node,
|
|
4556
|
+
nodeBuiltin,
|
|
4557
|
+
commonjs,
|
|
4558
|
+
amd,
|
|
4559
|
+
mocha,
|
|
4560
|
+
jasmine,
|
|
4561
|
+
jest,
|
|
4562
|
+
qunit,
|
|
4563
|
+
phantomjs,
|
|
4564
|
+
couch,
|
|
4565
|
+
rhino,
|
|
4566
|
+
nashorn,
|
|
4567
|
+
wsh,
|
|
4568
|
+
jquery,
|
|
4569
|
+
yui,
|
|
4570
|
+
shelljs,
|
|
4571
|
+
prototypejs,
|
|
4572
|
+
meteor,
|
|
4573
|
+
mongo,
|
|
4574
|
+
applescript,
|
|
4575
|
+
serviceworker,
|
|
4576
|
+
atomtest,
|
|
4577
|
+
embertest,
|
|
4578
|
+
protractor,
|
|
4579
|
+
"shared-node-browser": {
|
|
4580
|
+
"AbortController": false,
|
|
4581
|
+
"AbortSignal": false,
|
|
4582
|
+
"atob": false,
|
|
4583
|
+
"Blob": false,
|
|
4584
|
+
"BroadcastChannel": false,
|
|
4585
|
+
"btoa": false,
|
|
4586
|
+
"ByteLengthQueuingStrategy": false,
|
|
4587
|
+
"clearInterval": false,
|
|
4588
|
+
"clearTimeout": false,
|
|
4589
|
+
"CompressionStream": false,
|
|
4590
|
+
"console": false,
|
|
4591
|
+
"CountQueuingStrategy": false,
|
|
4592
|
+
"crypto": false,
|
|
4593
|
+
"Crypto": false,
|
|
4594
|
+
"CryptoKey": false,
|
|
4595
|
+
"CustomEvent": false,
|
|
4596
|
+
"DecompressionStream": false,
|
|
4597
|
+
"DOMException": false,
|
|
4598
|
+
"Event": false,
|
|
4599
|
+
"EventTarget": false,
|
|
4600
|
+
"fetch": false,
|
|
4601
|
+
"File": false,
|
|
4602
|
+
"FormData": false,
|
|
4603
|
+
"Headers": false,
|
|
4604
|
+
"Intl": false,
|
|
4605
|
+
"MessageChannel": false,
|
|
4606
|
+
"MessageEvent": false,
|
|
4607
|
+
"MessagePort": false,
|
|
4608
|
+
"performance": false,
|
|
4609
|
+
"PerformanceEntry": false,
|
|
4610
|
+
"PerformanceMark": false,
|
|
4611
|
+
"PerformanceMeasure": false,
|
|
4612
|
+
"PerformanceObserver": false,
|
|
4613
|
+
"PerformanceObserverEntryList": false,
|
|
4614
|
+
"PerformanceResourceTiming": false,
|
|
4615
|
+
"queueMicrotask": false,
|
|
4616
|
+
"ReadableByteStreamController": false,
|
|
4617
|
+
"ReadableStream": false,
|
|
4618
|
+
"ReadableStreamBYOBReader": false,
|
|
4619
|
+
"ReadableStreamBYOBRequest": false,
|
|
4620
|
+
"ReadableStreamDefaultController": false,
|
|
4621
|
+
"ReadableStreamDefaultReader": false,
|
|
4622
|
+
"Request": false,
|
|
4623
|
+
"Response": false,
|
|
4624
|
+
"setInterval": false,
|
|
4625
|
+
"setTimeout": false,
|
|
4626
|
+
"structuredClone": false,
|
|
4627
|
+
"SubtleCrypto": false,
|
|
4628
|
+
"TextDecoder": false,
|
|
4629
|
+
"TextDecoderStream": false,
|
|
4630
|
+
"TextEncoder": false,
|
|
4631
|
+
"TextEncoderStream": false,
|
|
4632
|
+
"TransformStream": false,
|
|
4633
|
+
"TransformStreamDefaultController": false,
|
|
4634
|
+
"URL": false,
|
|
4635
|
+
"URLSearchParams": false,
|
|
4636
|
+
"WebAssembly": false,
|
|
4637
|
+
"WritableStream": false,
|
|
4638
|
+
"WritableStreamDefaultController": false,
|
|
4639
|
+
"WritableStreamDefaultWriter": false
|
|
4640
|
+
},
|
|
4641
|
+
webextensions,
|
|
4642
|
+
greasemonkey,
|
|
4643
|
+
devtools
|
|
4644
|
+
};
|
|
4645
|
+
}));
|
|
4646
|
+
var unicornRules = {
|
|
4647
|
+
languageOptions: { globals: { ...(/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4648
|
+
module.exports = (init_globals(), __toCommonJS(globals_exports).default);
|
|
4649
|
+
})))())).default.builtin } },
|
|
4650
|
+
plugins: { unicorn: eslintPluginUnicorn },
|
|
4651
|
+
rules: {
|
|
4652
|
+
"unicorn/better-regex": "error",
|
|
4653
|
+
"unicorn/catch-error-name": "error",
|
|
4654
|
+
"unicorn/consistent-date-clone": "error",
|
|
4655
|
+
"unicorn/consistent-destructuring": "error",
|
|
4656
|
+
"unicorn/escape-case": "error",
|
|
4657
|
+
"unicorn/no-array-for-each": "error",
|
|
4658
|
+
"unicorn/no-array-reduce": "error",
|
|
4659
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
4660
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
4661
|
+
"unicorn/no-new-array": "error",
|
|
4662
|
+
"unicorn/no-new-buffer": "error",
|
|
4663
|
+
"unicorn/no-object-as-default-parameter": "error",
|
|
4664
|
+
"unicorn/no-single-promise-in-promise-methods": "error",
|
|
4665
|
+
"unicorn/no-unnecessary-await": "error",
|
|
4666
|
+
"unicorn/no-unreadable-iife": "error",
|
|
4667
|
+
"unicorn/no-useless-collection-argument": "error",
|
|
4668
|
+
"unicorn/no-useless-error-capture-stack-trace": "error",
|
|
4669
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
4670
|
+
"unicorn/no-useless-promise-resolve-reject": "error",
|
|
4671
|
+
"unicorn/no-useless-spread": "error",
|
|
4672
|
+
"unicorn/no-useless-switch-case": "error",
|
|
4673
|
+
"unicorn/number-literal-case": "error",
|
|
4674
|
+
"unicorn/numeric-separators-style": "error",
|
|
4675
|
+
"unicorn/prefer-array-find": "error",
|
|
4676
|
+
"unicorn/prefer-array-flat": "error",
|
|
4677
|
+
"unicorn/prefer-array-flat-map": "error",
|
|
4678
|
+
"unicorn/prefer-array-index-of": "error",
|
|
4679
|
+
"unicorn/prefer-array-some": "error",
|
|
4680
|
+
"unicorn/prefer-bigint-literals": "error",
|
|
4681
|
+
"unicorn/prefer-blob-reading-methods": "error",
|
|
4682
|
+
"unicorn/prefer-date-now": "error",
|
|
4683
|
+
"unicorn/prefer-import-meta-properties": "error",
|
|
4684
|
+
"unicorn/prefer-includes": "error",
|
|
4685
|
+
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
4686
|
+
"unicorn/prefer-number-properties": "error",
|
|
4687
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
4688
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
4689
|
+
"unicorn/prefer-prototype-methods": "error",
|
|
4690
|
+
"unicorn/prefer-response-static-json": "error",
|
|
4691
|
+
"unicorn/prefer-set-has": "error",
|
|
4692
|
+
"unicorn/prefer-set-size": "error",
|
|
4693
|
+
"unicorn/prefer-string-raw": "error",
|
|
4694
|
+
"unicorn/prefer-string-replace-all": "error",
|
|
4695
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
4696
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
4697
|
+
"unicorn/prefer-structured-clone": "error",
|
|
4698
|
+
"unicorn/prefer-switch": "error",
|
|
4699
|
+
"unicorn/require-module-attributes": "error",
|
|
4700
|
+
"unicorn/require-module-specifiers": "error",
|
|
4701
|
+
"unicorn/template-indent": "error"
|
|
4702
|
+
}
|
|
4703
|
+
};
|
|
4704
|
+
//#endregion
|
|
4705
|
+
//#region src/index.ts
|
|
4706
|
+
/**
|
|
4707
|
+
* The ESLint flat config used by Borela Tech projects.
|
|
4708
|
+
* @public
|
|
4709
|
+
*/
|
|
4710
|
+
var config = [
|
|
4711
|
+
ignores,
|
|
4712
|
+
languageOptions,
|
|
4713
|
+
eslint.configs.recommended,
|
|
4714
|
+
react.configs.flat.recommended,
|
|
4715
|
+
stylistic.configs.recommended,
|
|
4716
|
+
...typescript.configs.recommended,
|
|
4717
|
+
...typescript.configs.stylistic,
|
|
4718
|
+
customRules,
|
|
4719
|
+
generalRules,
|
|
4720
|
+
perfectionistRules,
|
|
4721
|
+
reactHooks,
|
|
4722
|
+
stylisticRules,
|
|
4723
|
+
typescriptRules,
|
|
4724
|
+
unicornRules
|
|
4725
|
+
];
|
|
4726
|
+
//#endregion
|
|
4727
|
+
export { config };
|
|
4728
|
+
|
|
4729
|
+
//# sourceMappingURL=index.esm.js.map
|