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 positives for hex colours in color-function-notation #5638
Comments
|
This is not really an issue with stylelint as this relates to the fact that SCSS is interpreting the The Sass website has a page dedicated to the fact that SCSS is using slash as division. There is also an issue on their GitHub that is related: sass/sass#2565 There are really two options here:
|
I think bug report is correct. background-color: |
That's a good point. If this gets labeled up, I'd be keen to fix this issue. |
Thanks for the context! I think for now I can live with doing |
@m4thieulavoie no worries! It still seems like this is a bug as @hudochenkov pointed out because stylelint should not have suggested the change to the new color function syntax since |
Let's add an |
I'll pick this one up 👍🏻 |
@jeddy3 Should this check for all possible color functions by name? I have a version working that does as you say above—find first word node and check if it is valid hex—but wanted to check if it should be more like |
Nope. We just need the minimal amount of heuristics in it to identify non-standard syntax. We could make it nieve like
No need to check if it's a valid hex... just if it's a |
Thanks, makes sense. PR submitted! |
@lachieh, I tried out
|
@cascornelissen Yes, it won't catch that. Can create a new issue as we'll need discussion how, and even if, we can fix it for that pattern. |
After upgrading to the latest major, I experienced an issue with
color-function-notation
, and turns out it wasn't an issue per-say, but I thinkstylelint
could've made a better job at telling me the issue.So I had this rule prior to the upgrade
After running stylelint, I had the warning I should use
color-function-notation
(nice!). So what I did is the followingAfter that, stylelint passed. However, it was a false-positive as when I built my SCSS, it actually failed. I discovered that hex colors aren't allowed. The correct syntax is the following
background-color: rgba(255 255 255 / 0.85);
color-function-notation
Default one or the following
I don't think so?
A warning from stylelint directly in my code (with a tooltip)
✅ from stylelint when it actually was invalid code
The text was updated successfully, but these errors were encountered: