-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
styled(component)(``) API not detected #30
Comments
It doesn't seem to be supported by Styled Components: https://codesandbox.io/p/sandbox/styled-components-base-forked-m4n2fg?file=%2FTitle.js%3A16%2C1 Is it something that Pigment CSS or Emotion support? |
@hudochenkov Ah, you are right, I jumped too quickly to a conclusion. It's Emotion that supports it: https://codesandbox.io/p/sandbox/styled-components-base-forked-2sxd28?file=%2FTitle.tsx%3A31%2C1 Pigment CSS supports it technically, but will throw TypeScript errors. I guess this makes the most sense, to have a single way to do things, so throw TypeScript to encourage developers to standardize. cc @brijeshb42 @mui/system supports this API like Emotion, but it feels like it should be standardized to behave like Pigment CSS. |
I feel that I think |
I also got tricked by https://github.com/styled-components/vscode-styled-components which highlights it. Issue created: styled-components/vscode-styled-components#446
Seems accurate https://github.com/emotion-js/emotion/blob/main/packages/styled/__tests__/styled.js. Ok, I'm happy to standardize on this. It makes sense to me to not make it possible to do things the same way. I'm removing these instances from the codebase of MUI. |
Closing as we reached a consensus. |
Hopefully, the VS Code plugin extension will agree 😄 styled-components/vscode-styled-components#446 |
If actual styled-components doesn't support that code, there is no point of linting it, or syntax highlight. Unless we want to support Emotion's undocumented feature :) |
postcss-styled-syntax/lib/parseJs.js
Line 33 in 1e38b42
is not enough to detect APIs like https://codesandbox.io/p/sandbox/styled-components-forked-v3yv3p?file=%2FTitle.js%3A10%2C1
but it works, should we fix this?
To be clear
styled(Component)``
works butstyled(Component)(``)
doesn't.The text was updated successfully, but these errors were encountered: