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 function-calc-no-invalid rule #3833
Conversation
Oh wow, this is great! My original concern was that this rule would not meet the following criteria for inclusion:
However, because this rule is using a spec compliant parser, I think it might meet this criteria. Can anyone think of a reason not to include this rule in core? |
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.
Very very good job, need test nested
calc
@evilebottnawi Thank you for review! |
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.
Great job!
I think we should union with postcss-calc
and move parser
as separate package or include this logic in postcss-value-parser
, but don't have time on this right now.
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.
I think we need more tests around scss
, less
and css-in-js
(?) syntaxes (variables, nested function). Example: calc(10px + $var)
? Thanks for good job again
True, let me know if I can help.
I'm not familiar with |
@ota-meshi let's add some tests with variables |
# Conflicts: # package.json
I added the test 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.
LGTM
@evilebottnawi Any further requests, or does this look good to you now?
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.
Looks good 👍
@ota-meshi Thanks for adding this epic new rule!
|
Closes #3820
This PR add
function-calc-no-invalid
rules.A new rule that reports an invalid expression of the calc() function.
I created
calc
expression parser with reference toparser.jison
of postcss-calc.The main changes from
parser.jison
ofpostcss-calc
are below.vm
)LengthValue
.