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
Ignore x
unit in some cases
#4427
Conversation
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.
Looks good!
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.
Let's add more tests, anyway good job, thanks!
{ | ||
code: 'a { image-resolution: 1x; }', | ||
description: 'ignore `x` unit in image-resolution', | ||
}, |
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.
Let's add test with @media (resolution: 2x) and (min-width: 200x) {}
, second should be rejected
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.
I had to update logic so that such a case could be handled properly.
Not sure about implementation though.
Any suggestions are welcome.
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.
I think we can parse media queries and improve logic
That's what I did in the last commit :) |
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.
Let's improve more, good job
lib/rules/unit-no-unknown/index.js
Outdated
if ( | ||
node.type === 'decl' && | ||
(node.prop.toLowerCase() === 'image-resolution' || /^image-set/i.test(node.value)) | ||
) { |
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.
I think we can parse decl here too, because you can use background: image-set("../../media/examples/star.png" 1x) left 20x / 15% 60% repeat-x
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.
Nice case. Updated the logic.
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.
/cc @hudochenkov
/cc @fanich37 Very good job! Thanks!
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.
LGTM!
|
It should close #3770 .
No, it's self explanatory.