Add \n at the end of .graphql files (#2285)
We need to use the same hack as CSS unfortunately. Fixes #2275
This commit is contained in:
1 parent
1e48f34ac8
commit
803b7ff6b9
16 files changed
+26
-2
No files matched your search
+4
-1
@@ -80,7 +80,10 @@ function fromBabylonFlowOrTypeScript(path) {
|
||||
return {
|
||||
options: { parser: "graphql" },
|
||||
transformDoc: doc =>
|
||||
concat([indent(concat([softline, doc])), softline]),
|
||||
concat([
|
||||
indent(concat([softline, stripTrailingHardline(doc)])),
|
||||
softline
|
||||
]),
|
||||
text: parent.quasis[0].value.raw
|
||||
};
|
||||
}
|
||||
|
||||
@@ -22,7 +22,10 @@ function genericPrint(path, options, print) {
|
||||
|
||||
switch (n.kind) {
|
||||
case "Document": {
|
||||
return join(concat([hardline, hardline]), path.map(print, "definitions"));
|
||||
return concat([
|
||||
join(concat([hardline, hardline]), path.map(print, "definitions")),
|
||||
hardline
|
||||
]);
|
||||
}
|
||||
case "OperationDefinition": {
|
||||
return concat([
|
||||
|
||||
@@ -16,4 +16,5 @@ exports[`hello.graphql 1`] = `
|
||||
string: "hello world this is a very long string!"
|
||||
)
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -12,6 +12,7 @@ fragment Visit on HighlightedVisit
|
||||
@argumentDefinitions(count: { type: "Int", defaultValue: 20 }) {
|
||||
name
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`bracket_spacing.graphql 2`] = `
|
||||
@@ -26,4 +27,5 @@ fragment Visit on HighlightedVisit
|
||||
@argumentDefinitions(count: {type: "Int", defaultValue: 20}) {
|
||||
name
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -15,6 +15,7 @@ query(
|
||||
) {
|
||||
someField
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`fields.graphql 1`] = `
|
||||
@@ -27,4 +28,5 @@ query {
|
||||
query {
|
||||
someField # Trailing comment
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -49,4 +49,5 @@ query {
|
||||
{
|
||||
noOperationType
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -47,4 +47,5 @@ fragment YouCanHaveDirectivesHereToo on SomeType @yesReally(what: "yes") {
|
||||
query QueryWVars($x: String) @directive {
|
||||
hey
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -20,4 +20,5 @@ exports[`fields.graphql 1`] = `
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -32,4 +32,5 @@ fragment XYZ on ABC {
|
||||
field
|
||||
...AFragment
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -12,4 +12,5 @@ exports[`hello.graphql 1`] = `
|
||||
tagline
|
||||
}
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -110,4 +110,5 @@ fragment frag on Friend {
|
||||
query {
|
||||
field
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -16,4 +16,5 @@ exports[`lists.graphql 1`] = `
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -22,4 +22,5 @@ exports[`objects.graphql 1`] = `
|
||||
)
|
||||
emptyObj(arg: {})
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -49,6 +49,7 @@ query CityGuidesSocialUnitRendererQuery(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`trailing.graphql 2`] = `
|
||||
@@ -100,6 +101,7 @@ query CityGuidesSocialUnitRendererQuery(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`trailing.graphql 3`] = `
|
||||
@@ -151,4 +153,5 @@ query CityGuidesSocialUnitRendererQuery(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -55,4 +55,5 @@ union longUnion =
|
||||
# comment
|
||||
# comment2
|
||||
union union = B | C | D
|
||||
|
||||
`;
|
||||
@@ -45,4 +45,5 @@ query listslong(
|
||||
) {
|
||||
ok
|
||||
}
|
||||
|
||||
`;
|
||||
Reference in new issue
Block a user