Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error-message: false positive if Error shadowed #1431

Closed
unlight opened this issue Jul 18, 2021 · 1 comment · Fixed by #1496
Closed

error-message: false positive if Error shadowed #1431

unlight opened this issue Jul 18, 2021 · 1 comment · Fixed by #1496
Labels

Comments

@unlight
Copy link

unlight commented Jul 18, 2021

error-message false positive if Error shadowed

import Error from 'rerror';

// wrong: Error message should be a string
const err = new Error({
    name: 'Unauthorized',
});
@unlight unlight added the bug label Jul 18, 2021
@fisker
Copy link
Collaborator

fisker commented Jul 19, 2021

Add this

if (isShadowed(context.getScope(), callee)) {
return;
}
before
const constructorName = expression.callee.name;
will fix this, would you like to work on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants