Skip to content

Commit

Permalink
Fixed excessive parentheses in for-in condition
Browse files Browse the repository at this point in the history
See #44
  • Loading branch information
Anantachai Saothong (Manta) committed May 6, 2020
1 parent bdb8212 commit dd88aee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions edge/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ function format(content, options = {}) {
inputNode.parent.parent instanceof Stylus.nodes.Feature ||
inputNode.parent.parent instanceof Stylus.nodes.Ident ||
inputNode.parent.parent instanceof Stylus.nodes.If ||
inputNode.parent.parent instanceof Stylus.nodes.Each ||
inputNode.parent.parent instanceof Stylus.nodes.Selector ||
inputNode.parent.parent instanceof Stylus.nodes.Return ||
inputNode.parent.parent instanceof Stylus.nodes.Arguments ||
Expand Down
19 changes: 11 additions & 8 deletions spec/iteration/input.styl
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
body
for num,index in 1 2 3
foo num
for num,index in 1 2 3
foo num

for $i in $bar.baz
foo $i

for key,value in obj
{key}:value
{key}:value

sum(nums)
val = 0
val += n for n in nums
val += (n+1) for n in nums
val = 0
val += n for n in nums
val += (n+1) for n in nums

get(hash,key)
return pair[1] if pair[0] == key for pair in hash
return (pair[1]) if pair[0] == key for pair in hash
return pair[1] if pair[0] == key for pair in hash
return (pair[1]) if pair[0] == key for pair in hash
4 changes: 4 additions & 0 deletions spec/iteration/output.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ body {
for num, index in 1 2 3 {
foo: num;
}

for $i in $bar.baz {
foo: $i;
}
}

for key, value in obj {
Expand Down

0 comments on commit dd88aee

Please sign in to comment.