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 SCSS variables in function-calc-no-unspaced-operator #6052

Closed
peter-neumann-dev opened this issue Apr 30, 2022 · 2 comments · Fixed by #6053
Closed
Labels
status: wip is being worked on by someone syntax: scss relates to SCSS and SCSS-like syntax type: bug a problem with a feature or rule

Comments

@peter-neumann-dev
Copy link

peter-neumann-dev commented Apr 30, 2022

What steps are needed to reproduce the bug?

textarea {
  min-height: calc(#{$line-height} * 5);
}

What Stylelint configuration is needed to reproduce the bug?

module.exports = {
  plugins: [
    'stylelint-scss',
  ],
  extends: ['stylelint-config-standard-scss'],
  rules: { },
}

How did you run Stylelint?

CLI with stylelint 'css/**/*.scss'

Which version of Stylelint are you using?

14.8.1

What did you expect to happen?

Behavior like in previous versions <= 14.8.0

What actually happened?

css/components/_forms.scss
 213:27  ✖  Expected single space before "-" operator  function-calc-no-unspaced-operator
 213:28  ✖  Expected single space after "-" operator   function-calc-no-unspaced-operator

Does the bug relate to non-standard syntax?

Yes it happens with SCSS variables inside calc()

Proposal to fix the bug

This happens only in the newest version 14.8.1 with this fixed: #6045

@jeddy3 jeddy3 changed the title SCSS variables inside calc() containing dashes are interpreted as minus signs Fix false positives for SCSS variables in function-calc-no-unspaced-operator Apr 30, 2022
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule syntax: scss relates to SCSS and SCSS-like syntax labels Apr 30, 2022
@jeddy3
Copy link
Member

jeddy3 commented Apr 30, 2022

@peter-neumann-dev Thanks for the report and for using the template.

I can reproduce with 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.

It should just be the case of using the isStandardSyntaxMathFunction util on Line 310:

if (node.type !== 'function' || node.value.toLowerCase() !== 'calc') return;
const { nodes } = node;

And then updating the tests to reflect that the rule will now outright ignore any calc functions that contain non-standard syntax.

@ybiquitous ybiquitous added status: wip is being worked on by someone and removed status: ready to implement is ready to be worked on by someone labels May 1, 2022
@ybiquitous
Copy link
Member

@peter-neumann-dev Thanks for the report and sorry for the inconvenience.
I've opened PR #6053 to fix the regression. I expect the next version will include the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wip is being worked on by someone syntax: scss relates to SCSS and SCSS-like syntax type: bug a problem with a feature or rule
3 participants