Skip to content

False positive for eslint-plugin-unicorn(require-post-message-target-origin) #12026

@jpzwarte

Description

@jpzwarte
  ⚠ eslint-plugin-unicorn(require-post-message-target-origin): Missing the `targetOrigin` argument.
     ╭─[packages/web-shell/src/app/app.ts:116:77]
 115 │       if (event.data.action === 'getAccessToken') {
 116 │         event.ports[0].postMessage({ accessToken: this.#user?.access_token });
     ·                                                                             ─
 117 │       }
     ╰────
  help: Insert `, self.location.origin`

The above is incorrect. postMessage is not called on window here, but MessagePort. See https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/postMessage

Similar, but not the same as #10106

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linterArea - Lintergood first issueExperience Level - Good for newcomers

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions