Repository navigation
Commit 9eed07a
committed
Clarify that immutability lint does not report method-call mutations on state
The immutability rule page listed items.push(), items.sort() and the
todos.push() troubleshooting example as violations the rule catches.
The compiler does not infer the types of state values, so it only
reports mutations it can prove (such as property assignment) and
produces no diagnostic for these method calls.
Keep the property assignment as the invalid example, add a note that
method-call mutations on state are not detected yet, and show a
non-mutating sort in the valid examples.1 parent 46a54e0 commit 9eed07a
1 file changed
Lines changed: 15 additions & 19 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 | + | |
49 | 36 | | |
50 | 37 | | |
51 | 38 | | |
| |||
59 | 46 | | |
60 | 47 | | |
61 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
62 | 58 | | |
63 | 59 | | |
64 | 60 | | |
| |||
73 | 69 | | |
74 | 70 | | |
75 | 71 | | |
76 | | - | |
| 72 | + | |
77 | 73 | | |
78 | 74 | | |
79 | 75 | | |
| |||
0 commit comments