-
Notifications
You must be signed in to change notification settings - Fork 31
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
Lint warning when using props in solid-styled-components #29
Comments
Thanks for the issue! Integrating better with community projects is something that I want to do with the However, I don't really want to "bless" certain libraries with special cases while the ecosystem is still maturing. I thought about trying to accept custom cases from libraries, but that's a big ask. But I think there's a quick solution that will fix your issue while remaining neutral to specific libraries—allowing reactivity in expressions in any tagged template literal where the expression is an inline function. That's cases like: styled.div<{ opacity: number }>`
padding: ${(props) => props.theme?.spacing[1]};
`;
css`color: ${props => props.color}`;
html`<div>${props => props.name}</div>`;
log`hello world! ${function(otherProps) { return otherProps.greeting; }}`;
css`color: ${() => signal()}`; (but not these)// too easy to forget to call `signal` when the template tag expects a value, not a function
css`color: ${signal}`;
// no declared intent to pass the function, not the result of the function call
const f = a => signal() + a;
css`color: ${f}`; Any concerns? This will probably come out in |
that sounds great, thank you! 💯 agree about not making specific cases for specific libraries, so what you've suggested sounds like a good way forward 🙏 👍 |
This should be fixed in v0.7.2, thanks for your patience! |
Just FYI - I'm getting these warnings in |
When accessing props via solid-styled-components, lint warnings are shown:
in VSCode
via
eslint .
To Reproduce
Have put together a small repro here: https://github.com/kavsingh/solid-eslint-styled-repro
essentially:
styled.x
using tagged template literal, use a theme or custom prop as described here https://github.com/solidjs/solid-styled-components#tagged-templatesExpected behavior
Would be great to use props without lint warnings, or having to disable reactivity rules inline
Desktop (please complete the following information):
node --version
): 18eslint-plugin-solid
version (pnpm list eslint-plugin-solid
): eslint-plugin-solid 0.7.1eslint
version (pnpm list eslint
): eslint 8.20.0Additional context
Realise this is not vanilla solid, this should probably have been an enhancement / feature request but could not change the label after creating the issue. I can make a new feature request issue if it works better. Is there a way to to use solid-styled-components without producing lint warnings?
Thank you! 🙏
The text was updated successfully, but these errors were encountered: