diff --git a/src/language-js/embed.js b/src/language-js/embed.js index 6affe0cf3..08d477681 100644 --- a/src/language-js/embed.js +++ b/src/language-js/embed.js @@ -34,15 +34,16 @@ function embed(path, print, textToDoc /*, options */) { * graphql`...` * graphql.experimental`...` * gql`...` + * + * This intentionally excludes Relay Classic tags, as Prettier does not + * support Relay Classic formatting. */ if ( parent && ((parent.type === "TaggedTemplateExpression" && ((parent.tag.type === "MemberExpression" && - ((parent.tag.object.name === "graphql" && - parent.tag.property.name === "experimental") || - (parent.tag.object.name === "Relay" && - parent.tag.property.name === "QL"))) || + parent.tag.object.name === "graphql" && + parent.tag.property.name === "experimental") || (parent.tag.type === "Identifier" && (parent.tag.name === "gql" || parent.tag.name === "graphql")))) || (parent.type === "CallExpression" && diff --git a/tests/multiparser_js_graphql/__snapshots__/jsfmt.spec.js.snap b/tests/multiparser_js_graphql/__snapshots__/jsfmt.spec.js.snap index 9092cc380..580b80d40 100644 --- a/tests/multiparser_js_graphql/__snapshots__/jsfmt.spec.js.snap +++ b/tests/multiparser_js_graphql/__snapshots__/jsfmt.spec.js.snap @@ -394,7 +394,6 @@ gql\` exports[`react-relay.js 1`] = ` const { graphql } = require("react-relay"); -const Relay = require("react-relay/classic"); graphql\` mutation MarkReadNotificationMutation( @@ -411,17 +410,8 @@ graphql.experimental\` ) { markReadNotification(data: $input ) { notification {seenState} } } \`; - -Relay.QL\` - mutation MarkReadNotificationMutation( - $input - : MarkReadNotificationData! - ) -{ markReadNotification(data: $input ) { notification {seenState} } } -\`; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const { graphql } = require("react-relay"); -const Relay = require("react-relay/classic"); graphql\` mutation MarkReadNotificationMutation($input: MarkReadNotificationData!) { @@ -443,14 +433,4 @@ graphql.experimental\` } \`; -Relay.QL\` - mutation MarkReadNotificationMutation($input: MarkReadNotificationData!) { - markReadNotification(data: $input) { - notification { - seenState - } - } - } -\`; - `; diff --git a/tests/multiparser_js_graphql/react-relay.js b/tests/multiparser_js_graphql/react-relay.js index 2fb69942b..6cc85ccf3 100644 --- a/tests/multiparser_js_graphql/react-relay.js +++ b/tests/multiparser_js_graphql/react-relay.js @@ -1,5 +1,4 @@ const { graphql } = require("react-relay"); -const Relay = require("react-relay/classic"); graphql` mutation MarkReadNotificationMutation( @@ -16,11 +15,3 @@ graphql.experimental` ) { markReadNotification(data: $input ) { notification {seenState} } } `; - -Relay.QL` - mutation MarkReadNotificationMutation( - $input - : MarkReadNotificationData! - ) -{ markReadNotification(data: $input ) { notification {seenState} } } -`;