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

fix(css-in-js) Keep newlines in CSS-in-JS Templates (Fixes: #5147) #5240

Merged
merged 5 commits into from Nov 1, 2018

Conversation

Projects
None yet
4 participants
@onurtemizkan
Contributor

onurtemizkan commented Oct 10, 2018

Fixes: #5147

Keep newlines after CSS-in-JS quasi-literal substitutes.

  • 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)
  • I’ve read the contributing guidelines.
\`;
styled.span\`
\${foo}: \${bar};

This comment has been minimized.

@evilebottnawi

evilebottnawi Oct 10, 2018

Member

Looks we insert unnecessary semicolon, need fix it

\`;
styled.span\`
\${foo}: \${bar};

This comment has been minimized.

@evilebottnawi

evilebottnawi Oct 10, 2018

Member

Also semicolon was inserted 😞

@evilebottnawi

Need fix ; cases

@onurtemizkan

This comment has been minimized.

Contributor

onurtemizkan commented Oct 11, 2018

@evilebottnawi updated 😊

@evilebottnawi

Great job

@lydell

lydell approved these changes Oct 18, 2018

@evilebottnawi

This comment has been minimized.

Member

evilebottnawi commented Oct 18, 2018

@onurtemizkan Looks i find one strange problem, maybe not related, maybe related, will be great if you investigate.

Input:

export const FlexBox = styled.div`
  ${$var}

  > * {
      width: ${p => (p.howManyPerRow ? `${100 / p.howManyPerRow}%` : 'auto')};
  }
`

Output:

export const FlexBox = styled.div`
  ${$var}

  > * {
    width: ${p => (p.howManyPerRow ? `${100 / p.howManyPerRow}%` : "auto")};
  }
`;

All fine. But:

Input:

export const FlexBox = styled.div`
    ${$var}

    > * {
        width: ${p => (p.howManyPerRow ? `${100 / p.howManyPerRow}%` : 'auto')};
    }
`

Output:

export const FlexBox = styled.div`
  ${$var}

    > * {
    width: ${p => (p.howManyPerRow ? `${100 / p.howManyPerRow}%` : "auto")};
  }
`;

> * have extra indent

@onurtemizkan

This comment has been minimized.

Contributor

onurtemizkan commented Oct 19, 2018

@evilebottnawi Sure, checking.

@lydell

This comment has been minimized.

Collaborator

lydell commented Oct 25, 2018

@onurtemizkan Did you find anything? Would be awesome to get this into the next release. I guess we could merge as-is, too.

@onurtemizkan

This comment has been minimized.

Contributor

onurtemizkan commented Oct 25, 2018

@lydell, I haven't found it yet. Let's merge this and I'll create another issue to continue if it's ok.

@lipis

lipis approved these changes Nov 1, 2018

@lipis

This comment has been minimized.

Member

lipis commented Nov 1, 2018

Shall we take this in..?

@evilebottnawi

This comment has been minimized.

Member

evilebottnawi commented Nov 1, 2018

@lipis feel free to merge, problem with indent should be solved in other PR

@lipis lipis merged commit f6d8be8 into prettier:master Nov 1, 2018

10 checks passed

ci/circleci: build_prod Your tests passed on CircleCI!
Details
ci/circleci: checkout_code Your tests passed on CircleCI!
Details
ci/circleci: test_prod_node4 Your tests passed on CircleCI!
Details
ci/circleci: test_prod_node9 Your tests passed on CircleCI!
Details
ci/circleci: test_prod_standalone Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 80%)
Details
codecov/project Absolute coverage decreased by -<.01% but relative coverage increased by +3.77% compared to bb5a116
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details

@lipis lipis added this to the 1.15 milestone Nov 1, 2018

@lipis lipis referenced this pull request Nov 1, 2018

Merged

docs(blog): 1.15 release #5296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment