jsx-eslint/eslint-plugin-react

[Bug]: `hook-use-state` suggested fix should update all reference

Open

#3.810 geöffnet am 31. Aug. 2024

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (2.797 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (8.630 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

The current fix suggested is to simply replace the variable, This isn't smart enough

It should update all references

https://github.com/user-attachments/assets/92187480-3b65-4667-a94b-66c8670de283

Expected Behavior

This is a custom react-hook-use-state rule I wrote. Before this, I didn’t know the existence of react/hook-use-state

it's smart enough

https://github.com/user-attachments/assets/196c5324-b1f8-41d7-8f5a-efd2c8342508

I have implemented almost all the functions of react/hook-use-state, but the logic is simpler

I checked the source code of hook-use-state, it is very complicated, and I can't modify it

I hope react/hook-use-state can also achieve this function by someone

eslint-plugin-react version

v7.35.0

eslint version

v9.9.1

node version

v20

Contributor Guide