Skip to content

Commit

Permalink
chore: cargo lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Aug 28, 2024
1 parent 7dd3773 commit b21c5a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions crates/oxc_linter/src/rules/eslint/no_unused_vars/allowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ impl<'s, 'a> Symbol<'s, 'a> {
// e.g. var foo = function bar() { }
// we don't want to check for violations on `bar`, just `foo`
| AstKind::VariableDeclarator(_)
// new (class CustomRenderer{})
// new (function() {})
| AstKind::NewExpression(_)
=> {
return true;
}
Expand All @@ -59,11 +62,6 @@ impl<'s, 'a> Symbol<'s, 'a> {
};
return body.span.contains_inclusive(self.span()) && body.statements.len() == 1 && !self.get_snippet(body.span).starts_with('{')
}
// new (class CustomRenderer{})
// new (function() {})
AstKind::NewExpression(_) => {
return true;
}
_ => {
parent.kind().debug_name();
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ fn test_vars_simple() {
("let _a = 1", Some(json!([{ "varsIgnorePattern": "^_" }]))),
("const { foo: _foo, baz } = obj; f(baz);", Some(json!([{ "varsIgnorePattern": "^_" }]))),
(
r#"export const rendered = marked(markdown, {
renderer: new (class CustomRenderer extends Renderer {})(),
});"#,
r"export const rendered = marked(markdown, {
renderer: new (class CustomRenderer extends Renderer {})(),
});",
None,
),
];
Expand Down

0 comments on commit b21c5a9

Please sign in to comment.