How to solve `Unknown word (CssSyntaxError)` of a variable name in `styled-jsx` (stylelint)
Asked Answered
I

0

7

I use Next.js with styled-jsx together with stylelint and everything goes well until when I start to use variables in styled-jsx because stylelint throw stylelint(CssSyntaxError) on those variables.

For example

const Button = ({ color }) => (
  <>
    <button>Hello World!</button>

    <style jsx>{`
      button {
        color: ${color || 'blue'};
                 ^^^^^ Unknown word (CssSyntaxError)
      }
    `}</style>
  </>
)

I don't know how to fix it or is it have any plugins that can help.

Immure answered 21/9, 2019 at 0:12 Comment(1)
Have you tried to rename your variable to something different? customColor e.g. ?Townsley

© 2022 - 2024 — McMap. All rights reserved.