Skip to content
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

Break JSX element if a string literal prop has a newline #4011

Merged
merged 2 commits into from
Feb 21, 2018

Conversation

duailibe
Copy link
Member

Closes #3803

@duailibe
Copy link
Member Author

You might want to review it again, it didn't fix all the cases before :)

<path
d="M4.765 16.829l3.069-2.946 5.813 5.748
11.33-11.232 3.006 3.18-14.36 14.080z"
/>;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn’t this end up on the same line since jsxBracketSameLine is true?

Copy link
Member Author

@duailibe duailibe Feb 20, 2018

Choose a reason for hiding this comment

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

Nope

Prettier 1.10.2
Playground link

--jsx-bracket-same-line

Input:

<C
  propA="longlonglonglonglonglonglonglonglong"
  propB="longlonglonglonglonglonglonglonglong"
/>;

Output:

<C
  propA="longlonglonglonglonglonglonglonglong"
  propB="longlonglonglonglonglonglonglonglong"
/>;

That is meant to be visually similar to

<Parent>
  <Child />
</Parent>

Copy link
Member

Choose a reason for hiding this comment

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

Oh OK so it’s only inlined if it’s an opening element.

@duailibe duailibe merged commit 974b27d into prettier:master Feb 21, 2018
@duailibe duailibe deleted the jsx-multiline-prop branch February 21, 2018 13:52
lipis added a commit to lipis/prettier that referenced this pull request Feb 22, 2018
* 'master' of github.com:prettier/prettier:
  Add ComputerBase to list of users (prettier#4027)
  refactor: at rules parse (prettier#4023)
  refactor(css): printer (prettier#4024)
  Webstorm now supports Prettier (prettier#4026)
  Handle definite variable declarations (prettier#4025)
  fix(css): comments in at rules (prettier#3920)
  feat(typescript): support definite assignment (`!:`) (prettier#4020)
  Add support for markdown with pre-commit (prettier#4021)
  Remove extraneous newline in docs/plugins.md
  Break JSX element if a string literal prop has a newline (prettier#4011)
  Add license to website/package.json (prettier#4017)
  Add Ruby to homepage and code (prettier#4016)
  Add Google Site Verification file (prettier#4015)
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 18, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
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.

3 participants