Skip to content

Commit b6eba27

Browse files
committed
test(linter/no-undef): add more test cases for arguments (#13764)
1 parent 2ee5096 commit b6eba27

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/oxc_linter/src/rules/eslint/no_undef.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ fn test() {
183183
("function test() { return arguments; }", None, None),
184184
("var fn = function() { return arguments[0]; };", None, None),
185185
("const obj = { method() { return arguments.length; } };", None, None),
186+
// arguments in nested block scope within function should not be reported
187+
("function correct(a) { { return arguments; } }", None, None),
188+
("function test() { if (true) { return arguments[0]; } }", None, None),
189+
("function test() { for (let i = 0; i < 1; i++) { return arguments; } }", None, None),
186190
// ("AsyncDisposableStack; DisposableStack; SuppressedError", None, None), / es2026
187191
("function resolve<T>(path: string): T { return { path } as T; }", None, None),
188192
("let xyz: NodeListOf<HTMLElement>", None, None),

0 commit comments

Comments
 (0)