Skip to content

Conversation

@mskelton
Copy link
Owner

@mskelton mskelton commented Jul 9, 2025

Fixes #365

@mskelton mskelton changed the title No unsafe references_for_addinitscript Support addInitScript in no-unsafe-references Jul 9, 2025
@mskelton mskelton requested a review from Copilot July 9, 2025 04:53
@mskelton mskelton added the ai Generated with Cursor or Claude Code label Jul 9, 2025
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 extends the no-unsafe-references ESLint rule to also support page.addInitScript(), updating code logic, tests, and documentation accordingly, and adjusts test scripts in package.json.

  • Added addInitScript handling in the rule’s checks, fixes, and error messages
  • Expanded test suite to cover page.addInitScript scenarios
  • Updated documentation and test scripts (package.json)

Reviewed Changes

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

File Description
src/rules/no-unsafe-references.ts Include addInitScript in isPageMethod checks, message data, and docs
src/rules/no-unsafe-references.test.ts Added numerous test cases and outputs for addInitScript
package.json Modified test and test:watch scripts to include --run
docs/rules/no-unsafe-references.md Updated examples and description to mention page.addInitScript
Comments suppressed due to low confidence (1)

package.json:39

  • The --run flag causes Vitest to exit immediately rather than watching. Remove --run to enable continuous watch mode.
    "test:watch": "vitest --reporter=dot --run",

@mskelton mskelton merged commit ef5e251 into main Jul 9, 2025
3 checks passed
@mskelton mskelton deleted the no-unsafe-references_for_addinitscript branch July 9, 2025 04:55
@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
* no-unsafe-references for addInitScript

* Update src/rules/no-unsafe-references.ts

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
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-unsafe-references for addInitScript

2 participants