Skip to content

Commit

Permalink
fix: do not report as unused import when parent is null, fix #100
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 12, 2024
1 parent 9748679 commit 7252cca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/rules/load-rule.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Rule } from "eslint";
import { createRequire } from 'module'
import { createRequire } from "module";

let rule: Rule.RuleModule | undefined;

Expand Down
4 changes: 3 additions & 1 deletion src/rules/predicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ function makePredicate(
? /^Import(|Default|Namespace)Specifier$/.test(parent.type) == isImport
? Object.assign(problem, addFixer?.(parent, sourceCode))
: false
: problem;
: isImport
? false
: problem;
};
}

Expand Down

0 comments on commit 7252cca

Please sign in to comment.