Skip to content

solid/reactivity gives warning on class creation #184

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

Open
hyperknot opened this issue May 17, 2025 · 0 comments
Open

solid/reactivity gives warning on class creation #184

hyperknot opened this issue May 17, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@hyperknot
Copy link

hyperknot commented May 17, 2025

Describe the bug

I'm using the following classic pattern:

class UIStore {
  state
  setState

  constructor() {
    const [state, setState] = createStore({
      init: false,
    })

    this.state = state // <-- ESLint Warning
    this.setState = setState
  }
...

ESLint returns for the state line

warning  The reactive variable 'state' should be used within JSX, a tracked scope (like createEffect), or inside an event handler function, or else changes will be ignored  solid/reactivity

To Reproduce
Just try the code above, config is default

import solid from 'eslint-plugin-solid/configs/typescript'

Expected behavior
It should be OK.

Environment (please complete the following information):

  • OS: macOS 15.4.1
  • Node version (node --version): v22.13.1
    eslint 9.25.1
    eslint-plugin-solid 0.14.5
@hyperknot hyperknot added the bug Something isn't working label May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants