diff --git a/index.ts b/index.ts index b04c20e9..9fc382b9 100755 --- a/index.ts +++ b/index.ts @@ -432,7 +432,13 @@ async function init() { // Render ESLint config if (needsEslint) { - renderEslint(root, { needsTypeScript, needsCypress, needsCypressCT, needsPrettier }) + renderEslint(root, { + needsTypeScript, + needsCypress, + needsCypressCT, + needsPrettier, + needsPlaywright + }) } // Render code template. diff --git a/template/eslint/package.json b/template/eslint/package.json index 24786f0a..cc3f0961 100644 --- a/template/eslint/package.json +++ b/template/eslint/package.json @@ -1,5 +1,6 @@ { "devDependencies": { - "eslint-plugin-cypress": "^2.15.1" + "eslint-plugin-cypress": "^2.15.1", + "eslint-plugin-playwright": "^0.21.0" } } diff --git a/utils/renderEslint.ts b/utils/renderEslint.ts index 86a7fbb5..dba48959 100644 --- a/utils/renderEslint.ts +++ b/utils/renderEslint.ts @@ -13,7 +13,7 @@ const eslintDeps = eslintTemplatePackage.devDependencies export default function renderEslint( rootDir, - { needsTypeScript, needsCypress, needsCypressCT, needsPrettier } + { needsTypeScript, needsCypress, needsCypressCT, needsPrettier, needsPlaywright } ) { const additionalConfig: Linter.Config = {} const additionalDependencies = {} @@ -35,6 +35,17 @@ export default function renderEslint( additionalDependencies['eslint-plugin-cypress'] = eslintDeps['eslint-plugin-cypress'] } + if (needsPlaywright) { + additionalConfig.overrides = [ + { + files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'], + extends: ['plugin:playwright/recommended'] + } + ] + + additionalDependencies['eslint-plugin-playwright'] = eslintDeps['eslint-plugin-playwright'] + } + const { pkg, files } = createESLintConfig({ vueVersion: '3.x', // we currently don't support other style guides