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

Add ignoreUnits: [] to number-max-precision #2785

Closed
ZachTRice opened this issue Jul 28, 2017 · 3 comments
Closed

Add ignoreUnits: [] to number-max-precision #2785

ZachTRice opened this issue Jul 28, 2017 · 3 comments
Labels
good first issue is good for newcomers status: wip is being worked on by someone type: new option a new option for an existing rule

Comments

@ZachTRice
Copy link

ZachTRice commented Jul 28, 2017

Describe the issue. Is it a bug or a feature request (new rule, new option, etc.)?

Feature request:

Add ignore: ["%", "ch", "cm", "em", "ex", "in", "mm", "pc", "pt", "px", "rem", "vh", "vmin", "vmax", "vw" ]

Which rule, if any, is this issue related to?

number-max-precision

What CSS is needed to reproduce this issue?

// New browsers are not effected by sub-pixel rounding; thus % rules should be ignored.
.foo {
  width: 66.666667%;
}

// If not an ignored unit (i.e. %), ensure it is equal to or less than the specified precision (in this case 1)
.bar {
  font-size: 9.5px;
}

What stylelint configuration is needed to reproduce this issue?

"number-max-precision": [1, {
  ignore: "%"
}],

Which version of stylelint are you using?

8.0.0

How are you running stylelint: CLI, PostCSS plugin, Node API?

grunt-postcss stylelint plugin; also tested with grunt-stylelint

Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?

No

What did you expect to happen?

I would like to constrain all units except for % based units to 1 number-max-precision. What I am suggesting is adding an option to ignore specific units, such as pixels, percentages, etc so that they are not constrained.

What actually happened (e.g. what warnings or errors you are getting)?

No errors. All units were constrained to 1 number-max-precision as I set but no additional functionality was available to ignore specific units.

@jeddy3
Copy link
Member

jeddy3 commented Sep 10, 2017

@ZachTRice Thanks for the request and for using the template. Sorry about the delay triaging this issue (holidays and what not...).

Also, thanks for illustrating your use case so clearly. I agree that the addition of a secondary option is what you need. As per the guidelines, it'd be called ignoreUnits: [] rather than ignore: [].

I'm going to label this issue as "new option" and "help wanted" (and "beginner friendly" as the rule makes use of the postcss-value-parser which should make checking the unit pretty easy). Please consider contributing this option if you have time. There's a section in the Developer Guide on how to get started.

@jeddy3 jeddy3 changed the title Add an ignore option to number-max-precision to exclude specific unit types Add ignoreUnits: [] to number-max-precision Sep 10, 2017
@jeddy3 jeddy3 added good first issue is good for newcomers status: ready to implement is ready to be worked on by someone type: new option a new option for an existing rule labels Sep 10, 2017
@jeddy3 jeddy3 added status: wip is being worked on by someone and removed status: ready to implement is ready to be worked on by someone labels Oct 5, 2017
@ntwb ntwb removed the Hacktoberfest label Nov 4, 2017
@b13nxx
Copy link
Member

b13nxx commented Aug 16, 2018

@jeddy3 I believe this issue is no longer matter.

@jeddy3
Copy link
Member

jeddy3 commented Aug 16, 2018

@GorwinJororis Thanks!

@jeddy3 jeddy3 closed this as completed Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue is good for newcomers status: wip is being worked on by someone type: new option a new option for an existing rule
Development

No branches or pull requests

4 participants