eslint-plugin-wdio
Advanced tools
Comparing version 9.0.0-alpha.426 to 9.0.0
@@ -1,31 +0,4 @@ | ||
declare const _default: { | ||
configs: { | ||
'flat/recommended': { | ||
languageOptions: { | ||
globals: { | ||
readonly $: false; | ||
readonly $$: false; | ||
readonly browser: false; | ||
readonly driver: false; | ||
readonly expect: false; | ||
readonly multiremotebrowser: false; | ||
}; | ||
}; | ||
plugins: { | ||
wdio: { | ||
configs: {}; | ||
rules: { | ||
'await-expect': import("eslint").Rule.RuleModule; | ||
'no-debug': import("eslint").Rule.RuleModule; | ||
'no-pause': import("eslint").Rule.RuleModule; | ||
}; | ||
}; | ||
}; | ||
rules: { | ||
readonly 'wdio/await-expect': "error"; | ||
readonly 'wdio/no-debug': "error"; | ||
readonly 'wdio/no-pause': "error"; | ||
}; | ||
}; | ||
recommended: { | ||
export declare const configs: { | ||
'flat/recommended': { | ||
languageOptions: { | ||
globals: { | ||
@@ -39,17 +12,41 @@ readonly $: false; | ||
}; | ||
plugins: string[]; | ||
rules: { | ||
readonly 'wdio/await-expect': "error"; | ||
readonly 'wdio/no-debug': "error"; | ||
readonly 'wdio/no-pause': "error"; | ||
}; | ||
plugins: { | ||
wdio: { | ||
configs: {}; | ||
rules: { | ||
'await-expect': import("eslint").Rule.RuleModule; | ||
'no-debug': import("eslint").Rule.RuleModule; | ||
'no-pause': import("eslint").Rule.RuleModule; | ||
}; | ||
}; | ||
}; | ||
rules: { | ||
readonly 'wdio/await-expect': "error"; | ||
readonly 'wdio/no-debug': "error"; | ||
readonly 'wdio/no-pause': "error"; | ||
}; | ||
}; | ||
rules: { | ||
'await-expect': import("eslint").Rule.RuleModule; | ||
'no-debug': import("eslint").Rule.RuleModule; | ||
'no-pause': import("eslint").Rule.RuleModule; | ||
recommended: { | ||
globals: { | ||
readonly $: false; | ||
readonly $$: false; | ||
readonly browser: false; | ||
readonly driver: false; | ||
readonly expect: false; | ||
readonly multiremotebrowser: false; | ||
}; | ||
plugins: string[]; | ||
rules: { | ||
readonly 'wdio/await-expect': "error"; | ||
readonly 'wdio/no-debug': "error"; | ||
readonly 'wdio/no-pause': "error"; | ||
}; | ||
}; | ||
}; | ||
export = _default; | ||
export declare const rules: { | ||
'await-expect': import("eslint").Rule.RuleModule; | ||
'no-debug': import("eslint").Rule.RuleModule; | ||
'no-pause': import("eslint").Rule.RuleModule; | ||
}; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,51 +0,182 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
const await_expect_js_1 = __importDefault(require("./rules/await-expect.js")); | ||
const no_debug_js_1 = __importDefault(require("./rules/no-debug.js")); | ||
const no_pause_js_1 = __importDefault(require("./rules/no-pause.js")); | ||
const sharedGlobals = { | ||
$: false, | ||
$$: false, | ||
browser: false, | ||
driver: false, | ||
expect: false, | ||
multiremotebrowser: false, | ||
}; | ||
const sharedConfig = { | ||
rules: { | ||
'wdio/await-expect': 'error', | ||
'wdio/no-debug': 'error', | ||
'wdio/no-pause': 'error', | ||
// src/constants.ts | ||
var MATCHERS = [ | ||
"toHaveTitle", | ||
"toHaveTitleContaining", | ||
"toHaveUrl", | ||
"toHaveUrlContaining", | ||
"toBeClickable", | ||
"toBeDisabled", | ||
"toBeDisplayed", | ||
"toBeDisplayedInViewport", | ||
"toBeEnabled", | ||
"toExist", | ||
"toBeExisting", | ||
"toBePresent", | ||
"toBeFocused", | ||
"toBeSelected", | ||
"toHaveAttribute", | ||
"toHaveAttributeContaining", | ||
"toHaveChildren", | ||
"toHaveElementClass", | ||
"toHaveElementClassContaining", | ||
"toHaveElementProperty", | ||
"toHaveHref", | ||
"toHaveHrefContaining", | ||
"toHaveId", | ||
"toHaveStyle", | ||
"toHaveText", | ||
"toHaveTextContaining", | ||
"toHaveValue", | ||
"toHaveValueContaining", | ||
"toBeElementsArrayOfSize", | ||
"toBeRequested", | ||
"toBeRequestedTimes", | ||
"toBeRequestedWith", | ||
"toBeRequestedWithResponse" | ||
]; | ||
// src/rules/await-expect.ts | ||
var rule = { | ||
meta: { | ||
type: "problem", | ||
docs: { | ||
description: "expect must be prefixed with await", | ||
category: "Possible Errors", | ||
url: "https://github.com/webdriverio/webdriverio/blob/main/packages/eslint-plugin-wdio/docs/rules/await-expect.md", | ||
recommended: false | ||
}, | ||
}; | ||
const index = { | ||
configs: {}, | ||
rules: { | ||
'await-expect': await_expect_js_1.default, | ||
'no-debug': no_debug_js_1.default, | ||
'no-pause': no_pause_js_1.default, | ||
messages: { | ||
missingAwait: "Missing await before an expect statement" | ||
}, | ||
hasSuggestions: true | ||
}, | ||
create: function(context) { | ||
return { | ||
CallExpression(node) { | ||
if (node.callee.type !== "MemberExpression" || node.callee.object.type !== "CallExpression" || node.callee.object.callee.name !== "expect" || !MATCHERS.includes(node.callee.property.name)) { | ||
return; | ||
} | ||
if ( | ||
/** | ||
* expect is called without an `await` and as part of an | ||
* expression | ||
*/ | ||
node.parent.type === "ExpressionStatement" | ||
) { | ||
context.report({ node, messageId: "missingAwait" }); | ||
} | ||
} | ||
}; | ||
} | ||
}; | ||
const legacyConfig = { | ||
...sharedConfig, | ||
globals: sharedGlobals, | ||
plugins: ['wdio'], | ||
var await_expect_default = rule; | ||
// src/utils/helpers.ts | ||
var isCommand = function(expression, command) { | ||
const callee = expression?.callee; | ||
return callee && callee?.object?.name === "browser" && callee?.property?.name === command; | ||
}; | ||
const flatConfig = { | ||
...sharedConfig, | ||
languageOptions: { | ||
globals: sharedGlobals, | ||
// src/rules/no-debug.ts | ||
var rule2 = { | ||
meta: { | ||
type: "problem", | ||
docs: { | ||
description: "Disallow browser.debug() in tests", | ||
category: "Possible Errors", | ||
url: "https://github.com/webdriverio/webdriverio/blob/main/packages/eslint-plugin-wdio/docs/rules/no-debug.md", | ||
recommended: false | ||
}, | ||
plugins: { | ||
wdio: index, | ||
messages: { | ||
unexpectedDebug: "Unexpected browser.debug() not allowed" | ||
}, | ||
hasSuggestions: true, | ||
schema: [] | ||
}, | ||
create: function(context) { | ||
return { | ||
CallExpression(node) { | ||
if (isCommand(node, "debug")) { | ||
context.report({ node, messageId: "unexpectedDebug" }); | ||
} | ||
} | ||
}; | ||
} | ||
}; | ||
module.exports = { | ||
...index, | ||
configs: { | ||
'flat/recommended': flatConfig, | ||
recommended: legacyConfig, | ||
var no_debug_default = rule2; | ||
// src/rules/no-pause.ts | ||
var rule3 = { | ||
meta: { | ||
type: "problem", | ||
docs: { | ||
description: "Disallow browser.pause() in tests", | ||
category: "Possible Errors", | ||
url: "https://github.com/webdriverio/webdriverio/blob/main/packages/eslint-plugin-wdio/docs/rules/no-pause.md", | ||
recommended: false | ||
}, | ||
messages: { | ||
unexpectedPause: "Unexpected browser.pause() not allowed" | ||
}, | ||
hasSuggestions: true, | ||
schema: [] | ||
}, | ||
create: function(context) { | ||
return { | ||
CallExpression(node) { | ||
if (isCommand(node, "pause")) { | ||
context.report({ node, messageId: "unexpectedPause" }); | ||
} | ||
} | ||
}; | ||
} | ||
}; | ||
var no_pause_default = rule3; | ||
// src/index.ts | ||
var sharedGlobals = { | ||
$: false, | ||
$$: false, | ||
browser: false, | ||
driver: false, | ||
expect: false, | ||
multiremotebrowser: false | ||
}; | ||
var sharedConfig = { | ||
rules: { | ||
"wdio/await-expect": "error", | ||
"wdio/no-debug": "error", | ||
"wdio/no-pause": "error" | ||
} | ||
}; | ||
var index = { | ||
configs: {}, | ||
rules: { | ||
"await-expect": await_expect_default, | ||
"no-debug": no_debug_default, | ||
"no-pause": no_pause_default | ||
} | ||
}; | ||
var legacyConfig = { | ||
...sharedConfig, | ||
globals: sharedGlobals, | ||
plugins: ["wdio"] | ||
}; | ||
var flatConfig = { | ||
...sharedConfig, | ||
languageOptions: { | ||
globals: sharedGlobals | ||
}, | ||
plugins: { | ||
wdio: index | ||
} | ||
}; | ||
var configs = { | ||
"flat/recommended": flatConfig, | ||
recommended: legacyConfig | ||
}; | ||
var rules = index.rules; | ||
export { | ||
configs, | ||
rules | ||
}; |
{ | ||
"name": "eslint-plugin-wdio", | ||
"version": "9.0.0-alpha.426+d760644c4", | ||
"version": "9.0.0", | ||
"description": "Eslint rules for WebdriverIO", | ||
@@ -8,15 +8,13 @@ "author": "Christian Bromann <mail@bromann.dev>", | ||
"license": "MIT", | ||
"main": "./cjs/index.js", | ||
"main": "./build/index.cjs", | ||
"module": "./build/index.js", | ||
"types": "./build/index.d.ts", | ||
"exports": { | ||
"import": { | ||
".": { | ||
"types": "./build/index.d.ts", | ||
"default": "./build/index.js" | ||
}, | ||
"require": { | ||
"types": "./build/index.d.ts", | ||
"default": "./cjs/index.js" | ||
"import": "./build/index.js", | ||
"require": "./build/index.cjs" | ||
} | ||
}, | ||
"type": "module", | ||
"typeScriptVersion": "3.8.3", | ||
@@ -45,3 +43,3 @@ "engines": { | ||
}, | ||
"gitHead": "d760644c4c6e1ef910c0bee120cb422e25dbbe06" | ||
"gitHead": "957693463371a4cb329395dcdbce8fb0c930ab93" | ||
} |
@@ -47,8 +47,6 @@ import awaitExpect from './rules/await-expect.js' | ||
export = { | ||
...index, | ||
configs: { | ||
'flat/recommended': flatConfig, | ||
recommended: legacyConfig, | ||
}, | ||
export const configs = { | ||
'flat/recommended': flatConfig, | ||
recommended: legacyConfig, | ||
} | ||
export const rules = index.rules |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
Yes
22018
23
635