Skip to content

Support addInitScript in no-unsafe-references #369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2025

Conversation

mskelton
Copy link
Member

@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 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",

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@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
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
…ty#369)

* no-unsafe-references for addInitScript

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
1 participant