Skip to content

tooling(oxlint): add eslint-plugin-playwright for e2e - #761

Merged
adriangohjw merged 3 commits into
mainfrom
cursor/playwright-oxlint-plugin-6268
Nov 11, 2026
Merged

adriangohjw merged 3 commits into
mainfrom
cursor/playwright-oxlint-plugin-6268

Conversation

@adriangohjw

Copy link
Copy Markdown
Contributor

Summary

Adds eslint-plugin-playwright@2.12.2 as an oxlint JS plugin, scoped to Playwright e2e (apps/web/tests/e2e/**) only. Ultracite has no Playwright preset, so this follows the same JS-plugin pattern as e18e / react-doctor.

Compared overlay: ComfyUI_frontend#11136.

Recommended (as errors)

The plugin's recommended config is 37 playwright/* rules. Several ship as warn; this kit promotes all of them to error, plus recommended's no-empty-pattern: off which was already on the e2e override for Playwright fixtures.

Rule Plugin default This kit
missing-playwright-await, no-focused-test, no-networkidle, no-standalone-expect, no-unnecessary-assertions, no-unsafe-references, no-unused-locators, no-wait-for-navigation, prefer-web-first-assertions, valid-describe-callback, valid-expect, valid-expect-in-promise, valid-test-tags, valid-title error error
consistent-spacing-between-blocks, expect-expect, max-nested-describe, no-conditional-expect, no-conditional-in-test, no-duplicate-hooks, no-duplicate-slow, no-element-handle, no-eval, no-force-option, no-identical-title, no-nested-step, no-page-pause, no-skipped-test, no-useless-await, no-useless-not, no-wait-for-selector, no-wait-for-timeout, prefer-hooks-in-order, prefer-hooks-on-top, prefer-locator, prefer-to-have-count, prefer-to-have-length warn error

Extras vs ComfyUI

Extra ComfyUI This kit Why
prefer-native-locators error error Adopted. OUI / React Aria is role- and name-driven. The old smoke used page.waitForSelector(\text=${APP_NAME}`); the native equivalent is getByRole('contentinfo').getByText(...). Same rule would catch page.locator('[role="button"]')on the landing CTA instead ofgetByRole('button', { name: 'Explore StarterApp' })`.
require-to-pass-timeout error error Adopted. toPass() defaults to timeout 0 and retries until the test timeout. Current e2e does not use it, but auth / eventual-UI tests will. Forcing { timeout } fails fast instead of hanging CI. Cheap: only fires when you write toPass().
no-force-option: off off (28 canvas overlay { force: true } left for a follow-up) kept error (recommended-as-error) Skipped. This kit has zero { force: true }. Turning it off would hide a real smell (force-clicking a hidden React Aria overlay).

Vitest anti-slop / unit-test overrides are unchanged. jsPlugins lives on the tests/e2e/** override, so Vitest files do not load Playwright rules (probed: a __tests__ file with waitForSelector + locator('[role="button"]') produced only vitest/prefer-importing-vitest-globals, no playwright/*).

E2E fixes

  • apps/web/tests/e2e/smoke.e2e.ts
    • waitForSelector(\text=${APP_NAME}`)→expect(page.getByRole('contentinfo').getByText(APP_NAME)).toBeVisible() (no-wait-for-selector+expect-expect+ native locators). Footer is the env-driven app name; the header link is hardcoded"Starter Kit"`.
    • Dropped if (res === null) throw (no-conditional-in-test) in favor of expect(response).not.toBeNull() then expect(response?.status()).toBe(404).
    • Renamed 'test 404' → 'unknown route returns 404' (valid-title rejects a test prefix).
    • test as e2eTest → test so the plugin recognizes the test identifier.
  • apps/web/tests/e2e/app-fixture.ts: beforeAll / afterEach / afterAll (prefer-hooks-in-order). Behavior unchanged.

No dummy assertions, no fake timeouts, no { force: true }. No new oxlint-disable comments.

Commands run

  • pnpm --filter @acme/oxlint-config lint (now includes playwright.ts)
  • pnpm --filter @acme/oxlint-config typecheck
  • pnpm --filter @acme/web lint (0 warnings / 0 errors)
  • pnpm --filter @acme/web typecheck
  • pnpm lint — 16/16, 0 warnings / 0 errors
  • pnpm lint:ws (sherif) — clean
  • pnpm --filter @acme/logging test:ci — 2/2 passed
  • Isolation probe (temporary files, deleted): extras fire on e2e; Playwright rules do not fire on Vitest

Not run: Playwright e2e (pnpm --filter @acme/web e2e) — needs Docker/testcontainers on this VM. Apps/web unit tests likewise.

Remaining suppressions

None added. Pre-existing e2e override still offs no-empty-pattern (Playwright fixtures) and react-hooks/rules-of-hooks. tests/e2e/setup/db-setup.ts still has eslint/no-await-in-loop for sequential migrations.

Open in Web Open in Cursor 

Wire eslint-plugin-playwright@2.12.2 as an oxlint JS plugin scoped to
apps/web tests/e2e. Enable the plugin's recommended ruleset as errors,
plus prefer-native-locators and require-to-pass-timeout. Leave
no-force-option on (ComfyUI turned it off for canvas workarounds we
don't have).

Replace waitForSelector with a web-first footer assertion, drop the
conditional 404 throw, and put hooks in recommended order.

Co-authored-by: adriangoh <adriangoh@open.gov.sg>
@cursor

cursor Bot commented Nov 11, 2026

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
starter-kit Ready Ready Preview Nov 11, 2026 3:42pm UTC

Request Review

@datadog-opengovsg

datadog-opengovsg Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 59.79% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 64b3103 | Docs | Give us feedback!

Dependabot's playwright group should track @playwright/* only; lint
plugin versions are not coupled to the browser driver catalog.

Co-authored-by: adriangoh <adriangoh@open.gov.sg>
playwright.ts is shared config like e18e.ts, not the acme plugin.
typecheck already covers it.

Co-authored-by: adriangoh <adriangoh@open.gov.sg>
@adriangohjw
adriangohjw marked this pull request as ready for review November 11, 2026 15:47
Copilot AI lite review requested due to automatic review settings November 11, 2026 15:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Runtime validation remains outstanding because Docker/testcontainers were unavailable, leaving the changed Playwright smoke locators and fixture cleanup ordering untested.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

Adds eslint-plugin-playwright to the Oxlint configuration for Playwright end-to-end tests, updates workspace dependencies, and refactors existing E2E code to satisfy the new rules.

Changes:

  • Adds and configures the Playwright plugin with recommended rules and selected locator and timeout rules.
  • Scopes Playwright linting to apps/web/tests/e2e/** and updates workspace dependency metadata.
  • Replaces brittle smoke-test waits and conditional logic with native locators and web-first assertions.
  • Reorders E2E fixture hooks to follow Playwright conventions.
File Description
tooling/​oxlint/​playwright.ts Defines the Playwright JS plugin and configured E2E rule set.
tooling/​oxlint/​package.json Exports the Playwright configuration and adds its development dependency.
pnpm-workspace.yaml Adds the Playwright plugin version to the workspace dependency catalog.
pnpm-lock.yaml Records the Playwright plugin dependency graph and related lockfile updates.
apps/​web/​tests/​e2e/​smoke.e2e.ts Updates smoke tests to use native locators, web-first assertions, and valid test titles.
apps/​web/​tests/​e2e/​app-fixture.ts Reorders Playwright lifecycle hooks to satisfy the configured hook-order rules.
apps/​web/​package.json Adds the Playwright plugin dependency for the web workspace.
apps/​web/​oxlint.config.ts Scopes Playwright linting to the web app's E2E test files.

Review effort: Lite

@adriangohjw
adriangohjw merged commit ed441a0 into main Nov 11, 2026
14 checks passed
@adriangohjw
adriangohjw deleted the cursor/playwright-oxlint-plugin-6268 branch November 11, 2026 15:51

This branch was successfully deployed

1 active deployment
Preview — 64b31036 Deployed Nov 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants