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
Rule Proposal: no-empty-pattern [$10] #3668
Comments
|
EDIT: I had forgotten |
What about |
Yes, this rule covers I thought this rule is super simple. return {
"ObjectPattern": function(node) {
if (node.properties.length === 0) {
context.report(node, "Unexpected empty object pattern.");
}
},
"ArrayPattern": function(node) {
if (node.elements.length === 0) {
context.report(node, "Unexpected empty array pattern.");
}
}
}; |
Yeah, seems like a good idea |
@mysticatea are you working on this? |
@alberto No yet. I am happy if you work on this :) |
Thanks, I'll give it a try. :) |
New: no-empty-pattern rule (fixes #3668)
@alberto there's a bounty on this issue that you can claim: https://www.bountysource.com/issues/26471568-rule-proposal-no-empty-pattern?utm_campaign=plugin&utm_content=tracker%2F282608&utm_medium=issues&utm_source=github |
That should go to @mysticatea, it was all his code. :) |
Okay, @mysticatea there's money for you! |
Spawned from #3658.
The following code does not raise an syntax error.
But it's considered developer's intent is below.
Because an empty
ObjectPattern
effects nothing.So this proposal defines new
no-empty-pattern
rule.This rule considers the following patterns as warnings:
This rule does not consider the following patterns as warnings:
I'm not sure this rule name is good.
Did you help close this issue? Go claim the $10 bounty on Bountysource.
The text was updated successfully, but these errors were encountered: