Prevent formatting GQL template literals with expressions (#2975)
* Prevent formatting GQL template literals with expressions * Remove unnecessary check * Change quasis check to expression checkmaster
parent
2fed6c873b
commit
f82fcbc98e
|
@ -67,9 +67,10 @@ function fromBabylonFlowOrTypeScript(path) {
|
|||
* gql`...`
|
||||
*/
|
||||
if (
|
||||
// We currently don't support expression inside GraphQL template literals
|
||||
parent.expressions.length === 0 &&
|
||||
parentParent &&
|
||||
((parentParent.type === "TaggedTemplateExpression" &&
|
||||
parent.quasis.length === 1 &&
|
||||
((parentParent.tag.type === "MemberExpression" &&
|
||||
parentParent.tag.object.name === "graphql" &&
|
||||
parentParent.tag.property.name === "experimental") ||
|
||||
|
|
|
@ -1,5 +1,52 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`expressions.js 1`] = `
|
||||
// We currently don't support expressions in GraphQL template literals so these templates
|
||||
// should not change.
|
||||
|
||||
graphql(schema, \`
|
||||
query allPartsByManufacturerName($name: String!) {
|
||||
allParts(filter:{manufacturer: {name: $name}}) {
|
||||
... PartAll
|
||||
}}
|
||||
\${fragments.all}
|
||||
\`)
|
||||
|
||||
const veryLongVariableNameToMakeTheLineBreak = graphql(schema, \`
|
||||
query allPartsByManufacturerName($name: String!) {
|
||||
allParts(filter:{manufacturer: {name: $name}}) {
|
||||
... PartAll
|
||||
}}
|
||||
\${fragments.all}
|
||||
\`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// We currently don't support expressions in GraphQL template literals so these templates
|
||||
// should not change.
|
||||
|
||||
graphql(
|
||||
schema,
|
||||
\`
|
||||
query allPartsByManufacturerName($name: String!) {
|
||||
allParts(filter:{manufacturer: {name: $name}}) {
|
||||
... PartAll
|
||||
}}
|
||||
\${fragments.all}
|
||||
\`
|
||||
);
|
||||
|
||||
const veryLongVariableNameToMakeTheLineBreak = graphql(
|
||||
schema,
|
||||
\`
|
||||
query allPartsByManufacturerName($name: String!) {
|
||||
allParts(filter:{manufacturer: {name: $name}}) {
|
||||
... PartAll
|
||||
}}
|
||||
\${fragments.all}
|
||||
\`
|
||||
);
|
||||
|
||||
`;
|
||||
|
||||
exports[`graphql.js 1`] = `
|
||||
graphql(schema, \`
|
||||
mutation MarkReadNotificationMutation(
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// We currently don't support expressions in GraphQL template literals so these templates
|
||||
// should not change.
|
||||
|
||||
graphql(schema, `
|
||||
query allPartsByManufacturerName($name: String!) {
|
||||
allParts(filter:{manufacturer: {name: $name}}) {
|
||||
... PartAll
|
||||
}}
|
||||
${fragments.all}
|
||||
`)
|
||||
|
||||
const veryLongVariableNameToMakeTheLineBreak = graphql(schema, `
|
||||
query allPartsByManufacturerName($name: String!) {
|
||||
allParts(filter:{manufacturer: {name: $name}}) {
|
||||
... PartAll
|
||||
}}
|
||||
${fragments.all}
|
||||
`)
|
Loading…
Reference in New Issue