Skip to content

[✨] Create a lint rule for sync$() #265

@mhevery

Description

@mhevery

Is your feature request related to a problem?

Qwik now has a new feature, sync$(), however, it comes with limitations. It would be great if there was a lint rule which could flag when the developer is using it improperly

Describe the solution you'd like

A lint rule qwik/sync$ which would flag whenever the function inside the sync$() would close over any variables (other than browser API) and flag it.

Describe alternatives you've considered

We will create a Rust check as well, but that one will not be instant, and can't provide that much detail.

Additional context

import {foo} from '...

<button onClick$(sync$(() => {
    foo(); // <= lint error. Can't close over 'foo'
  }))>
    click
  </button>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions