@@ -165,7 +165,7 @@ module.exports = {
165165 } )
166166 : null ;
167167
168- const prettierFileInfo = prettier . getFileInfo . sync (
168+ const { ignored , inferredParser } = prettier . getFileInfo . sync (
169169 onDiskFilepath ,
170170 Object . assign (
171171 { } ,
@@ -175,7 +175,7 @@ module.exports = {
175175 ) ;
176176
177177 // Skip if file is ignored using a .prettierignore file
178- if ( prettierFileInfo . ignored ) {
178+ if ( ignored ) {
179179 return ;
180180 }
181181
@@ -206,11 +206,21 @@ module.exports = {
206206 // * Prettier supports parsing the file type
207207 // * There is an ESLint processor that extracts JavaScript snippets
208208 // from the file type.
209- const parserBlocklist = [ null , 'graphql' , 'markdown' , 'html' ] ;
209+ const parserBlocklist = [ null , 'markdown' , 'html' ] ;
210+
211+ let inferParserToBabel =
212+ parserBlocklist . indexOf ( inferredParser ) !== - 1 ;
213+
210214 if (
211- filepath === onDiskFilepath &&
212- parserBlocklist . indexOf ( prettierFileInfo . inferredParser ) !== - 1
215+ // it could be processed by `@graphql-eslint/eslint-plugin` or `eslint-plugin-graphql`
216+ inferredParser === 'graphql' &&
217+ // for `eslint-plugin-graphql`, see https://github.com/apollographql/eslint-plugin-graphql/blob/master/src/index.js#L416
218+ source . startsWith ( 'ESLintPluginGraphQLFile`' )
213219 ) {
220+ inferParserToBabel = true ;
221+ }
222+
223+ if ( filepath === onDiskFilepath && inferParserToBabel ) {
214224 // Prettier v1.16.0 renamed the `babylon` parser to `babel`
215225 // Use the modern name if available
216226 const supportBabelParser = prettier
0 commit comments