eslint-plugin-playwright 1.5.0 → 1.5.1
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.js +22 -11
- package/dist/index.mjs +22 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -637,7 +637,8 @@ var missing_playwright_await_default = {
|
|
|
637
637
|
docs: {
|
|
638
638
|
category: "Possible Errors",
|
|
639
639
|
description: `Identify false positives when async Playwright APIs are not properly awaited.`,
|
|
640
|
-
recommended: true
|
|
640
|
+
recommended: true,
|
|
641
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/missing-playwright-await.md"
|
|
641
642
|
},
|
|
642
643
|
fixable: "code",
|
|
643
644
|
messages: {
|
|
@@ -1220,7 +1221,8 @@ var no_networkidle_default = {
|
|
|
1220
1221
|
docs: {
|
|
1221
1222
|
category: "Possible Errors",
|
|
1222
1223
|
description: "Prevent usage of the networkidle option",
|
|
1223
|
-
recommended: true
|
|
1224
|
+
recommended: true,
|
|
1225
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-networkidle.md"
|
|
1224
1226
|
},
|
|
1225
1227
|
messages: {
|
|
1226
1228
|
noNetworkidle: "Unexpected use of networkidle."
|
|
@@ -1280,7 +1282,8 @@ var no_page_pause_default = {
|
|
|
1280
1282
|
docs: {
|
|
1281
1283
|
category: "Possible Errors",
|
|
1282
1284
|
description: "Prevent usage of page.pause()",
|
|
1283
|
-
recommended: true
|
|
1285
|
+
recommended: true,
|
|
1286
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-page-pause.md"
|
|
1284
1287
|
},
|
|
1285
1288
|
messages: {
|
|
1286
1289
|
noPagePause: "Unexpected use of page.pause()."
|
|
@@ -1728,7 +1731,8 @@ var no_useless_await_default = {
|
|
|
1728
1731
|
docs: {
|
|
1729
1732
|
category: "Possible Errors",
|
|
1730
1733
|
description: "Disallow unnecessary awaits for Playwright methods",
|
|
1731
|
-
recommended: true
|
|
1734
|
+
recommended: true,
|
|
1735
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-useless-await.md"
|
|
1732
1736
|
},
|
|
1733
1737
|
fixable: "code",
|
|
1734
1738
|
messages: {
|
|
@@ -2005,7 +2009,8 @@ var prefer_comparison_matcher_default = {
|
|
|
2005
2009
|
docs: {
|
|
2006
2010
|
category: "Best Practices",
|
|
2007
2011
|
description: "Suggest using the built-in comparison matchers",
|
|
2008
|
-
recommended: false
|
|
2012
|
+
recommended: false,
|
|
2013
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-comparision-matcher.md"
|
|
2009
2014
|
},
|
|
2010
2015
|
fixable: "code",
|
|
2011
2016
|
messages: {
|
|
@@ -2781,7 +2786,7 @@ var require_hook_default = {
|
|
|
2781
2786
|
if (!isTypeOfFnCall(context, node, ["describe"])) {
|
|
2782
2787
|
return;
|
|
2783
2788
|
}
|
|
2784
|
-
const
|
|
2789
|
+
const testFn = node.arguments.at(-1);
|
|
2785
2790
|
if (!isFunction(testFn) || testFn.body.type !== "BlockStatement") {
|
|
2786
2791
|
return;
|
|
2787
2792
|
}
|
|
@@ -2964,6 +2969,12 @@ var paramsLocation = (params) => {
|
|
|
2964
2969
|
start: first.loc.start
|
|
2965
2970
|
};
|
|
2966
2971
|
};
|
|
2972
|
+
function parseArgs(node) {
|
|
2973
|
+
const [name, b, c] = node.arguments;
|
|
2974
|
+
const options = node.arguments.length === 2 ? b : void 0;
|
|
2975
|
+
const callback = node.arguments.length === 3 ? c : b;
|
|
2976
|
+
return [name, options, callback];
|
|
2977
|
+
}
|
|
2967
2978
|
var valid_describe_callback_default = {
|
|
2968
2979
|
create(context) {
|
|
2969
2980
|
return {
|
|
@@ -2974,14 +2985,14 @@ var valid_describe_callback_default = {
|
|
|
2974
2985
|
if (call.members.some((s) => getStringValue(s) === "configure")) {
|
|
2975
2986
|
return;
|
|
2976
2987
|
}
|
|
2988
|
+
const [name, _, callback] = parseArgs(node);
|
|
2977
2989
|
if (node.arguments.length < 1) {
|
|
2978
2990
|
return context.report({
|
|
2979
2991
|
loc: node.loc,
|
|
2980
2992
|
messageId: "nameAndCallback"
|
|
2981
2993
|
});
|
|
2982
2994
|
}
|
|
2983
|
-
|
|
2984
|
-
if (!callback) {
|
|
2995
|
+
if (!name || !callback) {
|
|
2985
2996
|
context.report({
|
|
2986
2997
|
loc: paramsLocation(node.arguments),
|
|
2987
2998
|
messageId: "nameAndCallback"
|
|
@@ -2991,7 +3002,7 @@ var valid_describe_callback_default = {
|
|
|
2991
3002
|
if (!isFunction(callback)) {
|
|
2992
3003
|
context.report({
|
|
2993
3004
|
loc: paramsLocation(node.arguments),
|
|
2994
|
-
messageId: "
|
|
3005
|
+
messageId: "invalidCallback"
|
|
2995
3006
|
});
|
|
2996
3007
|
return;
|
|
2997
3008
|
}
|
|
@@ -3001,7 +3012,7 @@ var valid_describe_callback_default = {
|
|
|
3001
3012
|
node: callback
|
|
3002
3013
|
});
|
|
3003
3014
|
}
|
|
3004
|
-
if (
|
|
3015
|
+
if (callback.params.length) {
|
|
3005
3016
|
context.report({
|
|
3006
3017
|
loc: paramsLocation(callback.params),
|
|
3007
3018
|
messageId: "unexpectedDescribeArgument"
|
|
@@ -3034,9 +3045,9 @@ var valid_describe_callback_default = {
|
|
|
3034
3045
|
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-describe-callback.md"
|
|
3035
3046
|
},
|
|
3036
3047
|
messages: {
|
|
3048
|
+
invalidCallback: "Callback argument must be a function",
|
|
3037
3049
|
nameAndCallback: "Describe requires name and callback arguments",
|
|
3038
3050
|
noAsyncDescribeCallback: "No async describe callback",
|
|
3039
|
-
secondArgumentMustBeFunction: "Second argument must be function",
|
|
3040
3051
|
unexpectedDescribeArgument: "Unexpected argument(s) in describe callback",
|
|
3041
3052
|
unexpectedReturnInDescribe: "Unexpected return statement in describe callback"
|
|
3042
3053
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -661,7 +661,8 @@ var init_missing_playwright_await = __esm({
|
|
|
661
661
|
docs: {
|
|
662
662
|
category: "Possible Errors",
|
|
663
663
|
description: `Identify false positives when async Playwright APIs are not properly awaited.`,
|
|
664
|
-
recommended: true
|
|
664
|
+
recommended: true,
|
|
665
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/missing-playwright-await.md"
|
|
665
666
|
},
|
|
666
667
|
fixable: "code",
|
|
667
668
|
messages: {
|
|
@@ -1331,7 +1332,8 @@ var init_no_networkidle = __esm({
|
|
|
1331
1332
|
docs: {
|
|
1332
1333
|
category: "Possible Errors",
|
|
1333
1334
|
description: "Prevent usage of the networkidle option",
|
|
1334
|
-
recommended: true
|
|
1335
|
+
recommended: true,
|
|
1336
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-networkidle.md"
|
|
1335
1337
|
},
|
|
1336
1338
|
messages: {
|
|
1337
1339
|
noNetworkidle: "Unexpected use of networkidle."
|
|
@@ -1405,7 +1407,8 @@ var init_no_page_pause = __esm({
|
|
|
1405
1407
|
docs: {
|
|
1406
1408
|
category: "Possible Errors",
|
|
1407
1409
|
description: "Prevent usage of page.pause()",
|
|
1408
|
-
recommended: true
|
|
1410
|
+
recommended: true,
|
|
1411
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-page-pause.md"
|
|
1409
1412
|
},
|
|
1410
1413
|
messages: {
|
|
1411
1414
|
noPagePause: "Unexpected use of page.pause()."
|
|
@@ -1905,7 +1908,8 @@ var init_no_useless_await = __esm({
|
|
|
1905
1908
|
docs: {
|
|
1906
1909
|
category: "Possible Errors",
|
|
1907
1910
|
description: "Disallow unnecessary awaits for Playwright methods",
|
|
1908
|
-
recommended: true
|
|
1911
|
+
recommended: true,
|
|
1912
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-useless-await.md"
|
|
1909
1913
|
},
|
|
1910
1914
|
fixable: "code",
|
|
1911
1915
|
messages: {
|
|
@@ -2221,7 +2225,8 @@ var init_prefer_comparison_matcher = __esm({
|
|
|
2221
2225
|
docs: {
|
|
2222
2226
|
category: "Best Practices",
|
|
2223
2227
|
description: "Suggest using the built-in comparison matchers",
|
|
2224
|
-
recommended: false
|
|
2228
|
+
recommended: false,
|
|
2229
|
+
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-comparision-matcher.md"
|
|
2225
2230
|
},
|
|
2226
2231
|
fixable: "code",
|
|
2227
2232
|
messages: {
|
|
@@ -3086,7 +3091,7 @@ var init_require_hook = __esm({
|
|
|
3086
3091
|
if (!isTypeOfFnCall(context, node, ["describe"])) {
|
|
3087
3092
|
return;
|
|
3088
3093
|
}
|
|
3089
|
-
const
|
|
3094
|
+
const testFn = node.arguments.at(-1);
|
|
3090
3095
|
if (!isFunction(testFn) || testFn.body.type !== "BlockStatement") {
|
|
3091
3096
|
return;
|
|
3092
3097
|
}
|
|
@@ -3287,6 +3292,12 @@ var init_require_top_level_describe = __esm({
|
|
|
3287
3292
|
});
|
|
3288
3293
|
|
|
3289
3294
|
// src/rules/valid-describe-callback.ts
|
|
3295
|
+
function parseArgs(node) {
|
|
3296
|
+
const [name, b, c] = node.arguments;
|
|
3297
|
+
const options = node.arguments.length === 2 ? b : void 0;
|
|
3298
|
+
const callback = node.arguments.length === 3 ? c : b;
|
|
3299
|
+
return [name, options, callback];
|
|
3300
|
+
}
|
|
3290
3301
|
var paramsLocation, valid_describe_callback_default;
|
|
3291
3302
|
var init_valid_describe_callback = __esm({
|
|
3292
3303
|
"src/rules/valid-describe-callback.ts"() {
|
|
@@ -3311,14 +3322,14 @@ var init_valid_describe_callback = __esm({
|
|
|
3311
3322
|
if (call.members.some((s) => getStringValue(s) === "configure")) {
|
|
3312
3323
|
return;
|
|
3313
3324
|
}
|
|
3325
|
+
const [name, _, callback] = parseArgs(node);
|
|
3314
3326
|
if (node.arguments.length < 1) {
|
|
3315
3327
|
return context.report({
|
|
3316
3328
|
loc: node.loc,
|
|
3317
3329
|
messageId: "nameAndCallback"
|
|
3318
3330
|
});
|
|
3319
3331
|
}
|
|
3320
|
-
|
|
3321
|
-
if (!callback) {
|
|
3332
|
+
if (!name || !callback) {
|
|
3322
3333
|
context.report({
|
|
3323
3334
|
loc: paramsLocation(node.arguments),
|
|
3324
3335
|
messageId: "nameAndCallback"
|
|
@@ -3328,7 +3339,7 @@ var init_valid_describe_callback = __esm({
|
|
|
3328
3339
|
if (!isFunction(callback)) {
|
|
3329
3340
|
context.report({
|
|
3330
3341
|
loc: paramsLocation(node.arguments),
|
|
3331
|
-
messageId: "
|
|
3342
|
+
messageId: "invalidCallback"
|
|
3332
3343
|
});
|
|
3333
3344
|
return;
|
|
3334
3345
|
}
|
|
@@ -3338,7 +3349,7 @@ var init_valid_describe_callback = __esm({
|
|
|
3338
3349
|
node: callback
|
|
3339
3350
|
});
|
|
3340
3351
|
}
|
|
3341
|
-
if (
|
|
3352
|
+
if (callback.params.length) {
|
|
3342
3353
|
context.report({
|
|
3343
3354
|
loc: paramsLocation(callback.params),
|
|
3344
3355
|
messageId: "unexpectedDescribeArgument"
|
|
@@ -3371,9 +3382,9 @@ var init_valid_describe_callback = __esm({
|
|
|
3371
3382
|
url: "https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-describe-callback.md"
|
|
3372
3383
|
},
|
|
3373
3384
|
messages: {
|
|
3385
|
+
invalidCallback: "Callback argument must be a function",
|
|
3374
3386
|
nameAndCallback: "Describe requires name and callback arguments",
|
|
3375
3387
|
noAsyncDescribeCallback: "No async describe callback",
|
|
3376
|
-
secondArgumentMustBeFunction: "Second argument must be function",
|
|
3377
3388
|
unexpectedDescribeArgument: "Unexpected argument(s) in describe callback",
|
|
3378
3389
|
unexpectedReturnInDescribe: "Unexpected return statement in describe callback"
|
|
3379
3390
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-playwright",
|
|
3
3
|
"description": "ESLint plugin for Playwright testing.",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.1",
|
|
5
5
|
"repository": "https://github.com/playwright-community/eslint-plugin-playwright",
|
|
6
6
|
"author": "Mark Skelton <mark@mskelton.dev>",
|
|
7
7
|
"packageManager": "pnpm@8.12.0",
|