qwik icon indicating copy to clipboard operation
qwik copied to clipboard

Eslint: detect bad usage of use-methods

Open manucorporat opened this issue 3 years ago • 0 comments

Is your feature request related to a problem?

use- methods can only be called in specific situations, and right now only the runtime will error after execution. It should be easy to detect at linting time using eslint:

Describe the solution you'd like

Rules

  • They can only be called at the root level of a function / arrow function context, not inside branches or other conditional blocks
  • They can only be called in component$
  • They can only be called from another use- method. (allowing composition)

Describe alternatives you've considered

Improve errors in the runtime for this particular issue

Additional context

No response

manucorporat avatar Jun 21 '22 07:06 manucorporat