@exbotanical/eslint-config 1.1.0 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9972 -483
- package/dist/index.js +886 -14
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,807 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __esm = (fn, res) => function __init() {
|
|
14
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
15
|
+
};
|
|
16
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
17
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
+
for (let key of __getOwnPropNames(from))
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
28
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
29
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
30
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
31
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
32
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
33
|
+
mod
|
|
34
|
+
));
|
|
35
|
+
|
|
36
|
+
// node_modules/tsup/assets/esm_shims.js
|
|
37
|
+
import { fileURLToPath } from "url";
|
|
38
|
+
import path from "path";
|
|
39
|
+
var getFilename, getDirname, __dirname;
|
|
40
|
+
var init_esm_shims = __esm({
|
|
41
|
+
"node_modules/tsup/assets/esm_shims.js"() {
|
|
42
|
+
"use strict";
|
|
43
|
+
getFilename = () => fileURLToPath(import.meta.url);
|
|
44
|
+
getDirname = () => path.dirname(getFilename());
|
|
45
|
+
__dirname = /* @__PURE__ */ getDirname();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// node_modules/eslint-plugin-cypress/package.json
|
|
50
|
+
var require_package = __commonJS({
|
|
51
|
+
"node_modules/eslint-plugin-cypress/package.json"(exports, module) {
|
|
52
|
+
module.exports = {
|
|
53
|
+
name: "eslint-plugin-cypress",
|
|
54
|
+
version: "4.2.0",
|
|
55
|
+
description: "An ESLint plugin for projects using Cypress",
|
|
56
|
+
main: "legacy.js",
|
|
57
|
+
exports: {
|
|
58
|
+
".": "./legacy.js",
|
|
59
|
+
"./flat": "./lib/flat.js"
|
|
60
|
+
},
|
|
61
|
+
author: "Cypress-io",
|
|
62
|
+
license: "MIT",
|
|
63
|
+
keywords: [
|
|
64
|
+
"eslint",
|
|
65
|
+
"eslintplugin",
|
|
66
|
+
"cypress"
|
|
67
|
+
],
|
|
68
|
+
repository: {
|
|
69
|
+
type: "git",
|
|
70
|
+
url: "git+https://github.com/cypress-io/eslint-plugin-cypress.git"
|
|
71
|
+
},
|
|
72
|
+
bugs: {
|
|
73
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/issues"
|
|
74
|
+
},
|
|
75
|
+
homepage: "https://github.com/cypress-io/eslint-plugin-cypress#readme",
|
|
76
|
+
peerDependencies: {
|
|
77
|
+
eslint: ">=9"
|
|
78
|
+
},
|
|
79
|
+
dependencies: {
|
|
80
|
+
globals: "^15.11.0"
|
|
81
|
+
},
|
|
82
|
+
devDependencies: {
|
|
83
|
+
eslint: "^9.13.0",
|
|
84
|
+
"eslint-plugin-eslint-plugin": "^6.3.1",
|
|
85
|
+
"eslint-plugin-mocha": "^10.5.0",
|
|
86
|
+
husky: "^9.1.6",
|
|
87
|
+
jest: "^29.7.0",
|
|
88
|
+
"semantic-release": "24.2.0"
|
|
89
|
+
},
|
|
90
|
+
scripts: {
|
|
91
|
+
lint: 'eslint "*.js" "**/**/*.js"',
|
|
92
|
+
"lint-fix": "npm run lint -- --fix",
|
|
93
|
+
"semantic-release": "semantic-release",
|
|
94
|
+
start: "npm run test-watch",
|
|
95
|
+
test: "jest",
|
|
96
|
+
"test:legacy": "jest --config jest.config-legacy.js",
|
|
97
|
+
"test-watch": "jest --watchAll",
|
|
98
|
+
prepare: "husky"
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// node_modules/eslint-plugin-cypress/lib/rules/no-assigning-return-values.js
|
|
105
|
+
var require_no_assigning_return_values = __commonJS({
|
|
106
|
+
"node_modules/eslint-plugin-cypress/lib/rules/no-assigning-return-values.js"(exports, module) {
|
|
107
|
+
"use strict";
|
|
108
|
+
init_esm_shims();
|
|
109
|
+
function get(obj, propertyString = "") {
|
|
110
|
+
const properties = propertyString.split(".");
|
|
111
|
+
for (let i = 0; i < properties.length; i++) {
|
|
112
|
+
const value = (obj || {})[properties[i]];
|
|
113
|
+
if (value == null) return value;
|
|
114
|
+
obj = value;
|
|
115
|
+
}
|
|
116
|
+
return obj;
|
|
117
|
+
}
|
|
118
|
+
module.exports = {
|
|
119
|
+
meta: {
|
|
120
|
+
type: "problem",
|
|
121
|
+
docs: {
|
|
122
|
+
description: "disallow assigning return values of `cy` calls",
|
|
123
|
+
category: "Possible Errors",
|
|
124
|
+
recommended: true,
|
|
125
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-assigning-return-values.md"
|
|
126
|
+
},
|
|
127
|
+
schema: [],
|
|
128
|
+
messages: {
|
|
129
|
+
unexpected: "Do not assign the return value of a Cypress command"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
create(context) {
|
|
133
|
+
return {
|
|
134
|
+
VariableDeclaration(node2) {
|
|
135
|
+
if (node2.declarations.some(isCypressCommandDeclaration)) {
|
|
136
|
+
context.report({ node: node2, messageId: "unexpected" });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
var allowedCommands = {
|
|
143
|
+
now: true,
|
|
144
|
+
spy: true,
|
|
145
|
+
state: true,
|
|
146
|
+
stub: true
|
|
147
|
+
};
|
|
148
|
+
function isCypressCommandDeclaration(declarator) {
|
|
149
|
+
let object = get(declarator, "init.callee.object");
|
|
150
|
+
if (!object) return;
|
|
151
|
+
while (object.callee) {
|
|
152
|
+
object = object.callee.object;
|
|
153
|
+
if (!object) return;
|
|
154
|
+
}
|
|
155
|
+
const commandName = get(declarator, "init.callee.property.name");
|
|
156
|
+
const parent = get(object, "parent.property.name") || get(declarator, "id.name");
|
|
157
|
+
if (commandName && (allowedCommands[commandName] || allowedCommands[parent])) return;
|
|
158
|
+
return object.name === "cy";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// node_modules/eslint-plugin-cypress/lib/rules/unsafe-to-chain-command.js
|
|
164
|
+
var require_unsafe_to_chain_command = __commonJS({
|
|
165
|
+
"node_modules/eslint-plugin-cypress/lib/rules/unsafe-to-chain-command.js"(exports, module) {
|
|
166
|
+
"use strict";
|
|
167
|
+
init_esm_shims();
|
|
168
|
+
var { basename } = __require("path");
|
|
169
|
+
var NAME = basename(__dirname);
|
|
170
|
+
var DESCRIPTION = "disallow actions within chains";
|
|
171
|
+
var unsafeToChainActions = [
|
|
172
|
+
"blur",
|
|
173
|
+
"clear",
|
|
174
|
+
"click",
|
|
175
|
+
"check",
|
|
176
|
+
"dblclick",
|
|
177
|
+
"each",
|
|
178
|
+
"focus",
|
|
179
|
+
"rightclick",
|
|
180
|
+
"screenshot",
|
|
181
|
+
"scrollIntoView",
|
|
182
|
+
"scrollTo",
|
|
183
|
+
"select",
|
|
184
|
+
"selectFile",
|
|
185
|
+
"spread",
|
|
186
|
+
"submit",
|
|
187
|
+
"type",
|
|
188
|
+
"trigger",
|
|
189
|
+
"uncheck",
|
|
190
|
+
"within"
|
|
191
|
+
];
|
|
192
|
+
var schema = {
|
|
193
|
+
title: NAME,
|
|
194
|
+
description: DESCRIPTION,
|
|
195
|
+
type: "object",
|
|
196
|
+
properties: {
|
|
197
|
+
methods: {
|
|
198
|
+
type: "array",
|
|
199
|
+
description: "An additional list of methods to check for unsafe chaining.",
|
|
200
|
+
default: []
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var getDefaultOptions = (context) => {
|
|
205
|
+
return Object.entries(schema.properties).reduce((acc, [key, value]) => {
|
|
206
|
+
if (!(value.default in value)) return acc;
|
|
207
|
+
return {
|
|
208
|
+
...acc,
|
|
209
|
+
[key]: value.default
|
|
210
|
+
};
|
|
211
|
+
}, context.options[0] || {});
|
|
212
|
+
};
|
|
213
|
+
module.exports = {
|
|
214
|
+
meta: {
|
|
215
|
+
type: "problem",
|
|
216
|
+
docs: {
|
|
217
|
+
description: DESCRIPTION,
|
|
218
|
+
category: "Possible Errors",
|
|
219
|
+
recommended: true,
|
|
220
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/unsafe-to-chain-command.md"
|
|
221
|
+
},
|
|
222
|
+
schema: [schema],
|
|
223
|
+
messages: {
|
|
224
|
+
unexpected: "It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from `cy.` in a next command line."
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
create(context) {
|
|
228
|
+
const { methods } = getDefaultOptions(context);
|
|
229
|
+
return {
|
|
230
|
+
CallExpression(node2) {
|
|
231
|
+
if (isRootCypress(node2) && isActionUnsafeToChain(node2, methods) && node2.parent.type === "MemberExpression") {
|
|
232
|
+
context.report({
|
|
233
|
+
node: node2,
|
|
234
|
+
messageId: "unexpected"
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
var isRootCypress = (node2) => {
|
|
242
|
+
if (node2.type !== "CallExpression" || node2.callee.type !== "MemberExpression") {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
if (node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy") {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
return isRootCypress(node2.callee.object);
|
|
249
|
+
};
|
|
250
|
+
var isActionUnsafeToChain = (node2, additionalMethods = []) => {
|
|
251
|
+
const unsafeActionsRegex = new RegExp([
|
|
252
|
+
...unsafeToChainActions.map((action) => `^${action}$`),
|
|
253
|
+
...additionalMethods.map((method) => method instanceof RegExp ? method.source : method)
|
|
254
|
+
].join("|"));
|
|
255
|
+
return node2.callee && node2.callee.property && node2.callee.property.type === "Identifier" && unsafeActionsRegex.test(node2.callee.property.name);
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js
|
|
261
|
+
var require_no_unnecessary_waiting = __commonJS({
|
|
262
|
+
"node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js"(exports, module) {
|
|
263
|
+
"use strict";
|
|
264
|
+
init_esm_shims();
|
|
265
|
+
module.exports = {
|
|
266
|
+
meta: {
|
|
267
|
+
type: "problem",
|
|
268
|
+
docs: {
|
|
269
|
+
description: "disallow waiting for arbitrary time periods",
|
|
270
|
+
category: "Possible Errors",
|
|
271
|
+
recommended: true,
|
|
272
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-unnecessary-waiting.md"
|
|
273
|
+
},
|
|
274
|
+
schema: [],
|
|
275
|
+
messages: {
|
|
276
|
+
unexpected: "Do not wait for arbitrary time periods"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
create(context) {
|
|
280
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
281
|
+
return {
|
|
282
|
+
CallExpression(node2) {
|
|
283
|
+
if (isCallingCyWait(node2)) {
|
|
284
|
+
const scope = sourceCode.getScope ? sourceCode.getScope(node2) : context.getScope();
|
|
285
|
+
if (isIdentifierNumberConstArgument(node2, scope) || isNumberArgument(node2)) {
|
|
286
|
+
context.report({ node: node2, messageId: "unexpected" });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
function nodeIsCalledByCy(node2) {
|
|
294
|
+
if (node2.type === "Identifier" && node2.name === "cy") return true;
|
|
295
|
+
if (typeof node2.callee === "undefined" || typeof node2.callee.object === "undefined") {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
return nodeIsCalledByCy(node2.callee.object);
|
|
299
|
+
}
|
|
300
|
+
function isCallingCyWait(node2) {
|
|
301
|
+
return node2.callee.type === "MemberExpression" && nodeIsCalledByCy(node2) && node2.callee.property.type === "Identifier" && node2.callee.property.name === "wait";
|
|
302
|
+
}
|
|
303
|
+
function isNumberArgument(node2) {
|
|
304
|
+
return node2.arguments.length > 0 && node2.arguments[0].type === "Literal" && typeof node2.arguments[0].value === "number";
|
|
305
|
+
}
|
|
306
|
+
function isIdentifierNumberConstArgument(node2, scope) {
|
|
307
|
+
if (node2.arguments.length === 0) return false;
|
|
308
|
+
if (node2.arguments[0].type !== "Identifier") return false;
|
|
309
|
+
const identifier = node2.arguments[0];
|
|
310
|
+
const resolvedIdentifier = scope.references.find((ref) => ref.identifier === identifier).resolved;
|
|
311
|
+
const definition = resolvedIdentifier.defs[0];
|
|
312
|
+
const isVariable = definition.type === "Variable";
|
|
313
|
+
if (isVariable) {
|
|
314
|
+
if (!definition.node.init) return false;
|
|
315
|
+
return typeof definition.node.init.value === "number";
|
|
316
|
+
}
|
|
317
|
+
if (definition.type === "ImportBinding") return false;
|
|
318
|
+
const param = definition.node.params[definition.index];
|
|
319
|
+
if (!param || param.type !== "AssignmentPattern") return false;
|
|
320
|
+
return typeof param.right.value === "number";
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
// node_modules/eslint-plugin-cypress/lib/rules/no-async-before.js
|
|
326
|
+
var require_no_async_before = __commonJS({
|
|
327
|
+
"node_modules/eslint-plugin-cypress/lib/rules/no-async-before.js"(exports, module) {
|
|
328
|
+
"use strict";
|
|
329
|
+
init_esm_shims();
|
|
330
|
+
module.exports = {
|
|
331
|
+
meta: {
|
|
332
|
+
type: "problem",
|
|
333
|
+
docs: {
|
|
334
|
+
description: "disallow using `async`/`await` in Cypress `before` methods",
|
|
335
|
+
category: "Possible Errors",
|
|
336
|
+
recommended: true,
|
|
337
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-async-before.md"
|
|
338
|
+
},
|
|
339
|
+
schema: [],
|
|
340
|
+
messages: {
|
|
341
|
+
unexpected: "Avoid using async functions with Cypress before / beforeEach functions"
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
create(context) {
|
|
345
|
+
function isBeforeBlock(callExpressionNode) {
|
|
346
|
+
const { type, name } = callExpressionNode.callee;
|
|
347
|
+
return type === "Identifier" && name === "before" || name === "beforeEach";
|
|
348
|
+
}
|
|
349
|
+
function isBeforeAsync(node2) {
|
|
350
|
+
return node2.arguments && node2.arguments.length >= 2 && node2.arguments[1].async === true;
|
|
351
|
+
}
|
|
352
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
353
|
+
return {
|
|
354
|
+
Identifier(node2) {
|
|
355
|
+
if (node2.name === "cy" || node2.name === "Cypress") {
|
|
356
|
+
const ancestors = sourceCode.getAncestors ? sourceCode.getAncestors(node2) : context.getAncestors();
|
|
357
|
+
const asyncTestBlocks = ancestors.filter((n) => n.type === "CallExpression").filter(isBeforeBlock).filter(isBeforeAsync);
|
|
358
|
+
if (asyncTestBlocks.length >= 1) {
|
|
359
|
+
asyncTestBlocks.forEach((node3) => {
|
|
360
|
+
context.report({ node: node3, messageId: "unexpected" });
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// node_modules/eslint-plugin-cypress/lib/rules/no-async-tests.js
|
|
372
|
+
var require_no_async_tests = __commonJS({
|
|
373
|
+
"node_modules/eslint-plugin-cypress/lib/rules/no-async-tests.js"(exports, module) {
|
|
374
|
+
"use strict";
|
|
375
|
+
init_esm_shims();
|
|
376
|
+
module.exports = {
|
|
377
|
+
meta: {
|
|
378
|
+
type: "problem",
|
|
379
|
+
docs: {
|
|
380
|
+
description: "disallow using `async`/`await` in Cypress test cases",
|
|
381
|
+
category: "Possible Errors",
|
|
382
|
+
recommended: true,
|
|
383
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-async-tests.md"
|
|
384
|
+
},
|
|
385
|
+
schema: [],
|
|
386
|
+
messages: {
|
|
387
|
+
unexpected: "Avoid using async functions with Cypress tests"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
create(context) {
|
|
391
|
+
function isTestBlock(callExpressionNode) {
|
|
392
|
+
const { type, name } = callExpressionNode.callee;
|
|
393
|
+
return type === "Identifier" && name === "it" || name === "test";
|
|
394
|
+
}
|
|
395
|
+
function isTestAsync(node2) {
|
|
396
|
+
return node2.arguments && node2.arguments.length >= 2 && node2.arguments[1].async === true;
|
|
397
|
+
}
|
|
398
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
399
|
+
return {
|
|
400
|
+
Identifier(node2) {
|
|
401
|
+
if (node2.name === "cy" || node2.name === "Cypress") {
|
|
402
|
+
const ancestors = sourceCode.getAncestors ? sourceCode.getAncestors(node2) : context.getAncestors();
|
|
403
|
+
const asyncTestBlocks = ancestors.filter((n) => n.type === "CallExpression").filter(isTestBlock).filter(isTestAsync);
|
|
404
|
+
if (asyncTestBlocks.length >= 1) {
|
|
405
|
+
asyncTestBlocks.forEach((node3) => {
|
|
406
|
+
context.report({ node: node3, messageId: "unexpected" });
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
// node_modules/eslint-plugin-cypress/lib/rules/assertion-before-screenshot.js
|
|
418
|
+
var require_assertion_before_screenshot = __commonJS({
|
|
419
|
+
"node_modules/eslint-plugin-cypress/lib/rules/assertion-before-screenshot.js"(exports, module) {
|
|
420
|
+
"use strict";
|
|
421
|
+
init_esm_shims();
|
|
422
|
+
var assertionCommands = [
|
|
423
|
+
// assertions
|
|
424
|
+
"should",
|
|
425
|
+
"and",
|
|
426
|
+
"contains",
|
|
427
|
+
// retries until it gets something
|
|
428
|
+
"get",
|
|
429
|
+
// not an assertion, but unlikely to require waiting for render
|
|
430
|
+
"scrollIntoView",
|
|
431
|
+
"scrollTo"
|
|
432
|
+
];
|
|
433
|
+
module.exports = {
|
|
434
|
+
meta: {
|
|
435
|
+
type: "problem",
|
|
436
|
+
docs: {
|
|
437
|
+
description: "require screenshots to be preceded by an assertion",
|
|
438
|
+
category: "Possible Errors",
|
|
439
|
+
recommended: false,
|
|
440
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/assertion-before-screenshot.md"
|
|
441
|
+
},
|
|
442
|
+
schema: [],
|
|
443
|
+
messages: {
|
|
444
|
+
unexpected: "Make an assertion on the page state before taking a screenshot"
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
create(context) {
|
|
448
|
+
return {
|
|
449
|
+
CallExpression(node2) {
|
|
450
|
+
if (isCallingCyScreenshot(node2) && !isPreviousAnAssertion(node2)) {
|
|
451
|
+
context.report({ node: node2, messageId: "unexpected" });
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
function isRootCypress(node2) {
|
|
458
|
+
while (node2.type === "CallExpression") {
|
|
459
|
+
if (node2.callee.type !== "MemberExpression") return false;
|
|
460
|
+
if (node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy") {
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
node2 = node2.callee.object;
|
|
464
|
+
}
|
|
465
|
+
return false;
|
|
466
|
+
}
|
|
467
|
+
function getPreviousInChain(node2) {
|
|
468
|
+
return node2.type === "CallExpression" && node2.callee.type === "MemberExpression" && node2.callee.object.type === "CallExpression" && node2.callee.object.callee.type === "MemberExpression" && node2.callee.object.callee.property.type === "Identifier" && node2.callee.object.callee.property.name;
|
|
469
|
+
}
|
|
470
|
+
function getCallExpressionCypressCommand(node2) {
|
|
471
|
+
return isRootCypress(node2) && node2.callee.property.type === "Identifier" && node2.callee.property.name;
|
|
472
|
+
}
|
|
473
|
+
function isCallingCyScreenshot(node2) {
|
|
474
|
+
return getCallExpressionCypressCommand(node2) === "screenshot";
|
|
475
|
+
}
|
|
476
|
+
function getPreviousCypressCommand(node2) {
|
|
477
|
+
const previousInChain = getPreviousInChain(node2);
|
|
478
|
+
if (previousInChain) {
|
|
479
|
+
return previousInChain;
|
|
480
|
+
}
|
|
481
|
+
while (node2.parent && !node2.parent.body) {
|
|
482
|
+
node2 = node2.parent;
|
|
483
|
+
}
|
|
484
|
+
if (!node2.parent || !node2.parent.body) return null;
|
|
485
|
+
const body = node2.parent.body.type === "BlockStatement" ? node2.parent.body.body : node2.parent.body;
|
|
486
|
+
const index = body.indexOf(node2);
|
|
487
|
+
if (index < 0) return null;
|
|
488
|
+
if (index === 0) return getPreviousCypressCommand(node2.parent);
|
|
489
|
+
const previousStatement = body[index - 1];
|
|
490
|
+
if (previousStatement.type !== "ExpressionStatement" || previousStatement.expression.type !== "CallExpression") {
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
return getCallExpressionCypressCommand(previousStatement.expression);
|
|
494
|
+
}
|
|
495
|
+
function isPreviousAnAssertion(node2) {
|
|
496
|
+
const previousCypressCommand = getPreviousCypressCommand(node2);
|
|
497
|
+
return assertionCommands.indexOf(previousCypressCommand) >= 0;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
// node_modules/eslint-plugin-cypress/lib/rules/require-data-selectors.js
|
|
503
|
+
var require_require_data_selectors = __commonJS({
|
|
504
|
+
"node_modules/eslint-plugin-cypress/lib/rules/require-data-selectors.js"(exports, module) {
|
|
505
|
+
"use strict";
|
|
506
|
+
init_esm_shims();
|
|
507
|
+
module.exports = {
|
|
508
|
+
meta: {
|
|
509
|
+
type: "suggestion",
|
|
510
|
+
docs: {
|
|
511
|
+
description: "require `data-*` attribute selectors",
|
|
512
|
+
category: "Possible Errors",
|
|
513
|
+
recommended: false,
|
|
514
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/require-data-selectors.md"
|
|
515
|
+
},
|
|
516
|
+
schema: [],
|
|
517
|
+
messages: {
|
|
518
|
+
unexpected: "use data-* attribute selectors instead of classes or tag names"
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
create(context) {
|
|
522
|
+
return {
|
|
523
|
+
CallExpression(node2) {
|
|
524
|
+
if (isCallingCyGet(node2) && !isDataArgument(node2)) {
|
|
525
|
+
context.report({ node: node2, messageId: "unexpected" });
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
function isCallingCyGet(node2) {
|
|
532
|
+
return node2.callee.type === "MemberExpression" && node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy" && node2.callee.property.type === "Identifier" && node2.callee.property.name === "get";
|
|
533
|
+
}
|
|
534
|
+
function isDataArgument(node2) {
|
|
535
|
+
return node2.arguments.length > 0 && (node2.arguments[0].type === "Literal" && isAliasOrDataSelector(String(node2.arguments[0].value)) || node2.arguments[0].type === "TemplateLiteral" && isAliasOrDataSelector(String(node2.arguments[0].quasis[0].value.cooked)));
|
|
536
|
+
}
|
|
537
|
+
function isAliasOrDataSelector(selector) {
|
|
538
|
+
return ["[data-", "@"].some(function(validValue) {
|
|
539
|
+
return selector.startsWith(validValue);
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
// node_modules/eslint-plugin-cypress/lib/rules/no-force.js
|
|
546
|
+
var require_no_force = __commonJS({
|
|
547
|
+
"node_modules/eslint-plugin-cypress/lib/rules/no-force.js"(exports, module) {
|
|
548
|
+
"use strict";
|
|
549
|
+
init_esm_shims();
|
|
550
|
+
module.exports = {
|
|
551
|
+
meta: {
|
|
552
|
+
type: "suggestion",
|
|
553
|
+
docs: {
|
|
554
|
+
description: "disallow using `force: true` with action commands",
|
|
555
|
+
category: "Possible Errors",
|
|
556
|
+
recommended: false,
|
|
557
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-force.md"
|
|
558
|
+
},
|
|
559
|
+
fixable: null,
|
|
560
|
+
// or "code" or "whitespace"
|
|
561
|
+
schema: [],
|
|
562
|
+
messages: {
|
|
563
|
+
unexpected: "Do not use force on click and type calls"
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
create(context) {
|
|
567
|
+
function isCallingClickOrType(node2) {
|
|
568
|
+
const allowedMethods = ["click", "dblclick", "type", "trigger", "check", "rightclick", "focus", "select"];
|
|
569
|
+
return node2.property && node2.property.type === "Identifier" && allowedMethods.includes(node2.property.name);
|
|
570
|
+
}
|
|
571
|
+
function isCypressCall(node2) {
|
|
572
|
+
return node2.callee.type === "MemberExpression" && node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy";
|
|
573
|
+
}
|
|
574
|
+
function hasOptionForce(node2) {
|
|
575
|
+
return node2.arguments && node2.arguments.length && node2.arguments.some((arg) => {
|
|
576
|
+
return arg.type === "ObjectExpression" && arg.properties.some((propNode) => propNode.key && propNode.key.name === "force");
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
function deepCheck(node2, checkFunc) {
|
|
580
|
+
let currentNode = node2;
|
|
581
|
+
while (currentNode.parent) {
|
|
582
|
+
if (checkFunc(currentNode.parent)) {
|
|
583
|
+
return true;
|
|
584
|
+
}
|
|
585
|
+
currentNode = currentNode.parent;
|
|
586
|
+
}
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
return {
|
|
590
|
+
CallExpression(node2) {
|
|
591
|
+
if (isCypressCall(node2) && deepCheck(node2, isCallingClickOrType) && deepCheck(node2, hasOptionForce)) {
|
|
592
|
+
context.report({ node: node2, messageId: "unexpected" });
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
// node_modules/eslint-plugin-cypress/lib/rules/no-pause.js
|
|
602
|
+
var require_no_pause = __commonJS({
|
|
603
|
+
"node_modules/eslint-plugin-cypress/lib/rules/no-pause.js"(exports, module) {
|
|
604
|
+
"use strict";
|
|
605
|
+
init_esm_shims();
|
|
606
|
+
module.exports = {
|
|
607
|
+
meta: {
|
|
608
|
+
type: "suggestion",
|
|
609
|
+
docs: {
|
|
610
|
+
description: "disallow using `cy.pause()` calls",
|
|
611
|
+
category: "Possible Errors",
|
|
612
|
+
recommended: false,
|
|
613
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-pause.md"
|
|
614
|
+
},
|
|
615
|
+
fixable: null,
|
|
616
|
+
// or "code" or "whitespace"
|
|
617
|
+
schema: [],
|
|
618
|
+
messages: {
|
|
619
|
+
unexpected: "Do not use cy.pause command"
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
create(context) {
|
|
623
|
+
function isCallingPause(node2) {
|
|
624
|
+
return node2.callee && node2.callee.property && node2.callee.property.type === "Identifier" && node2.callee.property.name === "pause";
|
|
625
|
+
}
|
|
626
|
+
function isCypressCall(node2) {
|
|
627
|
+
if (!node2.callee || node2.callee.type !== "MemberExpression") {
|
|
628
|
+
return false;
|
|
629
|
+
}
|
|
630
|
+
if (node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy") {
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
return isCypressCall(node2.callee.object);
|
|
634
|
+
}
|
|
635
|
+
return {
|
|
636
|
+
CallExpression(node2) {
|
|
637
|
+
if (isCypressCall(node2) && isCallingPause(node2)) {
|
|
638
|
+
context.report({ node: node2, messageId: "unexpected" });
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
// node_modules/eslint-plugin-cypress/lib/rules/no-debug.js
|
|
648
|
+
var require_no_debug = __commonJS({
|
|
649
|
+
"node_modules/eslint-plugin-cypress/lib/rules/no-debug.js"(exports, module) {
|
|
650
|
+
"use strict";
|
|
651
|
+
init_esm_shims();
|
|
652
|
+
module.exports = {
|
|
653
|
+
meta: {
|
|
654
|
+
type: "suggestion",
|
|
655
|
+
docs: {
|
|
656
|
+
description: "disallow using `cy.debug()` calls",
|
|
657
|
+
category: "Possible Errors",
|
|
658
|
+
recommended: false,
|
|
659
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-debug.md"
|
|
660
|
+
},
|
|
661
|
+
fixable: null,
|
|
662
|
+
// or "code" or "whitespace"
|
|
663
|
+
schema: [],
|
|
664
|
+
messages: {
|
|
665
|
+
unexpected: "Do not use cy.debug command"
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
create(context) {
|
|
669
|
+
function isCallingDebug(node2) {
|
|
670
|
+
return node2.callee && node2.callee.property && node2.callee.property.type === "Identifier" && node2.callee.property.name === "debug";
|
|
671
|
+
}
|
|
672
|
+
function isCypressCall(node2) {
|
|
673
|
+
if (!node2.callee || node2.callee.type !== "MemberExpression") {
|
|
674
|
+
return false;
|
|
675
|
+
}
|
|
676
|
+
if (node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy") {
|
|
677
|
+
return true;
|
|
678
|
+
}
|
|
679
|
+
return isCypressCall(node2.callee.object);
|
|
680
|
+
}
|
|
681
|
+
return {
|
|
682
|
+
CallExpression(node2) {
|
|
683
|
+
if (isCypressCall(node2) && isCallingDebug(node2)) {
|
|
684
|
+
context.report({ node: node2, messageId: "unexpected" });
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
// node_modules/eslint-plugin-cypress/lib/rules/no-xpath.js
|
|
694
|
+
var require_no_xpath = __commonJS({
|
|
695
|
+
"node_modules/eslint-plugin-cypress/lib/rules/no-xpath.js"(exports, module) {
|
|
696
|
+
"use strict";
|
|
697
|
+
init_esm_shims();
|
|
698
|
+
module.exports = {
|
|
699
|
+
meta: {
|
|
700
|
+
type: "suggestion",
|
|
701
|
+
docs: {
|
|
702
|
+
description: "disallow using `cy.xpath()` calls",
|
|
703
|
+
recommended: false,
|
|
704
|
+
url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-xpath.md"
|
|
705
|
+
},
|
|
706
|
+
fixable: null,
|
|
707
|
+
// Or `code` or `whitespace`
|
|
708
|
+
schema: [],
|
|
709
|
+
// Add a schema if the rule has options
|
|
710
|
+
messages: {
|
|
711
|
+
unexpected: "Avoid using cy.xpath command"
|
|
712
|
+
}
|
|
713
|
+
},
|
|
714
|
+
create(context) {
|
|
715
|
+
return {
|
|
716
|
+
CallExpression(node2) {
|
|
717
|
+
if (isCallingCyXpath(node2)) {
|
|
718
|
+
context.report({ node: node2, messageId: "unexpected" });
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
function isCallingCyXpath(node2) {
|
|
725
|
+
return node2.callee.type === "MemberExpression" && node2.callee.object.type === "Identifier" && node2.callee.object.name === "cy" && node2.callee.property.type === "Identifier" && node2.callee.property.name === "xpath";
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
// node_modules/eslint-plugin-cypress/lib/flat.js
|
|
731
|
+
var require_flat = __commonJS({
|
|
732
|
+
"node_modules/eslint-plugin-cypress/lib/flat.js"(exports, module) {
|
|
733
|
+
"use strict";
|
|
734
|
+
init_esm_shims();
|
|
735
|
+
var globals2 = __require("globals");
|
|
736
|
+
var { name, version } = require_package();
|
|
737
|
+
var plugin4 = {
|
|
738
|
+
meta: { name, version },
|
|
739
|
+
configs: {},
|
|
740
|
+
rules: {
|
|
741
|
+
"no-assigning-return-values": require_no_assigning_return_values(),
|
|
742
|
+
"unsafe-to-chain-command": require_unsafe_to_chain_command(),
|
|
743
|
+
"no-unnecessary-waiting": require_no_unnecessary_waiting(),
|
|
744
|
+
"no-async-before": require_no_async_before(),
|
|
745
|
+
"no-async-tests": require_no_async_tests(),
|
|
746
|
+
"assertion-before-screenshot": require_assertion_before_screenshot(),
|
|
747
|
+
"require-data-selectors": require_require_data_selectors(),
|
|
748
|
+
"no-force": require_no_force(),
|
|
749
|
+
"no-pause": require_no_pause(),
|
|
750
|
+
"no-debug": require_no_debug(),
|
|
751
|
+
"no-xpath": require_no_xpath()
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
var commonGlobals = Object.assign({
|
|
755
|
+
cy: false,
|
|
756
|
+
Cypress: false,
|
|
757
|
+
expect: false,
|
|
758
|
+
assert: false,
|
|
759
|
+
chai: false
|
|
760
|
+
}, globals2.browser, globals2.mocha);
|
|
761
|
+
Object.assign(plugin4.configs, {
|
|
762
|
+
globals: {
|
|
763
|
+
name: "cypress/globals",
|
|
764
|
+
plugins: {
|
|
765
|
+
cypress: plugin4
|
|
766
|
+
},
|
|
767
|
+
languageOptions: {
|
|
768
|
+
globals: commonGlobals
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
Object.assign(plugin4.configs, {
|
|
773
|
+
recommended: {
|
|
774
|
+
name: "cypress/recommended",
|
|
775
|
+
plugins: {
|
|
776
|
+
cypress: plugin4
|
|
777
|
+
},
|
|
778
|
+
rules: {
|
|
779
|
+
"cypress/no-assigning-return-values": "error",
|
|
780
|
+
"cypress/no-unnecessary-waiting": "error",
|
|
781
|
+
"cypress/no-async-tests": "error",
|
|
782
|
+
"cypress/unsafe-to-chain-command": "error"
|
|
783
|
+
},
|
|
784
|
+
languageOptions: {
|
|
785
|
+
globals: commonGlobals
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
module.exports = plugin4;
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
// src/index.ts
|
|
794
|
+
init_esm_shims();
|
|
795
|
+
|
|
1
796
|
// src/factory.ts
|
|
797
|
+
init_esm_shims();
|
|
2
798
|
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
3
799
|
|
|
800
|
+
// src/configs/index.ts
|
|
801
|
+
init_esm_shims();
|
|
802
|
+
|
|
4
803
|
// src/configs/comments.ts
|
|
804
|
+
init_esm_shims();
|
|
5
805
|
import plugin from "@eslint-community/eslint-plugin-eslint-comments";
|
|
6
806
|
var NAMESPACE = "exbotanical/comments";
|
|
7
807
|
async function comments() {
|
|
@@ -23,7 +823,11 @@ async function comments() {
|
|
|
23
823
|
];
|
|
24
824
|
}
|
|
25
825
|
|
|
826
|
+
// src/configs/disables.ts
|
|
827
|
+
init_esm_shims();
|
|
828
|
+
|
|
26
829
|
// src/filepaths.ts
|
|
830
|
+
init_esm_shims();
|
|
27
831
|
var GLOB_JS = "**/*.?([cm])js";
|
|
28
832
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
29
833
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
@@ -118,8 +922,12 @@ async function disables() {
|
|
|
118
922
|
];
|
|
119
923
|
}
|
|
120
924
|
|
|
925
|
+
// src/configs/graphql.ts
|
|
926
|
+
init_esm_shims();
|
|
927
|
+
|
|
121
928
|
// src/utils.ts
|
|
122
|
-
|
|
929
|
+
init_esm_shims();
|
|
930
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
123
931
|
import { isPackageExists } from "local-pkg";
|
|
124
932
|
var parserPlain = {
|
|
125
933
|
meta: {
|
|
@@ -195,7 +1003,7 @@ var processorPassThrough = {
|
|
|
195
1003
|
return messages[0];
|
|
196
1004
|
}
|
|
197
1005
|
};
|
|
198
|
-
var scopeUrl =
|
|
1006
|
+
var scopeUrl = fileURLToPath2(new URL(".", import.meta.url));
|
|
199
1007
|
|
|
200
1008
|
// src/configs/graphql.ts
|
|
201
1009
|
async function graphql() {
|
|
@@ -217,14 +1025,16 @@ async function graphql() {
|
|
|
217
1025
|
plugins: {
|
|
218
1026
|
"@graphql-eslint": graphqlPlugin
|
|
219
1027
|
},
|
|
1028
|
+
// @ts-expect-error weird rule types in gql plugin
|
|
220
1029
|
rules
|
|
221
1030
|
}
|
|
222
1031
|
];
|
|
223
1032
|
}
|
|
224
1033
|
|
|
225
1034
|
// src/configs/ignores.ts
|
|
1035
|
+
init_esm_shims();
|
|
226
1036
|
var NAMESPACE3 = "exbotanical/ignores";
|
|
227
|
-
async function ignores(
|
|
1037
|
+
async function ignores(files = []) {
|
|
228
1038
|
return [
|
|
229
1039
|
{
|
|
230
1040
|
name: NAMESPACE3,
|
|
@@ -234,6 +1044,7 @@ async function ignores({ files = [] } = {}) {
|
|
|
234
1044
|
}
|
|
235
1045
|
|
|
236
1046
|
// src/configs/imports.ts
|
|
1047
|
+
init_esm_shims();
|
|
237
1048
|
import plugin2 from "eslint-plugin-import";
|
|
238
1049
|
var NAMESPACE4 = "exbotanical/imports";
|
|
239
1050
|
async function imports() {
|
|
@@ -301,10 +1112,12 @@ async function imports() {
|
|
|
301
1112
|
}
|
|
302
1113
|
|
|
303
1114
|
// src/configs/javascript.ts
|
|
1115
|
+
init_esm_shims();
|
|
304
1116
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
305
1117
|
import globals from "globals";
|
|
306
1118
|
|
|
307
1119
|
// src/common.ts
|
|
1120
|
+
init_esm_shims();
|
|
308
1121
|
var VAR_IGNORE_PATTERN = "^_";
|
|
309
1122
|
|
|
310
1123
|
// src/configs/javascript.ts
|
|
@@ -576,6 +1389,7 @@ async function javascript({ overrides = {} } = {}) {
|
|
|
576
1389
|
}
|
|
577
1390
|
|
|
578
1391
|
// src/configs/jsdoc.ts
|
|
1392
|
+
init_esm_shims();
|
|
579
1393
|
var NAMESPACE6 = "exbotanical/jsdoc";
|
|
580
1394
|
async function jsdoc() {
|
|
581
1395
|
return [
|
|
@@ -607,7 +1421,11 @@ async function jsdoc() {
|
|
|
607
1421
|
];
|
|
608
1422
|
}
|
|
609
1423
|
|
|
1424
|
+
// src/configs/jsonc.ts
|
|
1425
|
+
init_esm_shims();
|
|
1426
|
+
|
|
610
1427
|
// src/defaults.ts
|
|
1428
|
+
init_esm_shims();
|
|
611
1429
|
var STYLE_DEFAULTS = {
|
|
612
1430
|
indent: 2,
|
|
613
1431
|
jsx: true,
|
|
@@ -691,6 +1509,7 @@ async function jsonc({
|
|
|
691
1509
|
}
|
|
692
1510
|
|
|
693
1511
|
// src/configs/jsx.ts
|
|
1512
|
+
init_esm_shims();
|
|
694
1513
|
var NAMESPACE8 = "exbotanical/jsx";
|
|
695
1514
|
async function jsx() {
|
|
696
1515
|
return [
|
|
@@ -709,6 +1528,7 @@ async function jsx() {
|
|
|
709
1528
|
}
|
|
710
1529
|
|
|
711
1530
|
// src/configs/markdown.ts
|
|
1531
|
+
init_esm_shims();
|
|
712
1532
|
var NAMESPACE9 = "exbotanical/markdown";
|
|
713
1533
|
async function markdown({
|
|
714
1534
|
files = [GLOB_MARKDOWN],
|
|
@@ -777,7 +1597,11 @@ async function markdown({
|
|
|
777
1597
|
];
|
|
778
1598
|
}
|
|
779
1599
|
|
|
1600
|
+
// src/configs/misc/index.ts
|
|
1601
|
+
init_esm_shims();
|
|
1602
|
+
|
|
780
1603
|
// src/configs/misc/perfectionist.ts
|
|
1604
|
+
init_esm_shims();
|
|
781
1605
|
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
782
1606
|
var NAMESPACE10 = "exbotanical/misc/perfectionist";
|
|
783
1607
|
async function perfectionist() {
|
|
@@ -825,6 +1649,7 @@ async function perfectionist() {
|
|
|
825
1649
|
}
|
|
826
1650
|
|
|
827
1651
|
// src/configs/misc/unicorn.ts
|
|
1652
|
+
init_esm_shims();
|
|
828
1653
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
829
1654
|
var NAMESPACE11 = "exbotanical/misc/unicorn";
|
|
830
1655
|
async function unicorn() {
|
|
@@ -839,13 +1664,18 @@ async function unicorn() {
|
|
|
839
1664
|
"unicorn/prevent-abbreviations": "off",
|
|
840
1665
|
"unicorn/no-null": "off",
|
|
841
1666
|
"unicorn/prefer-top-level-await": "off",
|
|
842
|
-
"unicorn/filename-case": "off"
|
|
1667
|
+
"unicorn/filename-case": "off",
|
|
1668
|
+
"unicorn/no-await-expression-member": "off",
|
|
1669
|
+
"unicorn/throw-new-error": "off",
|
|
1670
|
+
"unicorn/no-array-callback-reference": "off",
|
|
1671
|
+
"unicorn/no-new-array": "off"
|
|
843
1672
|
}
|
|
844
1673
|
}
|
|
845
1674
|
];
|
|
846
1675
|
}
|
|
847
1676
|
|
|
848
1677
|
// src/configs/node.ts
|
|
1678
|
+
init_esm_shims();
|
|
849
1679
|
import plugin3 from "eslint-plugin-n";
|
|
850
1680
|
var NAMESPACE12 = "exbotanical/node";
|
|
851
1681
|
async function node() {
|
|
@@ -869,6 +1699,7 @@ async function node() {
|
|
|
869
1699
|
}
|
|
870
1700
|
|
|
871
1701
|
// src/configs/package.json.ts
|
|
1702
|
+
init_esm_shims();
|
|
872
1703
|
var NAMESPACE13 = "exbotanical/package.json";
|
|
873
1704
|
async function packageJson() {
|
|
874
1705
|
return [
|
|
@@ -968,7 +1799,11 @@ async function packageJson() {
|
|
|
968
1799
|
];
|
|
969
1800
|
}
|
|
970
1801
|
|
|
1802
|
+
// src/configs/prettier.ts
|
|
1803
|
+
init_esm_shims();
|
|
1804
|
+
|
|
971
1805
|
// src/vendor/plugins/eslint-config-prettier.ts
|
|
1806
|
+
init_esm_shims();
|
|
972
1807
|
var specialRule = 0;
|
|
973
1808
|
var eslint_config_prettier_default = {
|
|
974
1809
|
rules: {
|
|
@@ -1264,6 +2099,7 @@ async function prettier() {
|
|
|
1264
2099
|
}
|
|
1265
2100
|
|
|
1266
2101
|
// src/configs/react.ts
|
|
2102
|
+
init_esm_shims();
|
|
1267
2103
|
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1268
2104
|
var REACT_REFRESH_ALLOW_CONSTANT_EXPORT_PACKAGES = ["vite"];
|
|
1269
2105
|
var REACT_ROUTER_PACKAGES = [
|
|
@@ -1407,6 +2243,7 @@ async function react({
|
|
|
1407
2243
|
}
|
|
1408
2244
|
|
|
1409
2245
|
// src/configs/regexpr.ts
|
|
2246
|
+
init_esm_shims();
|
|
1410
2247
|
import { configs } from "eslint-plugin-regexp";
|
|
1411
2248
|
var NAMESPACE15 = "exbotanical/regexpr";
|
|
1412
2249
|
async function regexpr({
|
|
@@ -1435,10 +2272,12 @@ async function regexpr({
|
|
|
1435
2272
|
}
|
|
1436
2273
|
|
|
1437
2274
|
// src/configs/test.ts
|
|
2275
|
+
init_esm_shims();
|
|
2276
|
+
var import_flat = __toESM(require_flat(), 1);
|
|
1438
2277
|
var PLUGIN_RUNNER_MAP = {
|
|
1439
2278
|
tap: [
|
|
1440
2279
|
"eslint-plugin-tap",
|
|
1441
|
-
{
|
|
2280
|
+
() => ({
|
|
1442
2281
|
"tap/assertion-message": ["error", "always"],
|
|
1443
2282
|
"tap/max-asserts": ["error", 8],
|
|
1444
2283
|
"tap/no-identical-title": "error",
|
|
@@ -1454,19 +2293,25 @@ var PLUGIN_RUNNER_MAP = {
|
|
|
1454
2293
|
"tap/use-t-well": "error",
|
|
1455
2294
|
"tap/use-t": "error",
|
|
1456
2295
|
"tap/use-tap": "error"
|
|
1457
|
-
}
|
|
2296
|
+
})
|
|
1458
2297
|
],
|
|
1459
2298
|
vitest: [
|
|
1460
2299
|
"@vitest/eslint-plugin",
|
|
1461
|
-
{
|
|
1462
|
-
|
|
1463
|
-
}
|
|
2300
|
+
(plugin4) => ({
|
|
2301
|
+
...plugin4.configs.recommended.rules
|
|
2302
|
+
})
|
|
1464
2303
|
],
|
|
1465
|
-
jest: [
|
|
2304
|
+
jest: [
|
|
2305
|
+
"eslint-plugin-jest",
|
|
2306
|
+
(plugin4) => ({
|
|
2307
|
+
...plugin4.configs["flat/recommended"].rules
|
|
2308
|
+
})
|
|
2309
|
+
]
|
|
1466
2310
|
};
|
|
1467
2311
|
var NAMESPACE16 = "exbotanical/test";
|
|
1468
2312
|
async function test({
|
|
1469
2313
|
runner = "vitest",
|
|
2314
|
+
cypress = false,
|
|
1470
2315
|
files = GLOB_TESTS,
|
|
1471
2316
|
overrides = {}
|
|
1472
2317
|
}) {
|
|
@@ -1476,6 +2321,14 @@ async function test({
|
|
|
1476
2321
|
// @ts-expect-error no types
|
|
1477
2322
|
interopDefault(import("eslint-plugin-no-only-tests"))
|
|
1478
2323
|
]);
|
|
2324
|
+
const extraConfigs = [];
|
|
2325
|
+
if (cypress) {
|
|
2326
|
+
extraConfigs.push({
|
|
2327
|
+
name: `${NAMESPACE16}/cypress/rules`,
|
|
2328
|
+
...import_flat.default.configs.recommended,
|
|
2329
|
+
...typeof cypress === "boolean" ? {} : cypress
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
1479
2332
|
return [
|
|
1480
2333
|
{
|
|
1481
2334
|
name: `${NAMESPACE16}/setup`,
|
|
@@ -1483,23 +2336,32 @@ async function test({
|
|
|
1483
2336
|
test: {
|
|
1484
2337
|
...pluginRunner,
|
|
1485
2338
|
rules: {
|
|
1486
|
-
...rules,
|
|
1487
|
-
...
|
|
2339
|
+
...pluginNoOnlyTests.rules,
|
|
2340
|
+
...rules(pluginRunner)
|
|
1488
2341
|
}
|
|
1489
2342
|
}
|
|
1490
2343
|
}
|
|
1491
2344
|
},
|
|
2345
|
+
runner === "jest" ? {
|
|
2346
|
+
name: `${NAMESPACE16}/jest`,
|
|
2347
|
+
...pluginRunner.configs["flat/recommended"],
|
|
2348
|
+
rules: {
|
|
2349
|
+
...pluginRunner.configs["flat/recommended"].rules
|
|
2350
|
+
}
|
|
2351
|
+
} : {},
|
|
1492
2352
|
{
|
|
1493
2353
|
name: `${NAMESPACE16}/rules`,
|
|
1494
2354
|
files,
|
|
1495
2355
|
rules: {
|
|
1496
2356
|
...overrides
|
|
1497
2357
|
}
|
|
1498
|
-
}
|
|
2358
|
+
},
|
|
2359
|
+
...extraConfigs
|
|
1499
2360
|
];
|
|
1500
2361
|
}
|
|
1501
2362
|
|
|
1502
2363
|
// src/configs/toml.ts
|
|
2364
|
+
init_esm_shims();
|
|
1503
2365
|
var NAMESPACE17 = "exbotanical/toml";
|
|
1504
2366
|
async function toml({ files = [GLOB_TOML], overrides = {} } = {}, { indent } = STYLE_DEFAULTS) {
|
|
1505
2367
|
const [plugin4, parser] = await Promise.all([
|
|
@@ -1547,6 +2409,7 @@ async function toml({ files = [GLOB_TOML], overrides = {} } = {}, { indent } = S
|
|
|
1547
2409
|
}
|
|
1548
2410
|
|
|
1549
2411
|
// src/configs/tsconfig.ts
|
|
2412
|
+
init_esm_shims();
|
|
1550
2413
|
var NAMESPACE18 = "exbotanical/tsconfig";
|
|
1551
2414
|
async function tsconfig() {
|
|
1552
2415
|
return [
|
|
@@ -1676,6 +2539,7 @@ async function tsconfig() {
|
|
|
1676
2539
|
}
|
|
1677
2540
|
|
|
1678
2541
|
// src/configs/typescript.ts
|
|
2542
|
+
init_esm_shims();
|
|
1679
2543
|
var NAMESPACE19 = "exbotanical/typescript";
|
|
1680
2544
|
async function typescript(options = {}) {
|
|
1681
2545
|
const {
|
|
@@ -1844,6 +2708,7 @@ async function typescript(options = {}) {
|
|
|
1844
2708
|
}
|
|
1845
2709
|
|
|
1846
2710
|
// src/configs/vue.ts
|
|
2711
|
+
init_esm_shims();
|
|
1847
2712
|
var NAMESPACE20 = "exbotanical/vue";
|
|
1848
2713
|
async function vue({
|
|
1849
2714
|
files = [GLOB_VUE],
|
|
@@ -2014,6 +2879,7 @@ async function vue({
|
|
|
2014
2879
|
}
|
|
2015
2880
|
|
|
2016
2881
|
// src/configs/yaml.ts
|
|
2882
|
+
init_esm_shims();
|
|
2017
2883
|
var NAMESPACE21 = "exbotanical/yaml";
|
|
2018
2884
|
async function yaml({ files = [GLOB_YAML], overrides = {} } = {}, { indent, quotes } = STYLE_DEFAULTS) {
|
|
2019
2885
|
const [plugin4, parser] = await Promise.all([
|
|
@@ -2133,7 +2999,7 @@ async function exbotanical({
|
|
|
2133
2999
|
if (formatter) {
|
|
2134
3000
|
configs2.push(prettier());
|
|
2135
3001
|
}
|
|
2136
|
-
configs2.push(disables(), ignores(
|
|
3002
|
+
configs2.push(disables(), ignores(optionsIgnore));
|
|
2137
3003
|
if (userConfigs.length > 0) {
|
|
2138
3004
|
const resolved2 = await Promise.all(userConfigs);
|
|
2139
3005
|
configs2.push(...resolved2.map((r) => Promise.resolve(Array.isArray(r) ? r : [r])));
|
|
@@ -2145,6 +3011,12 @@ function factoryConfig(options) {
|
|
|
2145
3011
|
if (!options) return {};
|
|
2146
3012
|
return typeof options === "boolean" ? {} : options;
|
|
2147
3013
|
}
|
|
3014
|
+
|
|
3015
|
+
// src/options.ts
|
|
3016
|
+
init_esm_shims();
|
|
3017
|
+
|
|
3018
|
+
// src/types.ts
|
|
3019
|
+
init_esm_shims();
|
|
2148
3020
|
export {
|
|
2149
3021
|
exbotanical as default
|
|
2150
3022
|
};
|