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 unit-no-unknown
false positives for the second and subsequent image-set()
with x
descriptor
#6721
Comments
@chalkygames123 Thanks for the report using the template. We can reproduce the problem with the demo. As a workaround, you can avoid the problem using the {
"rules": {
"unit-no-unknown": [true, {"ignoreFunctions": ["image-set"]}]
}
} I guess we can fix the false positive by changing the following code: stylelint/lib/rules/unit-no-unknown/index.js Line 121 in 964b1ba
I've labeled the issue as ready to implement. Please consider contributing if you have time. There are steps on how to fix a bug in a rule in the Developer guide. |
image-set()
with x
descriptor in unit-no-unknown
ruleunit-no-unknown
false positives for the second and subsequent image-set()
with x
descriptor
Thank you for the guidance, I'm on it! |
@ybiquitous Could you give me some explanation especially about what these lines do because I'm not familiar with the Stylelint codebase? stylelint/lib/rules/unit-no-unknown/index.js Lines 133 to 135 in 964b1ba
|
@chalkygames123 The lines you pointed out came from PR #4427. I'm not sure since the PR is old, but maybe I guess the lines handle the following case (see stylelint/lib/rules/unit-no-unknown/__tests__/index.js Lines 459 to 467 in 964b1ba
This logic's implementation has a few deeper nested |
Thank you. So I'll open a draft PR with minimal changes, then let me have some time to refactor it. |
Was looking at this because it is relevant for the migration to a different parser for media queries. Why isn't https://github.com/stylelint/stylelint/blob/main/lib/reference/units.js#L79-L82 // Resolution
'dpi',
'dpcm',
'dppx', specification : https://drafts.csswg.org/css-values-4/#resolution mdn : https://developer.mozilla.org/en-US/docs/Web/CSS/resolution |
Oh, I didn't know it. The reason to ignore |
If I read those correctly the main motivation seems to be that |
@romainmenke Yes, your understanding is correct. 👍🏼 |
What steps are needed to reproduce the bug?
Just lint the following CSS with
unit-no-unknown
turned on.test.css
:What Stylelint configuration is needed to reproduce the bug?
How did you run Stylelint?
CLI with
stylelint test.css
Which version of Stylelint are you using?
15.3.0
What did you expect to happen?
No problems to be reported.
What actually happened?
The
unit-no-unknown
rule reports the following problems when using thex
unit in a value for animage-set()
function.Related: #4654
Does the bug relate to non-standard syntax?
No.
Proposal to fix the bug
No response
The text was updated successfully, but these errors were encountered: