Skip to content

Commit

Permalink
fix: allow negative spacing values
Browse files Browse the repository at this point in the history
  • Loading branch information
Haberkamp committed Dec 3, 2024
1 parent 067558e commit e919c0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ const ruleFunction: Rule = (primary, secondaryOptions, context) => {
const isUsingPtValue = /pt$/.test(ruleNode.value);

const valueIsZero = /^0(px)?/.test(ruleNode.value);
const isNegativeValue = /^-/.test(ruleNode.value);

if (
isASpacingToken &&
!isNegativeValue &&
((usingPixelValue && !valueIsZero) ||
isUsingRemValue ||
isUsingCapValue ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ testRule({
{ code: ".a { margin: 10vb; }" },
{ code: ".a { margin: 10vi; }" },
{ code: ".a { margin: 0 auto; }" },
{ code: ".a { margin: -4px; }" },
{ code: ".a { margin: -1rem; }" },
],

reject: [
Expand Down

0 comments on commit e919c0a

Please sign in to comment.