Skip to content

solid/reactivity gives warning on class creation #184

Open
@hyperknot

Description

@hyperknot

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions