eslint-plugin-wdio 7.19.4 → 7.20.8-alpha.504

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 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,UAgCpB,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,UAkCpB,CAAA"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MATCHERS = void 0;
4
- exports.MATCHERS = [
1
+ export const MATCHERS = [
5
2
  'toHaveTitle',
6
3
  'toHaveTitleContaining',
7
4
  'toHaveUrl',
@@ -11,7 +8,9 @@ exports.MATCHERS = [
11
8
  'toBeDisplayed',
12
9
  'toBeDisplayedInViewport',
13
10
  'toBeEnabled',
11
+ 'toExist',
14
12
  'toBeExisting',
13
+ 'toBePresent',
15
14
  'toBeFocused',
16
15
  'toBeSelected',
17
16
  'toHaveAttribute',
package/build/index.js CHANGED
@@ -1,18 +1,11 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.configs = exports.rules = void 0;
7
- const await_expect_1 = __importDefault(require("./rules/await-expect"));
8
- const no_debug_1 = __importDefault(require("./rules/no-debug"));
9
- const no_pause_1 = __importDefault(require("./rules/no-pause"));
1
+ import awaitExpect from './rules/await-expect.js';
2
+ import noDebug from './rules/no-debug.js';
3
+ import noPause from './rules/no-pause.js';
10
4
  const rules = {
11
- 'await-expect': await_expect_1.default,
12
- 'no-debug': no_debug_1.default,
13
- 'no-pause': no_pause_1.default
5
+ 'await-expect': awaitExpect,
6
+ 'no-debug': noDebug,
7
+ 'no-pause': noPause
14
8
  };
15
- exports.rules = rules;
16
9
  const configs = {
17
10
  recommended: {
18
11
  globals: {
@@ -30,4 +23,4 @@ const configs = {
30
23
  }
31
24
  }
32
25
  };
33
- exports.configs = configs;
26
+ export { rules, configs, };
@@ -1,13 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const constants_1 = require("../constants");
1
+ import { MATCHERS } from '../constants.js';
4
2
  const rule = {
5
3
  meta: {
6
4
  type: 'problem',
7
5
  docs: {
8
6
  description: 'expect must be prefixed with await',
9
7
  category: 'Possible Errors',
10
- url: 'https://github.com/webdriverio/packages/eslint-plugin-wdio/docs/rules/await-expect.md',
8
+ url: 'https://github.com/webdriverio/webdriverio/blob/main/packages/eslint-plugin-wdio/docs/rules/await-expect.md',
11
9
  recommended: false,
12
10
  },
13
11
  messages: {
@@ -25,7 +23,7 @@ const rule = {
25
23
  if (node.callee.type !== 'MemberExpression' ||
26
24
  node.callee.object.type !== 'CallExpression' ||
27
25
  node.callee.object.callee.name !== 'expect' ||
28
- !constants_1.MATCHERS.includes(node.callee.property.name)) {
26
+ !MATCHERS.includes(node.callee.property.name)) {
29
27
  return;
30
28
  }
31
29
  /**
@@ -43,4 +41,4 @@ const rule = {
43
41
  };
44
42
  }
45
43
  };
46
- exports.default = rule;
44
+ export default rule;
@@ -1,13 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const helpers_1 = require("../utils/helpers");
1
+ import { isCommand } from '../utils/helpers.js';
4
2
  const rule = {
5
3
  meta: {
6
4
  type: 'problem',
7
5
  docs: {
8
6
  description: 'Disallow browser.debug() in tests',
9
7
  category: 'Possible Errors',
10
- url: 'https://github.com/webdriverio/packages/eslint-plugin-wdio/docs/rules/no-debug.md',
8
+ url: 'https://github.com/webdriverio/webdriverio/blob/main/packages/eslint-plugin-wdio/docs/rules/no-debug.md',
11
9
  recommended: false,
12
10
  },
13
11
  messages: {
@@ -19,11 +17,11 @@ const rule = {
19
17
  create: function (context) {
20
18
  return {
21
19
  CallExpression(node) {
22
- if ((0, helpers_1.isCommand)(node, 'debug')) {
20
+ if (isCommand(node, 'debug')) {
23
21
  context.report({ node, messageId: 'unexpectedDebug' });
24
22
  }
25
23
  }
26
24
  };
27
25
  }
28
26
  };
29
- exports.default = rule;
27
+ export default rule;
@@ -1,13 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const helpers_1 = require("../utils/helpers");
1
+ import { isCommand } from '../utils/helpers.js';
4
2
  const rule = {
5
3
  meta: {
6
4
  type: 'problem',
7
5
  docs: {
8
6
  description: 'Disallow browser.pause() in tests',
9
7
  category: 'Possible Errors',
10
- url: 'https://github.com/webdriverio/packages/eslint-plugin-wdio/docs/rules/no-pause.md',
8
+ url: 'https://github.com/webdriverio/webdriverio/blob/main/packages/eslint-plugin-wdio/docs/rules/no-pause.md',
11
9
  recommended: false,
12
10
  },
13
11
  messages: {
@@ -19,11 +17,11 @@ const rule = {
19
17
  create: function (context) {
20
18
  return {
21
19
  CallExpression(node) {
22
- if ((0, helpers_1.isCommand)(node, 'pause')) {
20
+ if (isCommand(node, 'pause')) {
23
21
  context.report({ node, messageId: 'unexpectedPause' });
24
22
  }
25
23
  }
26
24
  };
27
25
  }
28
26
  };
29
- exports.default = rule;
27
+ export default rule;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,eAAwB,GAAG,WAAW,OAAO,GAAG,OAAO,KAAG,OAQ/E,CAAA"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAAwB,GAAG,WAAW,OAAO,GAAG,OAAO,KAAG,OAQ/E,CAAA"}
@@ -1,12 +1,6 @@
1
- "use strict";
2
- // import type { TSESTree } from '@typescript-eslint/utils'
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isCommand = void 0;
5
- const isCommand = function (expression, command) {
6
- var _a, _b;
7
- const callee = expression === null || expression === void 0 ? void 0 : expression.callee;
1
+ export const isCommand = function (expression, command) {
2
+ const callee = expression?.callee;
8
3
  return (callee &&
9
- ((_a = callee === null || callee === void 0 ? void 0 : callee.object) === null || _a === void 0 ? void 0 : _a.name) === 'browser' &&
10
- ((_b = callee === null || callee === void 0 ? void 0 : callee.property) === null || _b === void 0 ? void 0 : _b.name) === command);
4
+ callee?.object?.name === 'browser' &&
5
+ callee?.property?.name === command);
11
6
  };
12
- exports.isCommand = isCommand;
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "eslint-plugin-wdio",
3
- "version": "7.19.4",
3
+ "version": "7.20.8-alpha.504+428a9d729",
4
4
  "description": "Eslint rules for WebdriverIO",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/eslint-plugin-wdio",
7
7
  "license": "MIT",
8
- "main": "build/index.js",
8
+ "type": "module",
9
+ "exports": "./build/index.js",
10
+ "types": "./build/index.d.ts",
11
+ "typeScriptVersion": "3.8.3",
9
12
  "engines": {
10
- "node": ">=12.0.0"
13
+ "node": "^16.13 || >=18"
11
14
  },
12
15
  "repository": {
13
16
  "type": "git",
14
- "url": "git://github.com/webdriverio/webdriverio.git"
17
+ "url": "git://github.com/webdriverio/webdriverio.git",
18
+ "directory": "packages/eslint-plugin-wdio"
15
19
  },
16
20
  "keywords": [
17
21
  "eslint",
@@ -24,8 +28,8 @@
24
28
  "url": "https://github.com/webdriverio/webdriverio/issues"
25
29
  },
26
30
  "devDependencies": {
27
- "@types/estree": "^0.0.51",
31
+ "@types/estree": "^0.0.52",
28
32
  "eslint": "^8.10.0"
29
33
  },
30
- "gitHead": "548cdfb823f7cca51f36e344f20556926f3d3fab"
34
+ "gitHead": "428a9d729ae6231968a60908732fa3f607d195e9"
31
35
  }
package/src/constants.ts CHANGED
@@ -8,7 +8,9 @@ export const MATCHERS = [
8
8
  'toBeDisplayed',
9
9
  'toBeDisplayedInViewport',
10
10
  'toBeEnabled',
11
+ 'toExist',
11
12
  'toBeExisting',
13
+ 'toBePresent',
12
14
  'toBeFocused',
13
15
  'toBeSelected',
14
16
  'toHaveAttribute',
package/src/index.ts CHANGED
@@ -1,27 +1,27 @@
1
- import awaitExpect from './rules/await-expect'
2
- import noDebug from './rules/no-debug'
3
- import noPause from './rules/no-pause'
1
+ import awaitExpect from './rules/await-expect.js'
2
+ import noDebug from './rules/no-debug.js'
3
+ import noPause from './rules/no-pause.js'
4
4
 
5
5
  const rules = {
6
- 'await-expect' : awaitExpect,
7
- 'no-debug' : noDebug,
8
- 'no-pause' : noPause
6
+ 'await-expect': awaitExpect,
7
+ 'no-debug': noDebug,
8
+ 'no-pause': noPause
9
9
  }
10
10
 
11
11
  const configs = {
12
12
  recommended: {
13
13
  globals: {
14
- $ : false,
15
- $$ : false,
16
- browser : false,
17
- driver : false,
18
- expect : false,
19
- multiremotebrowser : false,
14
+ $: false,
15
+ $$: false,
16
+ browser: false,
17
+ driver: false,
18
+ expect: false,
19
+ multiremotebrowser: false,
20
20
  },
21
- rules : {
22
- 'wdio/await-expect' : 'error',
23
- 'wdio/no-debug' : 'error',
24
- 'wdio/no-pause' : 'error',
21
+ rules: {
22
+ 'wdio/await-expect': 'error',
23
+ 'wdio/no-debug': 'error',
24
+ 'wdio/no-pause': 'error',
25
25
  }
26
26
  }
27
27
  }
@@ -1,7 +1,7 @@
1
1
  import type { Rule } from 'eslint'
2
2
  import type { Identifier } from 'estree'
3
3
 
4
- import { MATCHERS } from '../constants'
4
+ import { MATCHERS } from '../constants.js'
5
5
 
6
6
  const rule: Rule.RuleModule = {
7
7
  meta: {
@@ -9,7 +9,7 @@ const rule: Rule.RuleModule = {
9
9
  docs: {
10
10
  description: 'expect must be prefixed with await',
11
11
  category: 'Possible Errors',
12
- url: 'https://github.com/webdriverio/packages/eslint-plugin-wdio/docs/rules/await-expect.md',
12
+ url: 'https://github.com/webdriverio/webdriverio/blob/main/packages/eslint-plugin-wdio/docs/rules/await-expect.md',
13
13
  recommended: false,
14
14
  },
15
15
  messages: {
@@ -1,5 +1,5 @@
1
1
  import { Rule } from 'eslint'
2
- import { isCommand } from '../utils/helpers'
2
+ import { isCommand } from '../utils/helpers.js'
3
3
 
4
4
  const rule: Rule.RuleModule = {
5
5
  meta: {
@@ -7,7 +7,7 @@ const rule: Rule.RuleModule = {
7
7
  docs: {
8
8
  description: 'Disallow browser.debug() in tests',
9
9
  category: 'Possible Errors',
10
- url: 'https://github.com/webdriverio/packages/eslint-plugin-wdio/docs/rules/no-debug.md',
10
+ url: 'https://github.com/webdriverio/webdriverio/blob/main/packages/eslint-plugin-wdio/docs/rules/no-debug.md',
11
11
  recommended: false,
12
12
  },
13
13
  messages: {
@@ -1,5 +1,5 @@
1
1
  import { Rule } from 'eslint'
2
- import { isCommand } from '../utils/helpers'
2
+ import { isCommand } from '../utils/helpers.js'
3
3
 
4
4
  const rule: Rule.RuleModule = {
5
5
  meta: {
@@ -7,7 +7,7 @@ const rule: Rule.RuleModule = {
7
7
  docs: {
8
8
  description: 'Disallow browser.pause() in tests',
9
9
  category: 'Possible Errors',
10
- url: 'https://github.com/webdriverio/packages/eslint-plugin-wdio/docs/rules/no-pause.md',
10
+ url: 'https://github.com/webdriverio/webdriverio/blob/main/packages/eslint-plugin-wdio/docs/rules/no-pause.md',
11
11
  recommended: false,
12
12
  },
13
13
  messages: {
@@ -1,5 +1,3 @@
1
- // import type { TSESTree } from '@typescript-eslint/utils'
2
-
3
1
  export const isCommand = function(expression: any, command: 'pause' | 'debug'): boolean {
4
2
  const callee = expression?.callee
5
3