Skip to content
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

Missed semicolon CssSyntaxError in shadow-offset property #29

Open
carloslibardo opened this issue Feb 26, 2024 · 2 comments
Open

Missed semicolon CssSyntaxError in shadow-offset property #29

carloslibardo opened this issue Feb 26, 2024 · 2 comments

Comments

@carloslibardo
Copy link

What minimal example or steps are needed to reproduce the bug?

my component in styles.ts:

export const ButtonContainer = styled.View.attrs({ elevation: 15 })`
  background-color: ${({ theme: { COLORS } }) => COLORS.BACKGROUND};
  padding-horizontal: 24px;
  padding-vertical: 30px;
  shadow-offset: {width: 0, height: 2};
  shadow-opacity: 0.3;
  shadow-radius: 2px;
  shadow-color: #0000004D;
`;

The problem is at shadow-offset: {width: 0, height: 2};

What minimal configuration is needed to reproduce the bug?

my .stylelintrc:

{
    "processors": ["stylelint-processor-styled-components"],
    "extends": ["stylelint-config-react-native-styled-components"],
    "plugins": ["stylelint-react-native"],
    "customSyntax": "postcss-styled-syntax"
}

How did you run Stylelint?

stylelint './src/**/*.ts

Which Stylelint-related dependencies are you using?

    "stylelint": "^16.2.1",
    "stylelint-config-react-native-styled-components": "^0.7.0",
    "stylelint-processor-styled-components": "^1.10.0",
    "stylelint-react-native": "^2.7.0",
    "postcss-styled-syntax": "^0.6.4",

What did you expect to happen?

stylelint works without error.

What actually happened?

I'm getting this error: Missed semicolon CssSyntaxError

@hudochenkov
Copy link
Owner

hudochenkov commented Feb 27, 2024

It's a tough one, as it's React Native specific. This parser targets standard CSS syntax with some Styled Components features. {width: 0, height: 2} does not fall in any of these categories.

I will see what I can do, but I'm not optimistic.

For time being one workaround I could came up with is wrap this object syntax in interpolation:

export const ButtonContainer = styled.View`
  shadow-offset: ${`{width: 0, height: 2}`};
`;

@carloslibardo
Copy link
Author

It's a tough one, as it's React Native specific. This parser targets standard CSS syntax with some Styled Components features. {width: 0, height: 2} does not fall in any of these categories.

I will see what I can do, but I'm not optimistic.

For time being one workaround I could came up with is wrap this object syntax in interpolation:

export const ButtonContainer = styled.View`
  shadow-offset: ${`{width: 0, height: 2}`};
`;

This workaround solve my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants