Skip to content

Conversation

@fisker
Copy link
Member

@fisker fisker commented Jan 15, 2020

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/pr-XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

Copy link
Contributor

@jamesgeorge007 jamesgeorge007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left couple of comments.

const ind = x[0];
const mode = x[1];
const doc = x[2];
const [ind, mode, doc] = x;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const [ind, mode, doc] = x;
const [ind, mode, doc] = cmds.pop();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see the variable x serving it's purpose anywhere else.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, updated. Thanks!

@thorn0
Copy link
Member

thorn0 commented Jan 15, 2020

I'm really not sure the readability improves in simple cases like this (with only one variable declared):

-  const child = node.children[0];
+  const [child] = node.children;

Let's keep them as is.

@fisker fisker force-pushed the style/array-destructuring branch from a3380b6 to cfcbdaf Compare January 15, 2020 17:00
@thorn0 thorn0 merged commit 4abd19a into prettier:next Jan 15, 2020
@fisker fisker deleted the style/array-destructuring branch January 15, 2020 17:28
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Apr 15, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants