forked from prettier/prettier
-
Notifications
You must be signed in to change notification settings - Fork 14
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 --align-object-properties option #7
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test code o = { 2:3, "k-2":2, keyasdf:3 } TODO make Identifier case more robust, note how it puts the padding inside the concat, not outside, need to account for type annotation
It's possible to detect simple computed names like `[someVariable]` and handle those, but don't bother for now.
Since nodeStr can change the length of the string, we should use it instead of just using n.value
This will likely break down if the name computation spans multiple lines, but it's probably best not to do that anyway.
Thank you! I will do that 👍 |
I've updated the master branch, can you please rebase? Thanks! 😊 |
…gn-object-properties
I just fixed the conflicts. Not sure why a test failed, but it seems unrelated to this change: https://travis-ci.org/arijs/prettier-miscellaneous/jobs/234104749#L1027-L1032 |
Alright, I'll just merge it and try on master. 👍 |
This was referenced May 19, 2017
This is not on the website yet though, is it? |
brody4hire
pushed a commit
to bangkokjs/prettierx-0.4.x-fork
that referenced
this pull request
Jan 1, 2019
ported from prettier-miscellaneous (arijs#7 & arijs#8) with some adaptations by @brodybits (Christopher J. Brody <[email protected]>), including: * adapt const shouldBreak = hasNewlineInRange(...) for newer version of prettier * extra comment & spacing * add object to test to ensure that it does not get unwanted padding * adapt tests/align-object-properties/__snapshots__/jsfmt.spec.js.snap for newer version of prettier XXX TODO ITEMS including: * export & check alignObjectProperties option * resolve issue with object partially but not completely defined on the first line Co-authored-by: Joseph Frazier <[email protected]> Co-authored-by: Christopher J. Brody <[email protected]>
2 tasks
brody4hire
pushed a commit
to bangkokjs/prettierx-0.4.x-fork
that referenced
this pull request
Jan 14, 2019
feature ported from prettier-miscellaneous (arijs#7 & arijs#8) with adaptations by @brodybits (Christopher J. Brody <[email protected]>), including: * JavaScript tests in es test subdirectory * not applied with any of the JSON parsers, as verified by json test (not applied in case parser matches /json/ pattern) * --align-object-properties option config & docs adapted (copy-pasted) into newer prettier/prettierx project structure * const shouldBreak hack updated (and reformatted), can now deal with an object that is partially but not completely defined on the first line, as verified by an additional test object * extra comment(s) & spacing * additional testing to ensure that it does not get unwanted padding in case an object is on a single line * hack with fix for object partially but not completely defined on the first line, with additional test to verify * test coverage on babel, flow, and typescript parsers * test with shorthand object member * tests_integration updates * some other added tests * lint fixes Co-authored-by: Christopher J. Brody <[email protected]> Co-authored-by: Joseph Frazier <[email protected]> Co-authored-by: Rafael Hengles <[email protected]> Co-authored-by: Ika <[email protected]> Co-authored-by: Lucas Azzola <[email protected]>
brody4hire
pushed a commit
to bangkokjs/prettierx-0.4.x-fork
that referenced
this pull request
Jan 14, 2019
feature ported from prettier-miscellaneous (arijs#7 & arijs#8) with adaptations by @brodybits (Christopher J. Brody <[email protected]>), including: * JavaScript tests in es test subdirectory * not applied with any of the JSON parsers, as verified by json test (not applied in case parser matches /json/ pattern) * --align-object-properties option config & docs adapted (copy-pasted) into newer prettier/prettierx project structure * const shouldBreak hack updated (and reformatted), can now deal with an object that is partially but not completely defined on the first line, as verified by an additional test object * extra comment(s) & spacing * additional testing to ensure that it does not get unwanted padding in case an object is on a single line * hack with fix for object partially but not completely defined on the first line, with additional test to verify * test coverage on babel, flow, and typescript parsers * test with shorthand object member * tests_integration updates * some other added tests * lint fixes Co-authored-by: Christopher J. Brody <[email protected]> Co-authored-by: Joseph Frazier <[email protected]> Co-authored-by: Rafael Hengles <[email protected]> Co-authored-by: Ika <[email protected]> Co-authored-by: Lucas Azzola <[email protected]>
brody4hire
pushed a commit
to bangkokjs/prettierx-0.4.x-fork
that referenced
this pull request
Jan 14, 2019
feature ported from prettier-miscellaneous (arijs#7 & arijs#8) with adaptations by @brodybits (Christopher J. Brody <[email protected]>), including: * JavaScript tests in es test subdirectory * not applied with any of the JSON parsers, as verified by json test (not applied in case parser matches /json/ pattern) * --align-object-properties option config & docs adapted (copy-pasted) into newer prettier/prettierx project structure * const shouldBreak hack updated (and reformatted), can now deal with an object that is partially but not completely defined on the first line, as verified by an additional test object * extra comment(s) & spacing * additional testing to ensure that it does not get unwanted padding in case an object is on a single line * hack with fix for object partially but not completely defined on the first line, with additional test to verify * test coverage on babel, flow, and typescript parsers * test with shorthand object member * tests_integration updates * some other added tests * lint fixes Co-authored-by: Christopher J. Brody <[email protected]> Co-authored-by: Joseph Frazier <[email protected]> Co-authored-by: Rafael Hengles <[email protected]> Co-authored-by: Ika <[email protected]> Co-authored-by: Lucas Azzola <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in prettier#1622 (comment)
Since this is based off of upstream prettier's master branch, that should be merged first to eliminate conflicts. The meaningful changes in this PR are in only the last handful of commits (the ones not in upstream master).