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

Ignore non-standard syntax in function-calc-no-invalid #4659

Merged
merged 1 commit into from Mar 25, 2020

Conversation

hudochenkov
Copy link
Member

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

Fixes #4114, #4533.
Closes #4534.

Is there anything in the PR that needs further explanation?

@jeddy3 said:

Built-in rules ignore non-standard syntax. This rule should only check the validity of calc functions containing standard CSS syntax.

To be honest, I don't think this is a good approach for users. function-calc-no-invalid catches many cases of invalid calc for preprocessor users. But with this PR, we reduce usefulness of this rule for these users.

}

return true;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about interpolation SCSS #{var}?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it #{$var}?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, what about $ and @ in css variable names, can these characters used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't get straight answer from the spec. But I tried in Chrome putting these symbols in different position in the custom property name, and all were invalid.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, approved

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

But with this PR, we reduce usefulness of this rule for these users.

The community can create a scss/function-calc-no-invalid plugin (and a less/function-calc-no-invalid one etc). Each would cater to the more specific syntax of their respective languages.

@hudochenkov
Copy link
Member Author

The community can create a scss/function-calc-no-invalid plugin (and a less/function-calc-no-invalid one etc). Each would cater to the more specific syntax of their respective languages.

True. Also, there are pieces of code after that PR, that handle most of use cases of variables and interpolations. I don't know where they are, but now it's a dead code. And this is the case most likely with every rule, where we started ignoring non-standard syntax.

@jeddy3 jeddy3 merged commit 8db24a3 into master Mar 25, 2020
@jeddy3 jeddy3 deleted the function-calc-no-invalid-fix branch March 25, 2020 09:01
@jeddy3
Copy link
Member

jeddy3 commented Mar 25, 2020

  • Fixed: function-calc-no-invalid false positives for SCSS and Less variables (#4659).

@jonscottclark
Copy link

Thanks everyone involved for your contributions on this :)

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

Successfully merging this pull request may close these issues.

Fix false positives for variables in function-calc-no-invalid
4 participants