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 Change: no-empty-pattern allow parameters #16931
Comments
Hi @Faithfinder, thanks for the issue. This looks like a duplicate of #13315. The original issue could not get enough support from the team and hence was closed. We currently aren't adding any new options or changes to the stylistic rules due to policy changes. You can always clone the existing rule and create a custom rule to fit your needs. I'm not closing this for now since I'm not sure if this fits the description of a stylistic rule. Leaving it open for someone from the core team to look at. |
Ah! Sorry I didn't do a good enough search. I don't think it's entirely stylistic though. I'll await the verdict then |
This rule is of I support this proposal 👍 though I'm not sure how common this pattern is as it doesn't work in case the argument can be nullish. Curious what other team members think about the proposal. |
This proposal makes sense to me 👍🏻. Any suggestions for the option's name? |
|
Perhaps something like I think the option should work like this: ({}) => {}; // ok
({} = {}) => {}; // also ok
({ foo: {} }) => {}; // not ok
([]) => {}; // not ok "in" parameters might suggest that empty patterns anywhere inside parameters would be allowed, e.g., "Object" because it only allows empty object patterns, not array patterns. |
👍🏻 for |
I don't see why arrays shouldn't be allowed. Might be a natural choice in Typescript land, where the fact that it's an array is apparent |
@mdjermanovic, as per above comment
Here you said And is this new option only should allow the 'ObjectPatterns' in Arrow function and not for the function declaration? |
Yes, this should be an error. The empty pattern appears in parameters but it isn't in a parameter position so it doesn't make sense for the purpose of this option.
It should be allowed only at the first level, as the purpose is to skip positions in parameter lists.
It should allow empty object pattern parameters in ArrowFunctionExpression, FunctionDeclaration and FunctionExpression nodes. |
What rule do you want to change?
no-empty-pattern
What change to do you want to make?
Generate fewer warnings
How do you think the change should be implemented?
A new option
Example code
What does the rule currently do for this code?
Warns
What will the rule do after it's changed?
I think this is a valid pattern as opposed to having
_something
naming scheme. I would love an option to allow this.Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: