]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
feat: eslint plugin playwright (#433)
authorgeorgi-mateev <95027221+georgi-mateev@users.noreply.github.com>
Mon, 5 Feb 2024 16:17:25 +0000 (18:17 +0200)
committerGitHub <noreply@github.com>
Mon, 5 Feb 2024 16:17:25 +0000 (17:17 +0100)
Fixes #422

index.ts
template/eslint/package.json
utils/renderEslint.ts

index b04c20e99ad9469cd2920bf3e1f40a744db21dd8..9fc382b9cdea85087b5a0fcfd3ba7b754b0a0d3a 100755 (executable)
--- 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.
index 24786f0a35c152e04f1aa1e4bc0283e6bd88dedb..cc3f0961f6facba611ef36269dd46bb9e65029b2 100644 (file)
@@ -1,5 +1,6 @@
 {
   "devDependencies": {
-    "eslint-plugin-cypress": "^2.15.1"
+    "eslint-plugin-cypress": "^2.15.1",
+    "eslint-plugin-playwright": "^0.21.0"
   }
 }
index 86a7fbb5cbe0141326b6e9a2f16777199bee0516..dba48959382a78113c8b9eafcb52f2998a8983e4 100644 (file)
@@ -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