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
Copy file name to clipboardExpand all lines: docs/src/rules/no-loop-func.md
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -140,3 +140,20 @@ for (var i = 0; i < 5; i++) {
140
140
```
141
141
142
142
:::
143
+
144
+
## Known Limitations
145
+
146
+
The rule cannot identify whether the function instance is just immediately invoked and then discarded, or possibly stored for later use.
147
+
148
+
```js
149
+
constfoo= [1, 2, 3, 4];
150
+
var i =0;
151
+
152
+
while(foo.some(e=> e > i)){
153
+
i +=1;
154
+
}
155
+
```
156
+
157
+
Here the `some` method immediately executes the callback function for each element in the array and then discards the function instance. The function is not stored or reused beyond the scope of the loop iteration. So, this will work as intended.
158
+
159
+
`eslint-disable` comments can be used in such cases.
0 commit comments