Skip to content

Commit b272b91

Browse files
committed
fix(linter/no-undef): false negative with unresolved ref after type ref (#11721)
fixes #11715
1 parent 6252275 commit b272b91

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Rule for NoUndef {
5454
let reference = symbol_table.get_reference(reference_id);
5555

5656
if reference.is_type() {
57-
return;
57+
continue;
5858
}
5959

6060
let name = ctx.semantic().reference_name(reference);
@@ -203,6 +203,7 @@ fn test() {
203203
("class C { static { var a; } } a;", None, None),
204204
("toString()", None, None),
205205
("hasOwnProperty()", None, None),
206+
("export class Foo{ bar: notDefined; }; const t = r + 1;", None, None),
206207
];
207208

208209
Tester::new(NoUndef::NAME, NoUndef::PLUGIN, pass, fail).test_and_snapshot();

crates/oxc_linter/src/snapshots/eslint_no_undef.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,9 @@ source: crates/oxc_linter/src/tester.rs
168168
1hasOwnProperty()
169169
· ──────────────
170170
╰────
171+
172+
eslint(no-undef): 'r' is not defined.
173+
╭─[no_undef.tsx:1:49]
174+
1export class Foo{ bar: notDefined; }; const t = r + 1;
175+
· ─
176+
╰────

0 commit comments

Comments
 (0)