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
Fix false negatives for css-in-js object notation in color-hex-length #5106
Conversation
`style-search` returns false positives when used with `css-in-js` object notation. Continuing on the change made in stylelint#5101, this updates `color-hex-length` to switch to using `postcss-value-parser`. Unit tests have also been added to check the `css-in-js` syntax for this rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dru89 Fantastic. Besides one minor request, this looks good to me right off the bat!
lib/rules/color-hex-length/index.js
Outdated
|
||
return stringStart + replaceString + stringEnd; | ||
return decl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return decl; |
We can remove this redundant return as per the other pull request.
At some point later down the line, we should refactor to move at least the getValue
and setValue
functions out to /utils
. For now, let's duplicate them as you are doing, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Changelog:
|
Continuing on the change made in #5101 (for issue #4826), this updates
color-hex-length
to switch to usingpostcss-value-parser
becausestyle-search
returns false positives when used withcss-in-js
objectnotation.
Unit tests have also been added to check the
css-in-js
syntax for thisrule.