Skip to content

Commit

Permalink
Fix false positives for hyphenated functions in `function-calc-no-uns…
Browse files Browse the repository at this point in the history
…paced-operator` (#5636)

Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
  • Loading branch information
lachieh and ybiquitous committed Oct 25, 2021
1 parent 280c2d2 commit 85c8855
Show file tree
Hide file tree
Showing 2 changed files with 255 additions and 186 deletions.
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

0 comments on commit 85c8855

Please sign in to comment.