Skip to content

Commit a0c08e6

Browse files
committed
enable eslint-plugin-playwright
1 parent 63fe0bf commit a0c08e6

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

tests/eslint/eslint.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import pluginMath from 'eslint-plugin-math';
1414
import pluginN from 'eslint-plugin-n';
1515
import pluginNodeDependencies from 'eslint-plugin-node-dependencies';
1616
import * as pluginPackageJSON from 'eslint-plugin-package-json';
17+
import pluginPlaywright from 'eslint-plugin-playwright';
1718
import pluginPromise from 'eslint-plugin-promise';
1819
import pluginQUnit from 'eslint-plugin-qunit';
1920
import pluginReDoS from 'eslint-plugin-redos';
@@ -2035,6 +2036,19 @@ const qunit = {
20352036
'qunit/resolve-async': ERROR,
20362037
};
20372038

2039+
const playwright = {
2040+
// enforce Playwright APIs to be awaited
2041+
'playwright/missing-playwright-await': ERROR,
2042+
// disallow usage of `page.$eval()` and `page.$$eval()`
2043+
'playwright/no-eval': ERROR,
2044+
// disallow using `page.pause()`
2045+
'playwright/no-page-pause': ERROR,
2046+
// prevent unsafe variable references in `page.evaluate()`
2047+
'playwright/no-unsafe-references': ERROR,
2048+
// disallow unnecessary awaits for Playwright methods
2049+
'playwright/no-useless-await': ERROR,
2050+
};
2051+
20382052
const yaml = {
20392053
// disallow empty mapping values
20402054
'yaml/no-empty-mapping-value': ERROR,
@@ -2345,6 +2359,7 @@ export default [
23452359
node: pluginN,
23462360
'node-dependencies': pluginNodeDependencies,
23472361
'package-json': pluginPackageJSON,
2362+
playwright: pluginPlaywright,
23482363
promise: pluginPromise,
23492364
qunit: pluginQUnit,
23502365
redos: pluginReDoS,
@@ -2440,6 +2455,12 @@ export default [
24402455
},
24412456
rules: qunit,
24422457
},
2458+
{
2459+
files: [
2460+
'scripts/usage/**',
2461+
],
2462+
rules: playwright,
2463+
},
24432464
{
24442465
files: [
24452466
'packages/core-js-@(builder|compat)/**',

tests/eslint/package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/eslint/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"eslint-plugin-n": "^17.23.1",
1919
"eslint-plugin-node-dependencies": "^1.3.0",
2020
"eslint-plugin-package-json": "^0.85.0",
21+
"eslint-plugin-playwright": "^2.4.0",
2122
"eslint-plugin-promise": "^7.2.1",
2223
"eslint-plugin-qunit": "^8.2.5",
2324
"eslint-plugin-redos": "^4.5.0",

0 commit comments

Comments
 (0)