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

length-zero-no-unit is dangerous to fix when used with calc() #306

Open
jethrolarson opened this issue May 19, 2017 · 0 comments
Open

length-zero-no-unit is dangerous to fix when used with calc() #306

jethrolarson opened this issue May 19, 2017 · 0 comments

Comments

@jethrolarson
Copy link

A bug where using stylefmt with stylelint causes calc expressions to break

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

length-zero-no-unit

What CSS is needed to reproduce this issue?

.foo {
  --x: 0px;
  left: calc(300px - var(--x));
}

stylelint configuration:

extends: stylelint-config-standard

stylefmt 5.3.2

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

CLI with stylefmt -r 'app/**/*.scss' 'app/**/*.css'

What did you expect to happen?

Fixing the warning to be safe since it's in the recommended list

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

Styles get fixed to

.foo {
  --x: 0;
  left: calc(300px - var(--x));
}

calc sees different units on left and right hand side of the operator and returns a 0.

I think that this rule should be removed from the recommended list since it is not safe to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant