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 hyphenated functions in function-calc-no-unspaced-operator #5636

Merged
merged 11 commits into from Oct 25, 2021
15 changes: 14 additions & 1 deletion lib/rules/function-calc-no-unspaced-operator/__tests__/index.js
Expand Up @@ -87,6 +87,10 @@ testRule({
code: 'a { top: calc(\t+1px)}',
description: 'tab before sign at start',
},
{
code: 'a { top: calc(100% - --my-custom-function(1rem)); }',
description: 'custom function with hyphens in name',
},
{
code: 'a { top: calc(-$x - 2rem); }',
description: 'postcss-simple-vars and SCSS variable syntax',
Expand All @@ -100,7 +104,7 @@ testRule({
description: 'postcss-simple-vars and SCSS variable with hyphens',
},
{
code: 'a { top: calc(2rem + @fh+d*sf-as); }',
code: 'a { top: calc(2rem + @fh+dsf-as); }',
description: 'Less variable with symbols',
},
{
Expand Down Expand Up @@ -154,6 +158,15 @@ testRule({
],

reject: [
{
code: 'a { top: calc(2px+1px) }',
fixed: 'a { top: calc(2px + 1px) }',
description: 'no space before or after operator',
warnings: [
{ message: messages.expectedBefore('+'), line: 1, column: 18 },
{ message: messages.expectedAfter('+'), line: 1, column: 19 },
],
},
{
code: 'a { top: calc(1px +\t-1px)}',
fixed: 'a { top: calc(1px + -1px)}',
Expand Down