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

operator-no-newline-before and operator-no-unspaced fail with CSS Custom Properties #252

Closed
kaelig opened this issue Jun 13, 2018 · 5 comments
Labels
Bug 🐛 Something isn't working

Comments

@kaelig
Copy link

kaelig commented Jun 13, 2018

According to my tests, these two rules:

"scss/operator-no-newline-before": true,
"scss/operator-no-unspaced": true

Fail to lint:

:root {
  --foo: '{{}}';
}

Trace:

TypeError: Cannot read property 'isCalculationEnabled' of undefined
    at findOperators (/Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/stylelint-scss/dist/utils/sassValueParser/index.js:77:37)
    at /Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/stylelint-scss/dist/rules/operator-no-unspaced/index.js:150:45
    at /Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/postcss-scss/node_modules/postcss/lib/container.js:144:26
    at Rule.each (/Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/postcss-scss/node_modules/postcss/lib/container.js:110:22)
    at Rule.walk (/Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/postcss-scss/node_modules/postcss/lib/container.js:143:21)
    at /Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/postcss-scss/node_modules/postcss/lib/container.js:146:32
    at Root.each (/Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/postcss-scss/node_modules/postcss/lib/container.js:110:22)
    at Root.walk (/Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/postcss-scss/node_modules/postcss/lib/container.js:143:21)
    at calculationOperatorSpaceChecker (/Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/stylelint-scss/dist/rules/operator-no-unspaced/index.js:143:8)
    at /Users/kaelig/src/github.com/Shopify/polaris-react/node_modules/stylelint-scss/dist/rules/operator-no-newline-before/index.js:17:61
@kristerkari
Copy link
Collaborator

Thanks! I need verify, but looks like a bug :)

@YozhikM
Copy link
Contributor

YozhikM commented Jun 14, 2018

I confirm the error is caused with this CSS.

      at findOperators (src/utils/sassValueParser/index.js:154:207)
      at src/rules/operator-no-unspaced/index.js:139:45
      at node_modules/stylelint/node_modules/postcss-scss/node_modules/postcss/lib/container.es6:109:26
      at Rule.each (node_modules/stylelint/node_modules/postcss-scss/node_modules/postcss/lib/container.es6:77:22)
      at Rule.walk (node_modules/stylelint/node_modules/postcss-scss/node_modules/postcss/lib/container.es6:108:21)
      at node_modules/stylelint/node_modules/postcss-scss/node_modules/postcss/lib/container.es6:111:32
      at Root.each (node_modules/stylelint/node_modules/postcss-scss/node_modules/postcss/lib/container.es6:77:22)
      at Root.walk (node_modules/stylelint/node_modules/postcss-scss/node_modules/postcss/lib/container.es6:108:21)
      at calculationOperatorSpaceChecker (src/rules/operator-no-unspaced/index.js:132:8)
      at src/rules/operator-no-newline-before/index.js:55:61

I think I'll correct this behavior and send PR to you.

@kristerkari kristerkari added the Bug 🐛 Something isn't working label Jun 14, 2018
YozhikM added a commit to YozhikM/stylelint-scss that referenced this issue Jun 14, 2018
@kristerkari
Copy link
Collaborator

@YozhikM That would be great, thanks for the help!

@kristerkari
Copy link
Collaborator

Fix available in v3.1.1. Thanks for helping!

@kaelig
Copy link
Author

kaelig commented Jun 14, 2018

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 Something isn't working
Development

No branches or pull requests

3 participants