gucong3000 / postcss-jsx

PostCSS syntax for parsing CSS in JS literals
MIT License
76 stars 28 forks source link

"Unknown word" syntax error for multiline arrow function #49

Closed hudochenkov closed 5 years ago

hudochenkov commented 5 years ago

When using a multiline arrow function "Unknown word" error is thrown.

I'm using the latest stylelint@9.10.1 which uses postcss-jsx@0.36.0:

> stylelint "**/*.styled.js"

Button.styled.js
 8:3  ✖  Unknown word   CssSyntaxError
import { css } from 'styled-components';

export const buttonStyles = css`
  border-radius: 4px;

  cursor: pointer;

  ${(props) => {
    return props.small && 'padding: 30px;';
  }}
`;

This issue is similar to https://github.com/gucong3000/postcss-styled/issues/37.

samuelkraft commented 5 years ago

Same error for me when using code like this:

import { css } from '@emotion/core'

const text = active => css`
  color: red;

  ${active &&
    css`
      color: green;
    `
   }
`