Skip to content

Commit 9bbf0f5

Browse files
authored
chore(lint): prevent import * from 'graphql' in plugins (#576)
1 parent 3506d4f commit 9bbf0f5

File tree

5 files changed

+88
-104
lines changed

5 files changed

+88
-104
lines changed

.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,32 @@ module.exports = {
4949
"no-inner-declarations": "warn",
5050
},
5151
overrides: [
52+
// Rules for plugins
53+
{
54+
files: [
55+
"packages/graphile-build/src/plugins/**/*.ts",
56+
"packages/graphile-build-pg/src/**/*.ts",
57+
"packages/graphile-utils/src/**/*.ts",
58+
"packages/pg-pubsub/src/**/*.ts",
59+
"packages/postgraphile-core/src/**/*.ts",
60+
"packages/subscriptions-lds/src/**/*.ts",
61+
],
62+
rules: {
63+
"no-restricted-imports": [
64+
"error",
65+
{
66+
paths: [
67+
{
68+
name: "graphql",
69+
message:
70+
'Please refer to `build.graphql` instead, or use `import("graphql")` in value positions. (This helps us to avoid multiple `graphql` modules in the `node_modules` tree from causing issues.)',
71+
},
72+
],
73+
},
74+
],
75+
},
76+
},
77+
5278
// Rules for Flow only
5379
{
5480
files: ["*.js", "*.jsx"],

packages/graphile-utils/src/gql.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line no-restricted-imports
12
import { parse, visit, ASTNode, DocumentNode, DefinitionNode } from "graphql";
23
const $$embed = Symbol("graphile-embed");
34

0 commit comments

Comments
 (0)