You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: immutability lint page lists push() and sort() mutations that the rule does not report #8758
The immutability page lists three "Invalid" examples. eslint-plugin-react-hooks 7.1.1 reports only the property assignment (user.name = 'Bob'). The items.push(4) and setItems(items.sort()) examples, and the todos.push() example under Troubleshooting, produce no diagnostic.
This is expected behavior per react/react#35157: method calls on state error only when the compiler knows the type, and it does not infer state types. The page presents them as cases the rule catches.
No diagnostic. The same component with user.name = 'Bob'; setUser(user) reports "This value cannot be modified".
Suggested fix: keep the property assignment as the "Invalid" example and move push() and sort() to a note that says the rule cannot detect method-call mutations on state yet (react/react#35157).
Activity