@lvce-editor/eslint-plugin-e2e 18.6.0 → 18.7.0

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.
Files changed (2) hide show
  1. package/dist/index.js +71 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const meta$d = {
1
+ const meta$e = {
2
2
  docs: {
3
3
  description: 'Disallow direct click calls in E2E tests'
4
4
  },
@@ -10,7 +10,7 @@ const meta$d = {
10
10
  const isDirectClickCall = node => {
11
11
  return node.callee.type === 'MemberExpression' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'click';
12
12
  };
13
- const create$d = context => {
13
+ const create$e = context => {
14
14
  return {
15
15
  CallExpression(node) {
16
16
  if (!isDirectClickCall(node)) {
@@ -26,11 +26,11 @@ const create$d = context => {
26
26
 
27
27
  const noDirectClick = {
28
28
  __proto__: null,
29
- create: create$d,
30
- meta: meta$d
29
+ create: create$e,
30
+ meta: meta$e
31
31
  };
32
32
 
33
- const meta$c = {
33
+ const meta$d = {
34
34
  docs: {
35
35
  description: 'Disallow disabling the memory clipboard in finally blocks'
36
36
  },
@@ -57,7 +57,7 @@ const isInFinallyBlock = (context, node) => {
57
57
  return finalizer !== null && finalizer !== undefined && ancestors.includes(finalizer);
58
58
  });
59
59
  };
60
- const create$c = context => {
60
+ const create$d = context => {
61
61
  return {
62
62
  CallExpression(node) {
63
63
  if (!isDisableMemoryClipBoardCall(node) || !isInFinallyBlock(context, node)) {
@@ -73,12 +73,12 @@ const create$c = context => {
73
73
 
74
74
  const noDisableMemoryClipBoardInFinally = {
75
75
  __proto__: null,
76
- create: create$c,
77
- meta: meta$c
76
+ create: create$d,
77
+ meta: meta$d
78
78
  };
79
79
 
80
80
  const allowedTypeImportSource = '@lvce-editor/test-with-playwright';
81
- const meta$b = {
81
+ const meta$c = {
82
82
  docs: {
83
83
  description: 'Disallow imports in e2e tests except type imports from @lvce-editor/test-with-playwright'
84
84
  },
@@ -96,7 +96,7 @@ const isAllowedTypeImport = node => {
96
96
  }
97
97
  return node.specifiers.length > 0 && node.specifiers.every(specifier => specifier.importKind === 'type');
98
98
  };
99
- const create$b = context => {
99
+ const create$c = context => {
100
100
  return {
101
101
  ImportDeclaration(node) {
102
102
  if (isAllowedTypeImport(node)) {
@@ -112,11 +112,11 @@ const create$b = context => {
112
112
 
113
113
  const noImports = {
114
114
  __proto__: null,
115
- create: create$b,
116
- meta: meta$b
115
+ create: create$c,
116
+ meta: meta$c
117
117
  };
118
118
 
119
- const meta$a = {
119
+ const meta$b = {
120
120
  docs: {
121
121
  description: 'Disallow inline import.meta.resolve calls in Main.openUri calls'
122
122
  },
@@ -137,7 +137,7 @@ const isImportMetaResolveCall = node => {
137
137
  const isMainOpenUriCall = node => {
138
138
  return node.callee.type === 'MemberExpression' && !node.callee.computed && isIdentifier$3(node.callee.object, 'Main') && isIdentifier$3(node.callee.property, 'openUri');
139
139
  };
140
- const create$a = context => {
140
+ const create$b = context => {
141
141
  return {
142
142
  CallExpression(node) {
143
143
  const [uri] = node.arguments;
@@ -154,11 +154,11 @@ const create$a = context => {
154
154
 
155
155
  const noInlineImportMetaResolveInOpenUri = {
156
156
  __proto__: null,
157
- create: create$a,
158
- meta: meta$a
157
+ create: create$b,
158
+ meta: meta$b
159
159
  };
160
160
 
161
- const meta$9 = {
161
+ const meta$a = {
162
162
  docs: {
163
163
  description: 'Disallow inline locator expressions inside expect calls'
164
164
  },
@@ -215,7 +215,7 @@ const containsInlineLocatorCall = node => {
215
215
  const isExpectCall$2 = node => {
216
216
  return node.callee.type === 'Identifier' && node.callee.name === 'expect';
217
217
  };
218
- const create$9 = context => {
218
+ const create$a = context => {
219
219
  return {
220
220
  CallExpression(node) {
221
221
  if (!isExpectCall$2(node)) {
@@ -235,11 +235,11 @@ const create$9 = context => {
235
235
 
236
236
  const noInlineLocatorInExpect = {
237
237
  __proto__: null,
238
- create: create$9,
239
- meta: meta$9
238
+ create: create$a,
239
+ meta: meta$a
240
240
  };
241
241
 
242
- const meta$8 = {
242
+ const meta$9 = {
243
243
  docs: {
244
244
  description: 'Disallow inline nth locator expressions inside expect calls'
245
245
  },
@@ -302,7 +302,7 @@ const containsInlineNthCall = node => {
302
302
  const isExpectCall$1 = node => {
303
303
  return node.callee.type === 'Identifier' && node.callee.name === 'expect';
304
304
  };
305
- const create$8 = context => {
305
+ const create$9 = context => {
306
306
  return {
307
307
  CallExpression(node) {
308
308
  if (!isExpectCall$1(node)) {
@@ -322,11 +322,11 @@ const create$8 = context => {
322
322
 
323
323
  const noInlineNthInExpect = {
324
324
  __proto__: null,
325
- create: create$8,
326
- meta: meta$8
325
+ create: create$9,
326
+ meta: meta$9
327
327
  };
328
328
 
329
- const meta$7 = {
329
+ const meta$8 = {
330
330
  docs: {
331
331
  description: 'Disallow lazy nth-based variable names for locator variables'
332
332
  },
@@ -387,7 +387,7 @@ const containsNthCall = node => {
387
387
  const hasLazyNthVariableName = node => {
388
388
  return isIdentifierNode$1(node) && lazyNthVariableNamePattern.test(node.name);
389
389
  };
390
- const create$7 = context => {
390
+ const create$8 = context => {
391
391
  return {
392
392
  VariableDeclarator(node) {
393
393
  if (!isVariableDeclaratorNode$1(node)) {
@@ -409,11 +409,11 @@ const create$7 = context => {
409
409
 
410
410
  const noLazyNthVariableName = {
411
411
  __proto__: null,
412
- create: create$7,
413
- meta: meta$7
412
+ create: create$8,
413
+ meta: meta$8
414
414
  };
415
415
 
416
- const meta$6 = {
416
+ const meta$7 = {
417
417
  docs: {
418
418
  description: 'Disallow clicking context menu item locators directly in E2E tests'
419
419
  },
@@ -435,7 +435,7 @@ const isMenuItemLocatorCall = node => {
435
435
  const isClickCall = node => {
436
436
  return node.callee.type === 'MemberExpression' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'click';
437
437
  };
438
- const create$6 = context => {
438
+ const create$7 = context => {
439
439
  const menuItemLocators = new Set();
440
440
  return {
441
441
  CallExpression(node) {
@@ -460,11 +460,11 @@ const create$6 = context => {
460
460
 
461
461
  const noMenuItemClick = {
462
462
  __proto__: null,
463
- create: create$6,
464
- meta: meta$6
463
+ create: create$7,
464
+ meta: meta$7
465
465
  };
466
466
 
467
- const meta$5 = {
467
+ const meta$6 = {
468
468
  docs: {
469
469
  description: 'Disallow exporting skip with a value of zero'
470
470
  },
@@ -494,7 +494,7 @@ const getRemovalRange = (node, sourceCode) => {
494
494
  const trailingLineBreaks = /^(?:[\t ]*\r?\n)+/.exec(sourceCode.text.slice(node.range[1]))?.[0].length ?? 0;
495
495
  return [node.range[0], node.range[1] + trailingLineBreaks];
496
496
  };
497
- const create$5 = context => {
497
+ const create$6 = context => {
498
498
  const {
499
499
  sourceCode
500
500
  } = context;
@@ -516,6 +516,41 @@ const create$5 = context => {
516
516
  };
517
517
 
518
518
  const noSkipZero = {
519
+ __proto__: null,
520
+ create: create$6,
521
+ meta: meta$6
522
+ };
523
+
524
+ const meta$5 = {
525
+ docs: {
526
+ description: 'Disallow timeouts in E2E tests'
527
+ },
528
+ messages: {
529
+ noTimeouts: 'Do not use setTimeout in e2e tests. Wait for an observable condition instead.'
530
+ },
531
+ type: 'problem'
532
+ };
533
+ const isSetTimeoutCall = node => {
534
+ if (node.callee.type === 'Identifier') {
535
+ return node.callee.name === 'setTimeout';
536
+ }
537
+ return node.callee.type === 'MemberExpression' && !node.callee.computed && node.callee.property.type === 'Identifier' && node.callee.property.name === 'setTimeout';
538
+ };
539
+ const create$5 = context => {
540
+ return {
541
+ CallExpression(node) {
542
+ if (!isSetTimeoutCall(node)) {
543
+ return;
544
+ }
545
+ context.report({
546
+ messageId: 'noTimeouts',
547
+ node: node.callee
548
+ });
549
+ }
550
+ };
551
+ };
552
+
553
+ const noTimeouts = {
519
554
  __proto__: null,
520
555
  create: create$5,
521
556
  meta: meta$5
@@ -797,6 +832,7 @@ const plugin = {
797
832
  'no-lazy-nth-variable-name': noLazyNthVariableName,
798
833
  'no-menu-item-click': noMenuItemClick,
799
834
  'no-skip-zero': noSkipZero,
835
+ 'no-timeouts': noTimeouts,
800
836
  'prefer-direct-api-destructuring': preferDirectApiDestructuring,
801
837
  'prefer-execute-extension-command': preferExecuteExtensionCommand,
802
838
  'prefer-filesystem-set-files': preferFileSystemSetFiles,
@@ -819,6 +855,7 @@ const recommended = [{
819
855
  'e2e/no-lazy-nth-variable-name': 'error',
820
856
  'e2e/no-menu-item-click': 'error',
821
857
  'e2e/no-skip-zero': 'error',
858
+ 'e2e/no-timeouts': 'error',
822
859
  'e2e/prefer-direct-api-destructuring': 'error',
823
860
  'e2e/prefer-execute-extension-command': 'error',
824
861
  'e2e/prefer-filesystem-set-files': 'error',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/eslint-plugin-e2e",
3
- "version": "18.6.0",
3
+ "version": "18.7.0",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",