sindresorhus/eslint-plugin-unicorn
`throw-new-error` false positive on decorator calls
Closed
#2,360 opened on May 16, 2024
bughelp wanted
Repository metrics
- Stars
- (5,022 stars)
- PR merge metrics
- (Avg merge 1d 16h) (399 merged PRs in 30d)
Description
after last release throw new error reports any call to function that are PascalCase and contains the word “Error” as invalid.
Example:
const ParseError = () => 0;
// this is reported as invalid
cont result = ParseError();
In my specific case I’m getting the error when using a class decorator to track custom error classes
@RegisterServiceError()
class SomeError extends BaseError {}
easiest solution would be to at least allow a list of name exceptions to the rule.