Repository navigation
Commit 86e7156
committed
docs: clarify that immutability lint rule does not flag method mutations without inferred types
The immutability lint documentation previously listed array push() and sort()
under 'Invalid' examples as if the rule flagged them. However, per react/react#35157,
eslint-plugin-react-hooks only produces diagnostics on property assignments unless
the compiler can infer the type.
This updates the examples to present property assignment as the verified invalid
example and adds an explanatory Note explaining why method mutations do not emit
a diagnostic while remaining bad practice.
Fixes #87581 parent 46a54e0 commit 86e7156
1 file changed
Lines changed: 7 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 20 | | |
31 | 21 | | |
32 | 22 | | |
| |||
36 | 26 | | |
37 | 27 | | |
38 | 28 | | |
| 29 | + | |
39 | 30 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 31 | + | |
43 | 32 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
49 | 38 | | |
50 | 39 | | |
51 | 40 | | |
| |||
0 commit comments