Skip to content

Commit

Permalink
Prevent unexpected case
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Jan 27, 2021
1 parent 7444144 commit b474d47
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rules/catch-error-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ const create = context => {
const scope = context.getScope();
const variable = findVariable(scope, node);

// This was reported https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1075#issuecomment-768072967
// But can't reproduce, just ignore this case
/* istanbul ignore next*/
if (!variable) {
return;
}

if (originalName === '_' && variable.references.length === 0) {
return;
}
Expand Down

0 comments on commit b474d47

Please sign in to comment.