Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 some properties with 0 value (#4250) #4394
Ignore some properties with 0 value (#4250) #4394
Changes from 3 commits
c7d8086
4f405c6
947abe7
26f02ae
7b31f62
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Not only
line-height
can contains<length> | <percentage>
, for example https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width, https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset and other, you can find them here https://github.com/mdn/data/blob/master/css/properties.json, also let's put them in https://github.com/stylelint/stylelint/tree/master/lib/referenceThere 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.
To be honest I completely lost the idea why I'd ignored
line-height
😕 .This is the same:
So in case of zero value the dimension unit is useless and the warning should be flagged (or it should be auto-fixed).
The only unit to ignore here is
fr
since0fr
and0
mean completely different things.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.
line-height: 0;
!==line-height: 0px;
Сlarifications and examples - cssnano/cssnano#768
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.
Make sense.
But what the point to ignore
stroke-width
for example. It doesn't matter whether it has unit or not. Example: https://jsfiddle.net/vc2otk06/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.
Oh, yes, my mistake, you are right, don't found other properties with same ability as
line-height
has, let's add tests for this cases: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.
The funny thing is these cases don't break tests in master branch but they have to.
I added some logic to process
font
declaration and updated test cases.