Skip to content

Commit

Permalink
Fix loadSiblings file location
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed May 18, 2021
1 parent 5ff184b commit 6d4a356
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-shoes-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-eslint/eslint-plugin': patch
---

Fix loadSiblings file location
10 changes: 5 additions & 5 deletions packages/plugin/src/sibling-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function loadSiblings(baseDir: string, loadPaths: string[]): Source[] {
return loadDocumentsSync(loadPaths, {
cwd: baseDir,
loaders: operationsLoaders,
}).map(r => ({ ...r, location: join(baseDir, r.location) }));
});
}

const operationsCache: Map<string, Source[]> = new Map();
Expand Down Expand Up @@ -120,8 +120,8 @@ export function getSiblingOperations(options: ParserOptions, gqlConfig: GraphQLC
// Since the siblings array is cached, we can use it as cache key.
// We should get the same array reference each time we get
// to this point for the same graphql project
if(siblingOperationsCache.has(siblings)) {
return siblingOperationsCache.get(siblings)
if (siblingOperationsCache.has(siblings)) {
return siblingOperationsCache.get(siblings);
}

let fragmentsCache: FragmentSource[] | null = null;
Expand Down Expand Up @@ -216,6 +216,6 @@ export function getSiblingOperations(options: ParserOptions, gqlConfig: GraphQLC
getOperationByType: type => getOperations().filter(o => o.document.operation === type),
getFragmentsInUse: (selectable, recursive = true) => Array.from(collectFragments(selectable, recursive).values()),
};
siblingOperationsCache.set(siblings, siblingOperations)
return siblingOperations
siblingOperationsCache.set(siblings, siblingOperations);
return siblingOperations;
}

0 comments on commit 6d4a356

Please sign in to comment.