Skip to content

Commit

Permalink
fix: Use correct argument order when stringifying flow collection com…
Browse files Browse the repository at this point in the history
…ments (fixes #443)
  • Loading branch information
eemeli committed Apr 24, 2023
1 parent c914dcc commit 5af5d3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/stringify/stringifyCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function stringifyFlowCollection(
}

if (comment) {
str += lineComment(str, commentString(comment), indent)
str += lineComment(str, indent, commentString(comment))
if (onComment) onComment()
}
return str
Expand Down
9 changes: 9 additions & 0 deletions tests/doc/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,15 @@ describe('stringify comments', () => {
}
`)
})

test('line comment after flow collection (eemeli/yaml#443)', () => {
const doc = YAML.parseDocument(source`
[ value1, value2 ] # comment
`)
expect(String(doc)).toBe(source`
[ value1, value2 ] # comment
`)
})
})
})

Expand Down

0 comments on commit 5af5d3d

Please sign in to comment.