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

function-no-unknown false positives for interpolation and backticks in CSS-in-JS #6564

Closed
hudochenkov opened this issue Jan 8, 2023 · 1 comment · Fixed by #6565
Closed
Assignees
Labels
syntax: css-in-js relates to JS objects & template literals type: bug a problem with a feature or rule

Comments

@hudochenkov
Copy link
Member

What steps are needed to reproduce the bug?

CSS-in-JS code with interpolation ${} or with backticks `:

const Component = styled.div`
	border-radius: ${(props) => props.shape === 'pill' ? token.radiusPill : token.radiusBase};
	border-radius: ${(props) => props.shape === 'pill' ? `calc(${token.radiusPill} + 5px)` : token.radiusBase};
`;

Issues reproduced with postcss-styled-syntax and with @stylelint/postcss-css-in-js.

What Stylelint configuration is needed to reproduce the bug?

{
	"rules": {
		"function-no-unknown": true
	}
}

How did you run Stylelint?

stylelint "**/*.js"

Which version of Stylelint are you using?

14.16.1

What did you expect to happen?

No violations.

What actually happened?

test.ts
 2:17  ✖  Unexpected unknown function "${"     function-no-unknown
 3:17  ✖  Unexpected unknown function "${"     function-no-unknown
 3:55  ✖  Unexpected unknown function "`calc"  function-no-unknown

Does the bug relate to non-standard syntax?

CSS-in-JS

Proposal to fix the bug

Update isStandardSyntaxFunction to ignore such syntax.

@ybiquitous
Copy link
Member

Fixed by #6565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
syntax: css-in-js relates to JS objects & template literals type: bug a problem with a feature or rule
2 participants