Skip to content

non-fatal css syntax errors are now fatal in v6 #4361

Closed

Description

@pyb4430

Environment

"react": "18.2.0",
"react-native": "^0.74.5",
"styled-components": "^6.1.13",

Steps to reproduce

Render a styled view like this:

export const StyledView = styled.View`
  justify-content: center
  align-content: center;
`

Expected behavior

The missing semicolon or other css syntax errors dont cause a crash, and are just picked up by our linter.

Actual behavior

The app crashes with the following error:

 ERROR  CssSyntaxError: <css input>:5:26: Missed semicolon

This error is located at:
    in Styled(View) (created by Scan)

This started happening after upgrading from:

"react": "18.2.0",
"react-native": "^0.71.0",
"styled-components": "^5.2.1",

In v5 such css syntax errors appear to have been handled gracefully without a crash.

While linting catches a lot of these syntax errors, the real issue is that by upgrading, there may be areas in our app where we've forgotten to wrap css strings in the css helper:

export const StyledView = styled.View<{condition: boolean}>`
  ${({condition}) => condition ? `justify-content: center` : undefined}
`

that will now cause a crash in our production app. I haven't been able to find a way for stylelint to catch that error, but maybe I'm missing something.

Activity

  1. added 2 commits that reference this issue on Mar 19, 2026
    bea06a3
    5ef3804
  2. quantizor commented on Mar 19, 2026

    @quantizor
    Contributor

    This fix is available in [email protected]. Please try it and report any issues:

    npm install [email protected]
    
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions