Skip to content

Commit

Permalink
test: add preact ignore test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
DonIsaac committed Jul 30, 2024
1 parent 8572261 commit e97aa72
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions crates/oxc_linter/src/rules/eslint/no_unused_vars/tests/oxc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,23 @@ fn test_functions() {
#[test]
fn test_imports() {
let pass = vec![
"import { a } from 'b'; console.log(a)",
"import * as a from 'a'; console.log(a)",
"import a from 'a'; console.log(a)",
"import { default as a } from 'a'; console.log(a)",
("import { a } from 'b'; console.log(a)", None),
("import * as a from 'a'; console.log(a)", None),
("import a from 'a'; console.log(a)", None),
("import { default as a } from 'a'; console.log(a)", None),
(
"import { createElement } from 'preact/compat';",
Some(json!([{ "varsIgnorePattern": "^(h|React|createElement)$" }])),
),
(
"import { createElement } from 'preact/compat';",
Some(json!([{ "args": "none", "varsIgnorePattern": "^(h|React|createElement)$" }])),
),
];
let fail = vec![
"import { a } from 'a'",
"import * as a from 'a'",
"import { a as b } from 'a'; console.log(a)",
("import { a } from 'a'", None),
("import * as a from 'a'", None),
("import { a as b } from 'a'; console.log(a)", None),
];

Tester::new(NoUnusedVars::NAME, pass, fail)
Expand Down

0 comments on commit e97aa72

Please sign in to comment.