Skip to content

An error appears randomly when using "css" function inside template string - ':' term expected" #76

@vitalybe

Description

@vitalybe
  • IDE name and version:
    WebStorm 2019.2.3
    Build #WS-192.6817.13, built on September 24, 2019
    Runtime version: 11.0.4+10-b304.69 x86_64
    VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    macOS 10.13.6
  • Styled-components plugin version:
    1.0.11

Problem description:

In some cases, when there is a css function inside templated string I'm getting the following error: ':' term expected

This error doesn't appear all the time. If I play around with the code it will randomly hide and appear later on. This error only appears when the plugin is enabled, so I assume it comes from it. This behavior seems to be a regression since I've been using the plugin for a long time and never saw it before.

Example of code that this error sometimes appear:

const OptionLabel = styled.div`
  ${(props: {}) => css`
    margin-bottom: 0.3em;
  `};
`;

Screenshot:

image

Adding/Removing a semicolon doesn't help. The only solution I found so far is to avoid nesting css entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions