Commit 9f7cbde
committed
fix(linter): consistent-function-scoping false positive with hoisted var declarations
The rule was incorrectly starting from the scope containing the variable binding
instead of the function's own scope. This caused false positives when var
declarations were hoisted to a parent scope while the function captured
variables from its lexical scope.
Fixes the issue by using the function's own scope to determine parent scopes.1 parent 85a34ce commit 9f7cbde
File tree
1 file changed
+12
-4
lines changed- crates/oxc_linter/src/rules/unicorn
1 file changed
+12
-4
lines changedLines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
185 | 191 | | |
186 | 192 | | |
187 | 193 | | |
| |||
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
| 224 | + | |
218 | 225 | | |
219 | 226 | | |
220 | 227 | | |
221 | 228 | | |
222 | 229 | | |
223 | 230 | | |
224 | 231 | | |
| 232 | + | |
225 | 233 | | |
226 | 234 | | |
227 | 235 | | |
| |||
237 | 245 | | |
238 | 246 | | |
239 | 247 | | |
| 248 | + | |
240 | 249 | | |
241 | 250 | | |
242 | 251 | | |
| |||
273 | 282 | | |
274 | 283 | | |
275 | 284 | | |
276 | | - | |
277 | | - | |
| 285 | + | |
278 | 286 | | |
279 | | - | |
280 | 287 | | |
281 | 288 | | |
282 | 289 | | |
| |||
749 | 756 | | |
750 | 757 | | |
751 | 758 | | |
| 759 | + | |
752 | 760 | | |
753 | 761 | | |
754 | 762 | | |
| |||
0 commit comments