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
Add no-object-as-default-parameter
rule
#633
Add no-object-as-default-parameter
rule
#633
Conversation
How about name |
disallow-objects-as-default
ruleno-object-as-default
rule
On second though, will people think this rule forbid this following syntax? export {
object as default,
// ^
foo as bar
}; |
I don't think users will mix that up. The description is pretty clear about the rule's purpose. |
I would name the rule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests about class/object methods.
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
no-object-as-default
ruleno-object-as-default-parameter
rule
Could you please elaborate? I'm not quite sure what you mean. |
Please test class A {
method(foo = {bar:1}) {}
} const A = class {
method(foo = {bar:1}) {}
} object = {
method(foo = {bar:1}) {}
} Maybe also constructor and getter setter And const foo = ([bar = {a = false, b = 123}]) => {}; const foo = ({bar: baz = {a = false, b = 123}}) => {}; const foo = ({foo = {a = false, b = 123}}) => {}; I'm on cellphone, didn't format well. |
Is this syntactically correct? It gives me
I've added tests for the constructor and setter, it doesn't seem like getters allow parameters. |
|
Okay , if it's not valid, I mean to test deep destructuring.
Okay. |
Looks good , I'll check again when I back to my laptop. |
Thank you. I really appreciate your constructive feedback, it's always very helpful 👍. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one note.
Great! Looks good to me too 👍 |
Simply reports any default-assignments of objects to function parameters as described in this comment.
Fixes #208
IssueHunt Summary
Referenced issues
This pull request has been submitted to:
IssueHunt has been backed by the following sponsors. Become a sponsor