Skip to content

Commit 54964cd

Browse files
feat: eslint plugin playwright (#433)
Fixes #422
1 parent e73698f commit 54964cd

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

Diff for: index.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,13 @@ async function init() {
432432

433433
// Render ESLint config
434434
if (needsEslint) {
435-
renderEslint(root, { needsTypeScript, needsCypress, needsCypressCT, needsPrettier })
435+
renderEslint(root, {
436+
needsTypeScript,
437+
needsCypress,
438+
needsCypressCT,
439+
needsPrettier,
440+
needsPlaywright
441+
})
436442
}
437443

438444
// Render code template.

Diff for: template/eslint/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"devDependencies": {
3-
"eslint-plugin-cypress": "^2.15.1"
3+
"eslint-plugin-cypress": "^2.15.1",
4+
"eslint-plugin-playwright": "^0.21.0"
45
}
56
}

Diff for: utils/renderEslint.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const eslintDeps = eslintTemplatePackage.devDependencies
1313

1414
export default function renderEslint(
1515
rootDir,
16-
{ needsTypeScript, needsCypress, needsCypressCT, needsPrettier }
16+
{ needsTypeScript, needsCypress, needsCypressCT, needsPrettier, needsPlaywright }
1717
) {
1818
const additionalConfig: Linter.Config = {}
1919
const additionalDependencies = {}
@@ -35,6 +35,17 @@ export default function renderEslint(
3535
additionalDependencies['eslint-plugin-cypress'] = eslintDeps['eslint-plugin-cypress']
3636
}
3737

38+
if (needsPlaywright) {
39+
additionalConfig.overrides = [
40+
{
41+
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
42+
extends: ['plugin:playwright/recommended']
43+
}
44+
]
45+
46+
additionalDependencies['eslint-plugin-playwright'] = eslintDeps['eslint-plugin-playwright']
47+
}
48+
3849
const { pkg, files } = createESLintConfig({
3950
vueVersion: '3.x',
4051
// we currently don't support other style guides

0 commit comments

Comments
 (0)