Skip to content

Commit aa06c3f

Browse files
committed
fix(linter): recognize NewExpression as value context in no-unused-private-class-members (#15843)
fixes #15841
1 parent e18dd07 commit aa06c3f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ fn is_value_context(parent: &AstNode, child: &AstNode, semantic: &Semantic<'_>)
209209
match parent.kind() {
210210
AstKind::ReturnStatement(_)
211211
| AstKind::CallExpression(_)
212+
| AstKind::NewExpression(_)
212213
| AstKind::BinaryExpression(_)
213214
| AstKind::VariableDeclarator(_)
214215
| AstKind::PropertyDefinition(_)
@@ -493,6 +494,7 @@ fn test() {
493494
r"class ExampleFoo { #foo = 0; foo(foo) { foo = foo ?? this.#foo; return foo; } }",
494495
// Issue #15548: Private member used in update expression on RHS of assignment
495496
r"class ExampleBar { #bar = 0; bar(bar) { bar = ++this.#bar; return bar; } }",
497+
r"class Test { #url: string; constructor(url: string) { this.#url = url; } open() { return new WebSocket(this.#url); } }",
496498
];
497499

498500
let fail = vec![

0 commit comments

Comments
 (0)