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

Fix false positives for flex shorthand with 2 values in length-zero-no-unit #4831

Closed
Sultanidze opened this issue Jun 16, 2020 · 2 comments
Closed
Labels
status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule

Comments

@Sultanidze
Copy link

Clearly describe the bug

There is false negative for 0px in the flex shorthand rule:
flex: 1 0px;

It is ambiguous situation for two values in flex shorthand property,
according to documentation:
https://developer.mozilla.org/en-US/docs/Web/CSS/flex

Two values: flex-grow | flex-basis:

flex: 1 0px;

Two values: flex-grow | flex-shrink:

flex: 1 0;

Which rule, if any, is the bug related to?

e.g. length-zero-no-unit

What code is needed to reproduce the bug?

.wrapper {
  flex: 1 0px;
}

What stylelint configuration is needed to reproduce the bug?

{
  "rules": {
    "length-zero-no-unit": true,
  }
}

Which version of stylelint are you using?

13.6.0

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

via stylelint-webpack-plugin

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

No

What did you expect to happen?

No length-zero-no-unit error to be flagged.
Possibly it would be good to create another rule to disallow 2 values in flex shorthand property to avoid ambiguous situations, and make intentions evident

What actually happened (e.g. what warnings or errors did you get)?

The following warnings were flagged:

Value.module.scss
 32:12  ✖  Unexpected unit   length-zero-no-unit
@jeddy3 jeddy3 changed the title Flex shorthand with 2 values - unexpected unit for last value Fix false positives for flex shorthand with 2 values in length-zero-no-unit Jun 19, 2020
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule labels Jun 19, 2020
@jeddy3
Copy link
Member

jeddy3 commented Jun 19, 2020

@Sultanidze Thanks for the report and for using the template.

I can reproduce this using the demo.

I've labelled 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.

Possibly it would be good to create another rule to disallow 2 values in flex shorthand property to avoid ambiguous situations, and make intentions evident

This sounds like a good idea. Can create a separate issue for it, please?

@Sultanidze
Copy link
Author

@jeddy3 I'm on it.
Will create separate issue for a new rule after fixing current rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule
Development

No branches or pull requests

2 participants