hudochenkov / postcss-styled-syntax

PostCSS syntax for CSS-in-JS like styled-components
MIT License
69 stars 4 forks source link

[0.6.0] "Unexpected `}`" error when using comments in interpolation strings #26

Closed rgehan closed 6 months ago

rgehan commented 6 months ago

Hi!

Since v0.6.0, it seems having comments inside interpolation strings causes issues.

Repro test case:

const parse = require('../parse');

test('it should not fail with comments inside interpolation', () => {
    expect(() => {
        parse('let Component = styled.div`color: ${textColor /* very good color */}`;')
    }).not.toThrow();
});
expect(received).not.toThrow()

Error name:    "CssSyntaxError"
Error message: "<css input>:1:41: Unexpected }"

This fails on v0.6.0, but doesn't fail on v0.5.0.

Running a quick git bisect, I find 6c9cdaab23bccd980610c852131edffe6db22fae as the culprit commit.

hudochenkov commented 6 months ago

Thank you for reporting! Fixed in 0.6.1.