Closed euanmillar closed 6 years ago
${} causes a stylelint false positive for no-duplicate-selectors when using non standard selectors in styled-components
${}
const StyledButton = styled(PrimaryButton)` justify-content: center; ${ButtonIcon} { margin: 1em }
Discovered here:
https://github.com/jembi/OpenCRVS/commit/8d7e89d128dc766ae21803176119b8f9035749e7#diff-08e3b93dc8a702ba003519765ab8fd14
Stylelint issue raised here: https://github.com/stylelint/stylelint/issues/2199
This could be expected behaviour for Stylelint, and in fact the error could be an issue with StyledComponents "styled" method.
The only solution for now is to disable stylelint for this pattern:
const StyledButton = styled(PrimaryButton)` justify-content: center; /* stylelint-disable */ ${ButtonIcon} { /* stylelint-enable */ margin: 1em }
This is resolved with Interpolation tagging:
${/* sc-sel */ ButtonIcon} { margin: 1em }
https://www.styled-components.com/docs/tooling#interpolation-tagging
${}
causes a stylelint false positive for no-duplicate-selectors when using non standard selectors in styled-componentsDiscovered here:
https://github.com/jembi/OpenCRVS/commit/8d7e89d128dc766ae21803176119b8f9035749e7#diff-08e3b93dc8a702ba003519765ab8fd14
Stylelint issue raised here: https://github.com/stylelint/stylelint/issues/2199
This could be expected behaviour for Stylelint, and in fact the error could be an issue with StyledComponents "styled" method.
The only solution for now is to disable stylelint for this pattern: