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
Make no-useless-catch a core rule #11174
Comments
I'll support this! Although the rule definition exists, we would definitely need documentation and tests if we want to expose the rule as part of ESLint core. |
Cool. I'll look at existing rules and other PRs and try to come up with something. |
Moves no-useless-catch from an internal rule to a core rule. Adds docs and test cases.
Moves no-useless-catch from an internal rule to a core rule. Adds docs and test cases.
Okay, I've got a PR ready for this. |
Moves no-useless-catch from an internal rule to a core rule. Adds docs and test cases.
I've decided I'll champion this proposal. @not-an-aardvark @nzakas @ilyavolodin @kaicataldo Thoughts on adding this rule to core? I think it's a great idea personally. |
Sounds good to me. |
@not-an-aardvark Thoughts on this? This was accepted a little early but I'm hoping you might be willing to support this. There's a PR linked as well. Thanks! Edit: Oops, you are one of the original supporters, sorry... |
Please describe what the rule should do:
Prevents useless
catch
clauses that do nothing but rethrow the caught error. This rule already exists as an ESLint internal rule. Instead of just an internal rule, this should be a core rule.What category of rule is this? (place an "X" next to just one item)
[ ] Warns about a potential error (problem)
[X] Suggests an alternate way of doing something (suggestion)
[ ] Enforces code style (layout)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
Why should this rule be included in ESLint (instead of a plugin)?
As far as I know, there is no semantic difference between
and
Because of that, I can't think of a good reason why you would ever want a useless catch clause in any javascript codebase, seeing as how it just adds unnecessary clutter and complexity to your source code. It seems ESLint devs themselves agree since it exists as an internal rule.
Are you willing to submit a pull request to implement this rule?
If it is something that people want as a core rule, then sure.
The text was updated successfully, but these errors were encountered: