ESLint should fail when using background or border property
Describe the issue
ESLint plugin doesn't warn about using background or border.
Expected behavior
It should warn
Steps to reproduce
Just add background or border as a property to stylex.props
Test case
No response
Additional comments
No response
Hi! I'd like to work on this issue. I'm planning to check how the valid-styles ESLint rule handles background and border shorthands, then add the appropriate validation and tests. Is this approach okay, and is anyone already working on it?
Thanks @anishsinghhh3-bit.
Just add background or border as a property to stylex.props
I assume it meant stylex.create?
From what I can see @stylexjs/valid-styles does flag using border but not background. The @stylexjs/valid-shorthands will flag either if they are multi-value. If looks like you can back background with @stylexjs/valid-styles by passing propLimits config:
'@stylexjs/valid-styles': ['error', {
propLimits: {
background: {
limit: null,
reason: 'Use backgroundColor, backgroundImage, etc. instead.',
},
},
}],
If you understand the issue enough it would be great to have some more examples/steps to recreate because it's not clear. Thanks!
Thanks for checking this! I think I got the idea, I'll look into how these rules works and try to reproduce the issue with some simple examples. I'll also check the propLimits thing you mentioned and see if thats already enough to fix it. Once I figure it out properly, I'll share the steps here.