Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Commit

Permalink
fix: 'addLineBreaks' regex in 'createSDL' to avoid line-breaking comm…
Browse files Browse the repository at this point in the history
…ent lines (graphql#1245)
  • Loading branch information
asiffermann authored and abernix committed Sep 8, 2020
1 parent 58cc0fc commit 1c10269
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ function getTypeInstance(type) {
function addLineBreaks(sdl: string, commentsDisabled: boolean = true) {
const noNewLines = sdl.replace(/^\s*$(?:\r\n?|\n)/gm, '')
// Line Break all Brackets
const breakBrackets = noNewLines.replace(/[}]/gm, '$&\r\n')
const breakBrackets = noNewLines.replace(/^[}]/gm, '$&\r\n')
// Line Break all Scalars
const withLineBreaks = breakBrackets.replace(/(?:scalar )\w+/g, '$&\r\n')
const withLineBreaks = breakBrackets.replace(/^(?:scalar )\w+/gm, '$&\r\n')

if (commentsDisabled) {
return withLineBreaks
Expand Down

0 comments on commit 1c10269

Please sign in to comment.