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
docs: Add example with object pattern to computed-property-spacing #14004
docs: Add example with object pattern to computed-property-spacing #14004
Conversation
Hi @whizzzkid!, thanks for the Pull Request The first commit message isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
Read more about contributing to ESLint here |
bc190dc
to
79e3bca
Compare
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.
Thanks, documenting the destructuring case is helpful! I left an inline suggestion to fix a syntax error in the example, but this'll be good to go once that's fixed.
@@ -14,6 +14,9 @@ var a = "prop"; | |||
var obj = { | |||
[a]: "value" // computed property key in object literal (ECMAScript 6) | |||
}; | |||
|
|||
// applies to the spacing for dynamic keys (computed property key) when destructuring objects. | |||
const ({ [a]: someProp } = obj); // someProp now maps to the value of prop. |
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.
Parentheses are invalid syntax here:
const ({ [a]: someProp } = obj); // someProp now maps to the value of prop. | |
const { [a]: someProp } = obj; // someProp now maps to the value of prop. |
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.
Wait, I think I did not read this right, that syntax looks wrong, that works, when assigning to a delcared variable:
let someProp;
({ [a]: someProp } = obj);
but if we are declaring a new variable:
const { [a]: someProp } = obj;
this is mentioned in this section: Assignment without declaration
Hi @whizzzkid!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
Read more about contributing to ESLint here |
d0f1a75
to
79e3bca
Compare
I marked this as 'evaluating' for now since there's an issue related to this change #12048 and it isn't accepted yet. I think it's most likely that we will accept this documentation update, at least for the |
Hi @whizzzkid!, thanks for the Pull Request The first commit message isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
Read more about contributing to ESLint here |
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.
@whizzzkid sorry for the delay, this PR is now accepted.
const ({ [a]: someProp } = obj);
is invalid syntax, If you are still interested in finishing this, I left a suggestion to fix the syntax and align the example with other examples.
|
||
// applies to the spacing for dynamic keys (computed property key) when destructuring objects. | ||
const ({ [a]: someProp } = obj); // someProp now maps to the value of prop. |
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.
// applies to the spacing for dynamic keys (computed property key) when destructuring objects. | |
const ({ [a]: someProp } = obj); // someProp now maps to the value of prop. | |
var { [a]: x } = obj; // computed property key in object destructuring pattern (ECMAScript 6) |
|
Hi @whizzzkid!, thanks for the Pull Request The first commit message isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by running Read more about contributing to ESLint here |
Closing due to age. |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
What changes did you make? (Give an overview)
I faced #14002 and added an example and wording to help others find it.
Is there anything you'd like reviewers to focus on?
the wording and the right place.