From: georgi-mateev <95027221+georgi-mateev@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:17:25 +0000 (+0200) Subject: feat: eslint plugin playwright (#433) X-Git-Tag: v3.10.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54964cd25d491fb03890cb81268796eff57f2120;p=thirdparty%2Fvuejs%2Fcreate-vue.git feat: eslint plugin playwright (#433) Fixes #422 --- 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