Skip to content

Conversation

@mskelton
Copy link
Owner

@mskelton mskelton commented Jul 9, 2025

Fixes #363.

  • The no-conditional-in-test rule now only triggers for conditionals inside the test body, not in test metadata.
  • Added a test to ensure conditionals in test metadata are allowed.

@mskelton mskelton added the ai Generated with Cursor or Claude Code label Jul 9, 2025
@mskelton mskelton requested a review from Copilot July 10, 2025 01:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the no-conditional-in-test ESLint rule so that it only flags conditionals inside the actual test function body (not in the metadata object) and adds a new test case to verify this behavior.

  • Restrict reporting to ternaries within the test callback function
  • Early-return when the last argument isn’t a function
  • Add a valid test confirming metadata conditionals are allowed

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/rules/no-conditional-in-test.ts Wraps the existing report call in a check that the node is inside the test function body only
src/rules/no-conditional-in-test.test.ts Adds a valid test case ensuring conditionals in the metadata object do not trigger the rule
CLAUDE.md Introduces high-level project guidelines document
.cursor/rules/eslint-plugin-playwright.mdc Expands detailed internal ESLint-plugin development guidelines

@mskelton mskelton merged commit 12b0832 into main Jul 10, 2025
3 checks passed
@mskelton mskelton deleted the fix/no-conditional-in-test-metadata-363 branch July 10, 2025 04:20
@github-actions
Copy link

🎉 This PR is included in version 2.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

carlbray pushed a commit to carlbray/eslint-plugin-playwright that referenced this pull request Aug 17, 2025
… metadata (fixes mskelton#363) (mskelton#372)

* fix: no-conditional-in-test rule triggers for test metadata conditionals

* Agents win

* Sync

* Sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Generated with Cursor or Claude Code released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no-conditional-in-test rule triggers for test metadata conditionals (false-positive)

2 participants