From 4762bbdc13a5832266538b6fbcace391cc3aadfd Mon Sep 17 00:00:00 2001 From: Andrew Kazakov Date: Mon, 28 Jul 2025 18:15:36 +0300 Subject: [PATCH 1/2] fix(valid-test-tags): disallow extra properties in rule options and add to recommended (#381) --- src/index.ts | 1 + src/rules/valid-test-tags.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 67d6de47..0101521a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -135,6 +135,7 @@ const sharedConfig = { 'playwright/valid-describe-callback': 'error', 'playwright/valid-expect': 'error', 'playwright/valid-expect-in-promise': 'error', + 'playwright/valid-test-tags': 'error', 'playwright/valid-title': 'error', }, } as const diff --git a/src/rules/valid-test-tags.ts b/src/rules/valid-test-tags.ts index 0a22df73..8e543da4 100644 --- a/src/rules/valid-test-tags.ts +++ b/src/rules/valid-test-tags.ts @@ -142,7 +142,11 @@ export default createRule({ items: { oneOf: [ { type: 'string' }, - { properties: { source: { type: 'string' } }, type: 'object' }, + { + additionalProperties: false, + properties: { source: { type: 'string' } }, + type: 'object', + }, ], }, type: 'array', @@ -151,7 +155,11 @@ export default createRule({ items: { oneOf: [ { type: 'string' }, - { properties: { source: { type: 'string' } }, type: 'object' }, + { + additionalProperties: false, + properties: { source: { type: 'string' } }, + type: 'object', + }, ], }, type: 'array', From 38a559e69978c19206d4a7a032f8fb4227306a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= <93290723+MSroczynski3@users.noreply.github.com> Date: Thu, 31 Jul 2025 00:06:51 +0200 Subject: [PATCH 2/2] fix(prefer-web-first-assertions): Fix false positive (#384) * Fix JS prototype chain issue * Lint --- src/rules/prefer-web-first-assertions.test.ts | 1 + src/rules/prefer-web-first-assertions.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rules/prefer-web-first-assertions.test.ts b/src/rules/prefer-web-first-assertions.test.ts index ec9e96a7..a236b65a 100644 --- a/src/rules/prefer-web-first-assertions.test.ts +++ b/src/rules/prefer-web-first-assertions.test.ts @@ -1095,6 +1095,7 @@ runRuleTester('prefer-web-first-assertions', rule, { { code: test('let visible = await foo.isVisible()') }, { code: test('const value = await bar["inputValue"]()') }, { code: test('const isEditable = await baz[`isEditable`]()') }, + { code: test('await expect(await locator.toString()).toBe("something")') }, { code: javascript` import { expect } from '@playwright/test'; diff --git a/src/rules/prefer-web-first-assertions.ts b/src/rules/prefer-web-first-assertions.ts index 5a2ff0b6..3d6e0e72 100644 --- a/src/rules/prefer-web-first-assertions.ts +++ b/src/rules/prefer-web-first-assertions.ts @@ -85,7 +85,7 @@ export default createRule({ // Playwright method must be supported const method = getStringValue(call.callee.property) const methodConfig = methods[method] - if (!methodConfig) return + if (!Object.hasOwn(methods, method)) return // Change the matcher const notModifier = fnCall.modifiers.find(