2026-03-25 08:56:26 +00:00
|
|
|
diff --git a/esm/estree-converter/utils.js b/esm/estree-converter/utils.js
|
|
|
|
|
index f57ab7f17cfc19de13cc969ee32bf44d4f6c361f..6db8f13220171ba109b131db6d5ba5bf7249e87a 100644
|
|
|
|
|
--- a/esm/estree-converter/utils.js
|
|
|
|
|
+++ b/esm/estree-converter/utils.js
|
|
|
|
|
@@ -1,11 +1,12 @@
|
|
|
|
|
-import { createRequire } from 'module';
|
|
|
|
|
-const require = createRequire(import.meta.url);
|
|
|
|
|
+// import { createRequire } from 'module';
|
|
|
|
|
+// const require = createRequire(import.meta.url);
|
|
|
|
|
import "../chunk-BMTV3EA2.js";
|
|
|
|
|
import {
|
|
|
|
|
isListType,
|
|
|
|
|
isNonNullType,
|
|
|
|
|
Source,
|
|
|
|
|
- TokenKind
|
|
|
|
|
+ TokenKind,
|
|
|
|
|
+ Lexer
|
|
|
|
|
} from "graphql";
|
|
|
|
|
import { valueFromASTUntyped } from "graphql/utilities/valueFromASTUntyped.js";
|
|
|
|
|
const valueFromNode = (...args) => {
|
|
|
|
|
@@ -41,15 +42,7 @@ function convertToken(token, type) {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function getLexer(source) {
|
|
|
|
|
- const gqlLanguage = require("graphql/language");
|
|
|
|
|
- if (gqlLanguage == null ? void 0 : gqlLanguage.createLexer) {
|
|
|
|
|
- return gqlLanguage.createLexer(source, {});
|
|
|
|
|
- }
|
|
|
|
|
- const { Lexer: LexerCls } = require("graphql");
|
|
|
|
|
- if (LexerCls && typeof LexerCls === "function") {
|
|
|
|
|
- return new LexerCls(source);
|
|
|
|
|
- }
|
|
|
|
|
- throw new Error("Unsupported GraphQL version! Please make sure to use GraphQL v14 or newer!");
|
|
|
|
|
+ return new Lexer(source)
|
|
|
|
|
}
|
|
|
|
|
function extractTokens(filePath, code) {
|
|
|
|
|
const source = new Source(code, filePath);
|
|
|
|
|
diff --git a/esm/index.js b/esm/index.js
|
|
|
|
|
index c70680ab5ef5a04c71db529015e879f91aedf2cf..402b56f8d4b0109d58411e6a5c002b8f69fc40d6 100644
|
|
|
|
|
--- a/esm/index.js
|
|
|
|
|
+++ b/esm/index.js
|
|
|
|
|
@@ -2,7 +2,7 @@ import "./chunk-BMTV3EA2.js";
|
|
|
|
|
import { processor } from "./processor.js";
|
|
|
|
|
import { parseForESLint } from "./parser.js";
|
|
|
|
|
import { rules } from "./rules/index.js";
|
|
|
|
|
-export * from "./testkit.js";
|
|
|
|
|
+// export * from "./testkit.js";
|
|
|
|
|
export * from "./types.js";
|
|
|
|
|
import { requireGraphQLSchemaFromContext, requireSiblingsOperations } from "./utils.js";
|
|
|
|
|
const processors = { graphql: processor };
|
|
|
|
|
diff --git a/esm/parser.js b/esm/parser.js
|
|
|
|
|
index 8dc131164b22e24c227d2296d16899a6abb4f692..b1870bc8472fe52e045eaa85b15fe0cac0f8c383 100644
|
|
|
|
|
--- a/esm/parser.js
|
|
|
|
|
+++ b/esm/parser.js
|
|
|
|
|
@@ -3,10 +3,10 @@ import { parseGraphQLSDL } from "@graphql-tools/utils";
|
|
|
|
|
import debugFactory from "debug";
|
|
|
|
|
import { buildSchema, GraphQLError } from "graphql";
|
|
|
|
|
import { convertToESTree, extractComments, extractTokens } from "./estree-converter/index.js";
|
|
|
|
|
-import { loadGraphQLConfig } from "./graphql-config.js";
|
|
|
|
|
+// import { loadGraphQLConfig } from "./graphql-config.js";
|
|
|
|
|
import { getSchema } from "./schema.js";
|
|
|
|
|
import { getSiblings } from "./siblings.js";
|
|
|
|
|
-import { CWD, VIRTUAL_DOCUMENT_REGEX } from "./utils.js";
|
|
|
|
|
+import { CWD, /*VIRTUAL_DOCUMENT_REGEX*/ } from "./utils.js";
|
|
|
|
|
const debug = debugFactory("graphql-eslint:parser");
|
|
|
|
|
debug("cwd %o", CWD);
|
|
|
|
|
function parseForESLint(code, options) {
|
|
|
|
|
@@ -18,9 +18,9 @@ function parseForESLint(code, options) {
|
|
|
|
|
...options.graphQLParserOptions,
|
|
|
|
|
noLocation: false
|
|
|
|
|
});
|
|
|
|
|
- const gqlConfig = loadGraphQLConfig(options);
|
|
|
|
|
- const realFilepath = filePath.replace(VIRTUAL_DOCUMENT_REGEX, "");
|
|
|
|
|
- const project = gqlConfig.getProjectForFile(realFilepath);
|
|
|
|
|
+ // const gqlConfig = loadGraphQLConfig(options);
|
|
|
|
|
+ // const realFilepath = filePath.replace(VIRTUAL_DOCUMENT_REGEX, "");
|
|
|
|
|
+ let project;
|
|
|
|
|
let schema = null;
|
|
|
|
|
try {
|
|
|
|
|
schema = project ? getSchema(project, options.schemaOptions) : typeof options.schema === "string" ? buildSchema(options.schema) : null;
|
|
|
|
|
diff --git a/esm/rules/graphql-js-validation.js b/esm/rules/graphql-js-validation.js
|
|
|
|
|
index d952cee1e10976459e7c5836b86ba6540c45fdb6..d314997bfd26477c7d823cad397eb5d65d147806 100644
|
|
|
|
|
--- a/esm/rules/graphql-js-validation.js
|
|
|
|
|
+++ b/esm/rules/graphql-js-validation.js
|
|
|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
|
-import { createRequire } from 'module';
|
|
|
|
|
-const require = createRequire(import.meta.url);
|
|
|
|
|
+// import { createRequire } from 'module';
|
|
|
|
|
+// const require = createRequire(import.meta.url);
|
|
|
|
|
+import * as allGraphQLJSRules from 'graphql/validation/index.js'
|
|
|
|
|
import "../chunk-BMTV3EA2.js";
|
|
|
|
|
import {
|
|
|
|
|
Kind,
|
|
|
|
|
@@ -112,16 +113,18 @@ const validationToRule = ({
|
|
|
|
|
schema = [],
|
|
|
|
|
hasDidYouMeanSuggestions
|
|
|
|
|
}, docs) => {
|
|
|
|
|
- let ruleFn = null;
|
|
|
|
|
- try {
|
|
|
|
|
- ruleFn = require(`graphql/validation/rules/${ruleName}Rule`)[`${ruleName}Rule`];
|
|
|
|
|
- } catch {
|
|
|
|
|
- try {
|
|
|
|
|
- ruleFn = require(`graphql/validation/rules/${ruleName}`)[`${ruleName}Rule`];
|
|
|
|
|
- } catch {
|
|
|
|
|
- ruleFn = require("graphql/validation")[`${ruleName}Rule`];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
+ // let ruleFn = null;
|
|
|
|
|
+ // try {
|
|
|
|
|
+ // ruleFn = require(`graphql/validation/rules/${ruleName}Rule`)[`${ruleName}Rule`];
|
|
|
|
|
+ // } catch {
|
|
|
|
|
+ // try {
|
|
|
|
|
+ // ruleFn = require(`graphql/validation/rules/${ruleName}`)[`${ruleName}Rule`];
|
|
|
|
|
+ // } catch {
|
|
|
|
|
+ // ruleFn = require("graphql/validation")[`${ruleName}Rule`];
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ let ruleFn = allGraphQLJSRules[`${ruleName}Rule`];
|
|
|
|
|
+
|
|
|
|
|
return {
|
|
|
|
|
[ruleId]: {
|
2026-03-31 07:03:58 +00:00
|
|
|
meta: {
|
|
|
|
|
diff --git a/esm/rules/relay-edge-types.js b/esm/rules/relay-edge-types.js
|
|
|
|
|
index 7a7eb179786103d9d72a4a84fb4bf811d11a4286..6fb12a5f56b71f56c9a14018d0494e9c7584f935 100644
|
|
|
|
|
--- a/esm/rules/relay-edge-types.js
|
|
|
|
|
+++ b/esm/rules/relay-edge-types.js
|
|
|
|
|
@@ -12,11 +12,7 @@ const MESSAGE_MUST_BE_OBJECT_TYPE = "MESSAGE_MUST_BE_OBJECT_TYPE";
|
|
|
|
|
const MESSAGE_MISSING_EDGE_SUFFIX = "MESSAGE_MISSING_EDGE_SUFFIX";
|
|
|
|
|
const MESSAGE_LIST_TYPE_ONLY_EDGE_TYPE = "MESSAGE_LIST_TYPE_ONLY_EDGE_TYPE";
|
|
|
|
|
const MESSAGE_SHOULD_IMPLEMENTS_NODE = "MESSAGE_SHOULD_IMPLEMENTS_NODE";
|
|
|
|
|
-let edgeTypesCache;
|
|
|
|
|
function getEdgeTypes(schema2) {
|
|
|
|
|
- if (edgeTypesCache) {
|
|
|
|
|
- return edgeTypesCache;
|
|
|
|
|
- }
|
|
|
|
|
const edgeTypes = /* @__PURE__ */ new Set();
|
|
|
|
|
const visitor = {
|
|
|
|
|
ObjectTypeDefinition(node) {
|
|
|
|
|
@@ -38,8 +34,7 @@ function getEdgeTypes(schema2) {
|
|
|
|
|
};
|
|
|
|
|
const astNode = getDocumentNodeFromSchema(schema2);
|
|
|
|
|
visit(astNode, visitor);
|
|
|
|
|
- edgeTypesCache = edgeTypes;
|
|
|
|
|
- return edgeTypesCache;
|
|
|
|
|
+ return edgeTypes;
|
|
|
|
|
}
|
|
|
|
|
const schema = {
|
|
|
|
|
type: "array",
|