@exbotanical/eslint-config 1.1.2 → 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.
@@ -1,750 +0,0 @@
1
- import {
2
- __commonJS,
3
- __dirname,
4
- __require,
5
- init_esm_shims
6
- } from "./chunk-6GNDNAEM.js";
7
-
8
- // node_modules/eslint-plugin-cypress/package.json
9
- var require_package = __commonJS({
10
- "node_modules/eslint-plugin-cypress/package.json"(exports, module) {
11
- module.exports = {
12
- name: "eslint-plugin-cypress",
13
- version: "4.2.0",
14
- description: "An ESLint plugin for projects using Cypress",
15
- main: "legacy.js",
16
- exports: {
17
- ".": "./legacy.js",
18
- "./flat": "./lib/flat.js"
19
- },
20
- author: "Cypress-io",
21
- license: "MIT",
22
- keywords: [
23
- "eslint",
24
- "eslintplugin",
25
- "cypress"
26
- ],
27
- repository: {
28
- type: "git",
29
- url: "git+https://github.com/cypress-io/eslint-plugin-cypress.git"
30
- },
31
- bugs: {
32
- url: "https://github.com/cypress-io/eslint-plugin-cypress/issues"
33
- },
34
- homepage: "https://github.com/cypress-io/eslint-plugin-cypress#readme",
35
- peerDependencies: {
36
- eslint: ">=9"
37
- },
38
- dependencies: {
39
- globals: "^15.11.0"
40
- },
41
- devDependencies: {
42
- eslint: "^9.13.0",
43
- "eslint-plugin-eslint-plugin": "^6.3.1",
44
- "eslint-plugin-mocha": "^10.5.0",
45
- husky: "^9.1.6",
46
- jest: "^29.7.0",
47
- "semantic-release": "24.2.0"
48
- },
49
- scripts: {
50
- lint: 'eslint "*.js" "**/**/*.js"',
51
- "lint-fix": "npm run lint -- --fix",
52
- "semantic-release": "semantic-release",
53
- start: "npm run test-watch",
54
- test: "jest",
55
- "test:legacy": "jest --config jest.config-legacy.js",
56
- "test-watch": "jest --watchAll",
57
- prepare: "husky"
58
- }
59
- };
60
- }
61
- });
62
-
63
- // node_modules/eslint-plugin-cypress/lib/rules/no-assigning-return-values.js
64
- var require_no_assigning_return_values = __commonJS({
65
- "node_modules/eslint-plugin-cypress/lib/rules/no-assigning-return-values.js"(exports, module) {
66
- "use strict";
67
- init_esm_shims();
68
- function get(obj, propertyString = "") {
69
- const properties = propertyString.split(".");
70
- for (let i = 0; i < properties.length; i++) {
71
- const value = (obj || {})[properties[i]];
72
- if (value == null) return value;
73
- obj = value;
74
- }
75
- return obj;
76
- }
77
- module.exports = {
78
- meta: {
79
- type: "problem",
80
- docs: {
81
- description: "disallow assigning return values of `cy` calls",
82
- category: "Possible Errors",
83
- recommended: true,
84
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-assigning-return-values.md"
85
- },
86
- schema: [],
87
- messages: {
88
- unexpected: "Do not assign the return value of a Cypress command"
89
- }
90
- },
91
- create(context) {
92
- return {
93
- VariableDeclaration(node) {
94
- if (node.declarations.some(isCypressCommandDeclaration)) {
95
- context.report({ node, messageId: "unexpected" });
96
- }
97
- }
98
- };
99
- }
100
- };
101
- var allowedCommands = {
102
- now: true,
103
- spy: true,
104
- state: true,
105
- stub: true
106
- };
107
- function isCypressCommandDeclaration(declarator) {
108
- let object = get(declarator, "init.callee.object");
109
- if (!object) return;
110
- while (object.callee) {
111
- object = object.callee.object;
112
- if (!object) return;
113
- }
114
- const commandName = get(declarator, "init.callee.property.name");
115
- const parent = get(object, "parent.property.name") || get(declarator, "id.name");
116
- if (commandName && (allowedCommands[commandName] || allowedCommands[parent])) return;
117
- return object.name === "cy";
118
- }
119
- }
120
- });
121
-
122
- // node_modules/eslint-plugin-cypress/lib/rules/unsafe-to-chain-command.js
123
- var require_unsafe_to_chain_command = __commonJS({
124
- "node_modules/eslint-plugin-cypress/lib/rules/unsafe-to-chain-command.js"(exports, module) {
125
- "use strict";
126
- init_esm_shims();
127
- var { basename } = __require("path");
128
- var NAME = basename(__dirname);
129
- var DESCRIPTION = "disallow actions within chains";
130
- var unsafeToChainActions = [
131
- "blur",
132
- "clear",
133
- "click",
134
- "check",
135
- "dblclick",
136
- "each",
137
- "focus",
138
- "rightclick",
139
- "screenshot",
140
- "scrollIntoView",
141
- "scrollTo",
142
- "select",
143
- "selectFile",
144
- "spread",
145
- "submit",
146
- "type",
147
- "trigger",
148
- "uncheck",
149
- "within"
150
- ];
151
- var schema = {
152
- title: NAME,
153
- description: DESCRIPTION,
154
- type: "object",
155
- properties: {
156
- methods: {
157
- type: "array",
158
- description: "An additional list of methods to check for unsafe chaining.",
159
- default: []
160
- }
161
- }
162
- };
163
- var getDefaultOptions = (context) => {
164
- return Object.entries(schema.properties).reduce((acc, [key, value]) => {
165
- if (!(value.default in value)) return acc;
166
- return {
167
- ...acc,
168
- [key]: value.default
169
- };
170
- }, context.options[0] || {});
171
- };
172
- module.exports = {
173
- meta: {
174
- type: "problem",
175
- docs: {
176
- description: DESCRIPTION,
177
- category: "Possible Errors",
178
- recommended: true,
179
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/unsafe-to-chain-command.md"
180
- },
181
- schema: [schema],
182
- messages: {
183
- 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."
184
- }
185
- },
186
- create(context) {
187
- const { methods } = getDefaultOptions(context);
188
- return {
189
- CallExpression(node) {
190
- if (isRootCypress(node) && isActionUnsafeToChain(node, methods) && node.parent.type === "MemberExpression") {
191
- context.report({
192
- node,
193
- messageId: "unexpected"
194
- });
195
- }
196
- }
197
- };
198
- }
199
- };
200
- var isRootCypress = (node) => {
201
- if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression") {
202
- return false;
203
- }
204
- if (node.callee.object.type === "Identifier" && node.callee.object.name === "cy") {
205
- return true;
206
- }
207
- return isRootCypress(node.callee.object);
208
- };
209
- var isActionUnsafeToChain = (node, additionalMethods = []) => {
210
- const unsafeActionsRegex = new RegExp([
211
- ...unsafeToChainActions.map((action) => `^${action}$`),
212
- ...additionalMethods.map((method) => method instanceof RegExp ? method.source : method)
213
- ].join("|"));
214
- return node.callee && node.callee.property && node.callee.property.type === "Identifier" && unsafeActionsRegex.test(node.callee.property.name);
215
- };
216
- }
217
- });
218
-
219
- // node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js
220
- var require_no_unnecessary_waiting = __commonJS({
221
- "node_modules/eslint-plugin-cypress/lib/rules/no-unnecessary-waiting.js"(exports, module) {
222
- "use strict";
223
- init_esm_shims();
224
- module.exports = {
225
- meta: {
226
- type: "problem",
227
- docs: {
228
- description: "disallow waiting for arbitrary time periods",
229
- category: "Possible Errors",
230
- recommended: true,
231
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-unnecessary-waiting.md"
232
- },
233
- schema: [],
234
- messages: {
235
- unexpected: "Do not wait for arbitrary time periods"
236
- }
237
- },
238
- create(context) {
239
- const sourceCode = context.sourceCode ?? context.getSourceCode();
240
- return {
241
- CallExpression(node) {
242
- if (isCallingCyWait(node)) {
243
- const scope = sourceCode.getScope ? sourceCode.getScope(node) : context.getScope();
244
- if (isIdentifierNumberConstArgument(node, scope) || isNumberArgument(node)) {
245
- context.report({ node, messageId: "unexpected" });
246
- }
247
- }
248
- }
249
- };
250
- }
251
- };
252
- function nodeIsCalledByCy(node) {
253
- if (node.type === "Identifier" && node.name === "cy") return true;
254
- if (typeof node.callee === "undefined" || typeof node.callee.object === "undefined") {
255
- return false;
256
- }
257
- return nodeIsCalledByCy(node.callee.object);
258
- }
259
- function isCallingCyWait(node) {
260
- return node.callee.type === "MemberExpression" && nodeIsCalledByCy(node) && node.callee.property.type === "Identifier" && node.callee.property.name === "wait";
261
- }
262
- function isNumberArgument(node) {
263
- return node.arguments.length > 0 && node.arguments[0].type === "Literal" && typeof node.arguments[0].value === "number";
264
- }
265
- function isIdentifierNumberConstArgument(node, scope) {
266
- if (node.arguments.length === 0) return false;
267
- if (node.arguments[0].type !== "Identifier") return false;
268
- const identifier = node.arguments[0];
269
- const resolvedIdentifier = scope.references.find((ref) => ref.identifier === identifier).resolved;
270
- const definition = resolvedIdentifier.defs[0];
271
- const isVariable = definition.type === "Variable";
272
- if (isVariable) {
273
- if (!definition.node.init) return false;
274
- return typeof definition.node.init.value === "number";
275
- }
276
- if (definition.type === "ImportBinding") return false;
277
- const param = definition.node.params[definition.index];
278
- if (!param || param.type !== "AssignmentPattern") return false;
279
- return typeof param.right.value === "number";
280
- }
281
- }
282
- });
283
-
284
- // node_modules/eslint-plugin-cypress/lib/rules/no-async-before.js
285
- var require_no_async_before = __commonJS({
286
- "node_modules/eslint-plugin-cypress/lib/rules/no-async-before.js"(exports, module) {
287
- "use strict";
288
- init_esm_shims();
289
- module.exports = {
290
- meta: {
291
- type: "problem",
292
- docs: {
293
- description: "disallow using `async`/`await` in Cypress `before` methods",
294
- category: "Possible Errors",
295
- recommended: true,
296
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-async-before.md"
297
- },
298
- schema: [],
299
- messages: {
300
- unexpected: "Avoid using async functions with Cypress before / beforeEach functions"
301
- }
302
- },
303
- create(context) {
304
- function isBeforeBlock(callExpressionNode) {
305
- const { type, name } = callExpressionNode.callee;
306
- return type === "Identifier" && name === "before" || name === "beforeEach";
307
- }
308
- function isBeforeAsync(node) {
309
- return node.arguments && node.arguments.length >= 2 && node.arguments[1].async === true;
310
- }
311
- const sourceCode = context.sourceCode ?? context.getSourceCode();
312
- return {
313
- Identifier(node) {
314
- if (node.name === "cy" || node.name === "Cypress") {
315
- const ancestors = sourceCode.getAncestors ? sourceCode.getAncestors(node) : context.getAncestors();
316
- const asyncTestBlocks = ancestors.filter((n) => n.type === "CallExpression").filter(isBeforeBlock).filter(isBeforeAsync);
317
- if (asyncTestBlocks.length >= 1) {
318
- asyncTestBlocks.forEach((node2) => {
319
- context.report({ node: node2, messageId: "unexpected" });
320
- });
321
- }
322
- }
323
- }
324
- };
325
- }
326
- };
327
- }
328
- });
329
-
330
- // node_modules/eslint-plugin-cypress/lib/rules/no-async-tests.js
331
- var require_no_async_tests = __commonJS({
332
- "node_modules/eslint-plugin-cypress/lib/rules/no-async-tests.js"(exports, module) {
333
- "use strict";
334
- init_esm_shims();
335
- module.exports = {
336
- meta: {
337
- type: "problem",
338
- docs: {
339
- description: "disallow using `async`/`await` in Cypress test cases",
340
- category: "Possible Errors",
341
- recommended: true,
342
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-async-tests.md"
343
- },
344
- schema: [],
345
- messages: {
346
- unexpected: "Avoid using async functions with Cypress tests"
347
- }
348
- },
349
- create(context) {
350
- function isTestBlock(callExpressionNode) {
351
- const { type, name } = callExpressionNode.callee;
352
- return type === "Identifier" && name === "it" || name === "test";
353
- }
354
- function isTestAsync(node) {
355
- return node.arguments && node.arguments.length >= 2 && node.arguments[1].async === true;
356
- }
357
- const sourceCode = context.sourceCode ?? context.getSourceCode();
358
- return {
359
- Identifier(node) {
360
- if (node.name === "cy" || node.name === "Cypress") {
361
- const ancestors = sourceCode.getAncestors ? sourceCode.getAncestors(node) : context.getAncestors();
362
- const asyncTestBlocks = ancestors.filter((n) => n.type === "CallExpression").filter(isTestBlock).filter(isTestAsync);
363
- if (asyncTestBlocks.length >= 1) {
364
- asyncTestBlocks.forEach((node2) => {
365
- context.report({ node: node2, messageId: "unexpected" });
366
- });
367
- }
368
- }
369
- }
370
- };
371
- }
372
- };
373
- }
374
- });
375
-
376
- // node_modules/eslint-plugin-cypress/lib/rules/assertion-before-screenshot.js
377
- var require_assertion_before_screenshot = __commonJS({
378
- "node_modules/eslint-plugin-cypress/lib/rules/assertion-before-screenshot.js"(exports, module) {
379
- "use strict";
380
- init_esm_shims();
381
- var assertionCommands = [
382
- // assertions
383
- "should",
384
- "and",
385
- "contains",
386
- // retries until it gets something
387
- "get",
388
- // not an assertion, but unlikely to require waiting for render
389
- "scrollIntoView",
390
- "scrollTo"
391
- ];
392
- module.exports = {
393
- meta: {
394
- type: "problem",
395
- docs: {
396
- description: "require screenshots to be preceded by an assertion",
397
- category: "Possible Errors",
398
- recommended: false,
399
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/assertion-before-screenshot.md"
400
- },
401
- schema: [],
402
- messages: {
403
- unexpected: "Make an assertion on the page state before taking a screenshot"
404
- }
405
- },
406
- create(context) {
407
- return {
408
- CallExpression(node) {
409
- if (isCallingCyScreenshot(node) && !isPreviousAnAssertion(node)) {
410
- context.report({ node, messageId: "unexpected" });
411
- }
412
- }
413
- };
414
- }
415
- };
416
- function isRootCypress(node) {
417
- while (node.type === "CallExpression") {
418
- if (node.callee.type !== "MemberExpression") return false;
419
- if (node.callee.object.type === "Identifier" && node.callee.object.name === "cy") {
420
- return true;
421
- }
422
- node = node.callee.object;
423
- }
424
- return false;
425
- }
426
- function getPreviousInChain(node) {
427
- return node.type === "CallExpression" && node.callee.type === "MemberExpression" && node.callee.object.type === "CallExpression" && node.callee.object.callee.type === "MemberExpression" && node.callee.object.callee.property.type === "Identifier" && node.callee.object.callee.property.name;
428
- }
429
- function getCallExpressionCypressCommand(node) {
430
- return isRootCypress(node) && node.callee.property.type === "Identifier" && node.callee.property.name;
431
- }
432
- function isCallingCyScreenshot(node) {
433
- return getCallExpressionCypressCommand(node) === "screenshot";
434
- }
435
- function getPreviousCypressCommand(node) {
436
- const previousInChain = getPreviousInChain(node);
437
- if (previousInChain) {
438
- return previousInChain;
439
- }
440
- while (node.parent && !node.parent.body) {
441
- node = node.parent;
442
- }
443
- if (!node.parent || !node.parent.body) return null;
444
- const body = node.parent.body.type === "BlockStatement" ? node.parent.body.body : node.parent.body;
445
- const index = body.indexOf(node);
446
- if (index < 0) return null;
447
- if (index === 0) return getPreviousCypressCommand(node.parent);
448
- const previousStatement = body[index - 1];
449
- if (previousStatement.type !== "ExpressionStatement" || previousStatement.expression.type !== "CallExpression") {
450
- return null;
451
- }
452
- return getCallExpressionCypressCommand(previousStatement.expression);
453
- }
454
- function isPreviousAnAssertion(node) {
455
- const previousCypressCommand = getPreviousCypressCommand(node);
456
- return assertionCommands.indexOf(previousCypressCommand) >= 0;
457
- }
458
- }
459
- });
460
-
461
- // node_modules/eslint-plugin-cypress/lib/rules/require-data-selectors.js
462
- var require_require_data_selectors = __commonJS({
463
- "node_modules/eslint-plugin-cypress/lib/rules/require-data-selectors.js"(exports, module) {
464
- "use strict";
465
- init_esm_shims();
466
- module.exports = {
467
- meta: {
468
- type: "suggestion",
469
- docs: {
470
- description: "require `data-*` attribute selectors",
471
- category: "Possible Errors",
472
- recommended: false,
473
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/require-data-selectors.md"
474
- },
475
- schema: [],
476
- messages: {
477
- unexpected: "use data-* attribute selectors instead of classes or tag names"
478
- }
479
- },
480
- create(context) {
481
- return {
482
- CallExpression(node) {
483
- if (isCallingCyGet(node) && !isDataArgument(node)) {
484
- context.report({ node, messageId: "unexpected" });
485
- }
486
- }
487
- };
488
- }
489
- };
490
- function isCallingCyGet(node) {
491
- return node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "cy" && node.callee.property.type === "Identifier" && node.callee.property.name === "get";
492
- }
493
- function isDataArgument(node) {
494
- return node.arguments.length > 0 && (node.arguments[0].type === "Literal" && isAliasOrDataSelector(String(node.arguments[0].value)) || node.arguments[0].type === "TemplateLiteral" && isAliasOrDataSelector(String(node.arguments[0].quasis[0].value.cooked)));
495
- }
496
- function isAliasOrDataSelector(selector) {
497
- return ["[data-", "@"].some(function(validValue) {
498
- return selector.startsWith(validValue);
499
- });
500
- }
501
- }
502
- });
503
-
504
- // node_modules/eslint-plugin-cypress/lib/rules/no-force.js
505
- var require_no_force = __commonJS({
506
- "node_modules/eslint-plugin-cypress/lib/rules/no-force.js"(exports, module) {
507
- "use strict";
508
- init_esm_shims();
509
- module.exports = {
510
- meta: {
511
- type: "suggestion",
512
- docs: {
513
- description: "disallow using `force: true` with action commands",
514
- category: "Possible Errors",
515
- recommended: false,
516
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-force.md"
517
- },
518
- fixable: null,
519
- // or "code" or "whitespace"
520
- schema: [],
521
- messages: {
522
- unexpected: "Do not use force on click and type calls"
523
- }
524
- },
525
- create(context) {
526
- function isCallingClickOrType(node) {
527
- const allowedMethods = ["click", "dblclick", "type", "trigger", "check", "rightclick", "focus", "select"];
528
- return node.property && node.property.type === "Identifier" && allowedMethods.includes(node.property.name);
529
- }
530
- function isCypressCall(node) {
531
- return node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "cy";
532
- }
533
- function hasOptionForce(node) {
534
- return node.arguments && node.arguments.length && node.arguments.some((arg) => {
535
- return arg.type === "ObjectExpression" && arg.properties.some((propNode) => propNode.key && propNode.key.name === "force");
536
- });
537
- }
538
- function deepCheck(node, checkFunc) {
539
- let currentNode = node;
540
- while (currentNode.parent) {
541
- if (checkFunc(currentNode.parent)) {
542
- return true;
543
- }
544
- currentNode = currentNode.parent;
545
- }
546
- return false;
547
- }
548
- return {
549
- CallExpression(node) {
550
- if (isCypressCall(node) && deepCheck(node, isCallingClickOrType) && deepCheck(node, hasOptionForce)) {
551
- context.report({ node, messageId: "unexpected" });
552
- }
553
- }
554
- };
555
- }
556
- };
557
- }
558
- });
559
-
560
- // node_modules/eslint-plugin-cypress/lib/rules/no-pause.js
561
- var require_no_pause = __commonJS({
562
- "node_modules/eslint-plugin-cypress/lib/rules/no-pause.js"(exports, module) {
563
- "use strict";
564
- init_esm_shims();
565
- module.exports = {
566
- meta: {
567
- type: "suggestion",
568
- docs: {
569
- description: "disallow using `cy.pause()` calls",
570
- category: "Possible Errors",
571
- recommended: false,
572
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-pause.md"
573
- },
574
- fixable: null,
575
- // or "code" or "whitespace"
576
- schema: [],
577
- messages: {
578
- unexpected: "Do not use cy.pause command"
579
- }
580
- },
581
- create(context) {
582
- function isCallingPause(node) {
583
- return node.callee && node.callee.property && node.callee.property.type === "Identifier" && node.callee.property.name === "pause";
584
- }
585
- function isCypressCall(node) {
586
- if (!node.callee || node.callee.type !== "MemberExpression") {
587
- return false;
588
- }
589
- if (node.callee.object.type === "Identifier" && node.callee.object.name === "cy") {
590
- return true;
591
- }
592
- return isCypressCall(node.callee.object);
593
- }
594
- return {
595
- CallExpression(node) {
596
- if (isCypressCall(node) && isCallingPause(node)) {
597
- context.report({ node, messageId: "unexpected" });
598
- }
599
- }
600
- };
601
- }
602
- };
603
- }
604
- });
605
-
606
- // node_modules/eslint-plugin-cypress/lib/rules/no-debug.js
607
- var require_no_debug = __commonJS({
608
- "node_modules/eslint-plugin-cypress/lib/rules/no-debug.js"(exports, module) {
609
- "use strict";
610
- init_esm_shims();
611
- module.exports = {
612
- meta: {
613
- type: "suggestion",
614
- docs: {
615
- description: "disallow using `cy.debug()` calls",
616
- category: "Possible Errors",
617
- recommended: false,
618
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-debug.md"
619
- },
620
- fixable: null,
621
- // or "code" or "whitespace"
622
- schema: [],
623
- messages: {
624
- unexpected: "Do not use cy.debug command"
625
- }
626
- },
627
- create(context) {
628
- function isCallingDebug(node) {
629
- return node.callee && node.callee.property && node.callee.property.type === "Identifier" && node.callee.property.name === "debug";
630
- }
631
- function isCypressCall(node) {
632
- if (!node.callee || node.callee.type !== "MemberExpression") {
633
- return false;
634
- }
635
- if (node.callee.object.type === "Identifier" && node.callee.object.name === "cy") {
636
- return true;
637
- }
638
- return isCypressCall(node.callee.object);
639
- }
640
- return {
641
- CallExpression(node) {
642
- if (isCypressCall(node) && isCallingDebug(node)) {
643
- context.report({ node, messageId: "unexpected" });
644
- }
645
- }
646
- };
647
- }
648
- };
649
- }
650
- });
651
-
652
- // node_modules/eslint-plugin-cypress/lib/rules/no-xpath.js
653
- var require_no_xpath = __commonJS({
654
- "node_modules/eslint-plugin-cypress/lib/rules/no-xpath.js"(exports, module) {
655
- "use strict";
656
- init_esm_shims();
657
- module.exports = {
658
- meta: {
659
- type: "suggestion",
660
- docs: {
661
- description: "disallow using `cy.xpath()` calls",
662
- recommended: false,
663
- url: "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-xpath.md"
664
- },
665
- fixable: null,
666
- // Or `code` or `whitespace`
667
- schema: [],
668
- // Add a schema if the rule has options
669
- messages: {
670
- unexpected: "Avoid using cy.xpath command"
671
- }
672
- },
673
- create(context) {
674
- return {
675
- CallExpression(node) {
676
- if (isCallingCyXpath(node)) {
677
- context.report({ node, messageId: "unexpected" });
678
- }
679
- }
680
- };
681
- }
682
- };
683
- function isCallingCyXpath(node) {
684
- return node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "cy" && node.callee.property.type === "Identifier" && node.callee.property.name === "xpath";
685
- }
686
- }
687
- });
688
-
689
- // node_modules/eslint-plugin-cypress/lib/flat.js
690
- var require_flat = __commonJS({
691
- "node_modules/eslint-plugin-cypress/lib/flat.js"(exports, module) {
692
- init_esm_shims();
693
- var globals = __require("globals");
694
- var { name, version } = require_package();
695
- var plugin = {
696
- meta: { name, version },
697
- configs: {},
698
- rules: {
699
- "no-assigning-return-values": require_no_assigning_return_values(),
700
- "unsafe-to-chain-command": require_unsafe_to_chain_command(),
701
- "no-unnecessary-waiting": require_no_unnecessary_waiting(),
702
- "no-async-before": require_no_async_before(),
703
- "no-async-tests": require_no_async_tests(),
704
- "assertion-before-screenshot": require_assertion_before_screenshot(),
705
- "require-data-selectors": require_require_data_selectors(),
706
- "no-force": require_no_force(),
707
- "no-pause": require_no_pause(),
708
- "no-debug": require_no_debug(),
709
- "no-xpath": require_no_xpath()
710
- }
711
- };
712
- var commonGlobals = Object.assign({
713
- cy: false,
714
- Cypress: false,
715
- expect: false,
716
- assert: false,
717
- chai: false
718
- }, globals.browser, globals.mocha);
719
- Object.assign(plugin.configs, {
720
- globals: {
721
- name: "cypress/globals",
722
- plugins: {
723
- cypress: plugin
724
- },
725
- languageOptions: {
726
- globals: commonGlobals
727
- }
728
- }
729
- });
730
- Object.assign(plugin.configs, {
731
- recommended: {
732
- name: "cypress/recommended",
733
- plugins: {
734
- cypress: plugin
735
- },
736
- rules: {
737
- "cypress/no-assigning-return-values": "error",
738
- "cypress/no-unnecessary-waiting": "error",
739
- "cypress/no-async-tests": "error",
740
- "cypress/unsafe-to-chain-command": "error"
741
- },
742
- languageOptions: {
743
- globals: commonGlobals
744
- }
745
- }
746
- });
747
- module.exports = plugin;
748
- }
749
- });
750
- export default require_flat();