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

Fix false negatives for css-in-js object notation in color-hex-length #5106

Merged
merged 2 commits into from Jan 19, 2021

Conversation

Dru89
Copy link
Contributor

@Dru89 Dru89 commented Jan 13, 2021

Continuing on the change made in #5101 (for issue #4826), this updates
color-hex-length to switch to using postcss-value-parser because
style-search returns false positives when used with css-in-js object
notation.

Unit tests have also been added to check the css-in-js syntax for this
rule.

`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.
Copy link
Member

@jeddy3 jeddy3 left a 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!


return stringStart + replaceString + stringEnd;
return decl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@jeddy3 jeddy3 changed the title Use postcss-value-parser for color-hex-length Fix false negatives for css-in-js object notation in color-hex-length Jan 15, 2021
Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jeddy3 jeddy3 merged commit dcaac08 into stylelint:master Jan 19, 2021
@jeddy3
Copy link
Member

jeddy3 commented Jan 19, 2021

Changelog:

  • Fixed: color-hex-length false negatives for css-in-js object notation (#5106).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants