File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
packages/plugin/src/processors Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 11import { parseCode } from '@graphql-tools/graphql-tag-pluck' ;
2+ import { basename } from 'path' ;
23
34const RELEVANT_KEYWORDS = [ 'gql' , 'graphql' , '/* GraphQL */' ] ;
45
@@ -19,6 +20,11 @@ export function createGraphqlProcessor() {
1920 const blocks : Block [ ] = [ ] ;
2021 blocksMap . set ( filename , blocks ) ;
2122
23+ // WORKAROUND: The restores the original filename for the block representing original code.
24+ // This allows to be compatible with other eslint plugins relying on filesystem
25+ // This is temporary, waiting for https://github.com/eslint/eslint/issues/11989
26+ const originalFileBlock = { text, filename : `/../../${ basename ( filename ) } ` }
27+
2228 if ( filename && text && RELEVANT_KEYWORDS . some ( keyword => text . includes ( keyword ) ) ) {
2329 const extractedDocuments = parseCode ( {
2430 code : text ,
@@ -39,13 +45,13 @@ export function createGraphqlProcessor() {
3945 } ) ;
4046 }
4147
42- blocks . push ( { text , filename } ) ;
48+ blocks . push ( originalFileBlock ) ;
4349
4450 return blocks ;
4551 }
4652 }
4753
48- return [ { text , filename } ] ;
54+ return [ originalFileBlock ] ;
4955 } ,
5056 postprocess : ( messageLists : any [ ] , filename : string ) : any [ ] => {
5157 const blocks = blocksMap . get ( filename ) ;
You can’t perform that action at this time.
0 commit comments