Skip to content

[styled-components] adding extra semi at the end #2636

Closed

Description

@dlebedynskyi

Demo

Source

export const ButtonWrapper = styled.button`
  ${base}
  ${hover}
  ${opaque}
  ${block}
  ${active}
  ${disabled}
  ${outline}
  ${dashed}
  ${spacing}
`;

Expected

export const ButtonWrapper = styled.button`
  ${base}
  ${hover}
  ${opaque}
  ${block}
  ${active}
  ${disabled}
  ${outline}
  ${dashed}
  ${spacing}
`;

or

export const ButtonWrapper = styled.button`
  ${base} ${hover} ${opaque} ${block} ${active} ${disabled} ${outline} ${dashed} ${spacing}
`;

Problem
extra ; added to end of line after ${spacing}

export const ButtonWrapper = styled.button`
  ${base} ${hover} ${opaque} ${block} ${active} ${disabled} ${outline} ${dashed} ${spacing};
`;

Activity

  1. added
    lang:css/scss/less
    on Sep 5, 2017
  2. added
    area:multiparser
    on Oct 3, 2017
  3. danhoran commented on Oct 16, 2017

    @danhoran

    Could anyone point me in the direction of a workaround for this?

  4. suchipi commented on Oct 16, 2017

    @suchipi
    Member

    A // prettier-ignore comment should work as a workaround

  5. stevemao commented on Nov 20, 2018

    @stevemao

    There are quite a few interpolation problems similar to this. Do you guys consider reading tags just like how stylelint-processor-styled-components does it?

    sc-block
    sc-selector
    sc-declaration
    sc-property
    sc-value
    

    This might make parsing interpolations easier

  6. alexander-akait commented on Nov 20, 2018

    @alexander-akait
    Member

    stylelint-processor-styled-components is deprecated stylelint support styled components out of box using postcss-jsxm we should rewrite parser/print on postcss-jsx to avoid problems with output styled components

  7. stevemao commented on Nov 20, 2018

    @stevemao

    stylelint-processor-styled-components is deprecated

    Didn't know that. It looks quite active to me...

    I'm just throwing away an idea since nobody mentioned tags yet. But if there's a better solution it'd be really good :)

  8. fisker commented on Nov 5, 2019

    @fisker
    Member

    1.18.2 new ERROR

    Prettier 1.18.2
    Playground link

    --parser babylon

    Input:

    styled.button`
      ${base}
      ${hover}
      ${opaque}
      ${block}
      ${active}
      ${disabled}
      ${outline}
      ${dashed}
      ${spacing}
    `;

    Output:

    Error: Couldn't insert all the expressions
        at transformCssDoc (https://prettier.io/lib/standalone.js:22212:11)
        at Object.embed$4 [as embed] (https://prettier.io/lib/standalone.js:22050:18)
        at Object.printSubtree (https://prettier.io/lib/standalone.js:15816:31)
        at callPluginPrintFunction (https://prettier.io/lib/standalone.js:15934:29)
        at https://prettier.io/lib/standalone.js:15899:16
        at Object.printComments (https://prettier.io/lib/standalone.js:15621:17)
        at printGenerically (https://prettier.io/lib/standalone.js:15898:22)
        at FastPath.call (https://prettier.io/lib/standalone.js:15735:16)
        at printPathNoParens (https://prettier.io/lib/standalone.js:25282:91)
        at Object.genericPrint$3 [as print] (https://prettier.io/lib/standalone.js:23704:28)
  9. added
    locked-due-to-inactivity
    on Aug 6, 2020
  10. locked as resolved and limited conversation to collaborators on Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:multiparserlang:css/scss/lesslocked-due-to-inactivity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions