@graphql-eslint/eslint-plugin 3.3.0-alpha-d23e9e2.0 → 3.3.0-alpha-1c01242.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +12 -4
- package/index.mjs +12 -4
- package/package.json +1 -1
package/index.js
CHANGED
@@ -3824,9 +3824,17 @@ function parse(code, options) {
|
|
3824
3824
|
}
|
3825
3825
|
function parseForESLint(code, options = {}) {
|
3826
3826
|
const gqlConfig = loadGraphQLConfig(options);
|
3827
|
-
|
3827
|
+
let schema;
|
3828
|
+
try {
|
3829
|
+
schema = getSchema(options, gqlConfig);
|
3830
|
+
}
|
3831
|
+
catch (e) {
|
3832
|
+
e.message = `[graphql-eslint] Error while loading schema: ${e.message}`;
|
3833
|
+
// eslint-disable-next-line no-console
|
3834
|
+
console.error(e);
|
3835
|
+
}
|
3828
3836
|
const parserServices = {
|
3829
|
-
hasTypeInfo: schema
|
3837
|
+
hasTypeInfo: Boolean(schema),
|
3830
3838
|
schema,
|
3831
3839
|
siblingOperations: getSiblingOperations(options, gqlConfig),
|
3832
3840
|
reachableTypes: getReachableTypes,
|
@@ -3855,6 +3863,7 @@ function parseForESLint(code, options = {}) {
|
|
3855
3863
|
};
|
3856
3864
|
}
|
3857
3865
|
catch (e) {
|
3866
|
+
e.message = `[graphql-eslint] ${e.message}`;
|
3858
3867
|
// In case of GraphQL parser error, we report it to ESLint as a parser error that matches the requirements
|
3859
3868
|
// of ESLint. This will make sure to display it correctly in IDEs and lint results.
|
3860
3869
|
if (e instanceof graphql.GraphQLError) {
|
@@ -3862,11 +3871,10 @@ function parseForESLint(code, options = {}) {
|
|
3862
3871
|
index: e.positions[0],
|
3863
3872
|
lineNumber: e.locations[0].line,
|
3864
3873
|
column: e.locations[0].column,
|
3865
|
-
message:
|
3874
|
+
message: e.message,
|
3866
3875
|
};
|
3867
3876
|
throw eslintError;
|
3868
3877
|
}
|
3869
|
-
e.message = `[graphql-eslint]: ${e.message}`;
|
3870
3878
|
throw e;
|
3871
3879
|
}
|
3872
3880
|
}
|
package/index.mjs
CHANGED
@@ -3818,9 +3818,17 @@ function parse(code, options) {
|
|
3818
3818
|
}
|
3819
3819
|
function parseForESLint(code, options = {}) {
|
3820
3820
|
const gqlConfig = loadGraphQLConfig(options);
|
3821
|
-
|
3821
|
+
let schema;
|
3822
|
+
try {
|
3823
|
+
schema = getSchema(options, gqlConfig);
|
3824
|
+
}
|
3825
|
+
catch (e) {
|
3826
|
+
e.message = `[graphql-eslint] Error while loading schema: ${e.message}`;
|
3827
|
+
// eslint-disable-next-line no-console
|
3828
|
+
console.error(e);
|
3829
|
+
}
|
3822
3830
|
const parserServices = {
|
3823
|
-
hasTypeInfo: schema
|
3831
|
+
hasTypeInfo: Boolean(schema),
|
3824
3832
|
schema,
|
3825
3833
|
siblingOperations: getSiblingOperations(options, gqlConfig),
|
3826
3834
|
reachableTypes: getReachableTypes,
|
@@ -3849,6 +3857,7 @@ function parseForESLint(code, options = {}) {
|
|
3849
3857
|
};
|
3850
3858
|
}
|
3851
3859
|
catch (e) {
|
3860
|
+
e.message = `[graphql-eslint] ${e.message}`;
|
3852
3861
|
// In case of GraphQL parser error, we report it to ESLint as a parser error that matches the requirements
|
3853
3862
|
// of ESLint. This will make sure to display it correctly in IDEs and lint results.
|
3854
3863
|
if (e instanceof GraphQLError) {
|
@@ -3856,11 +3865,10 @@ function parseForESLint(code, options = {}) {
|
|
3856
3865
|
index: e.positions[0],
|
3857
3866
|
lineNumber: e.locations[0].line,
|
3858
3867
|
column: e.locations[0].column,
|
3859
|
-
message:
|
3868
|
+
message: e.message,
|
3860
3869
|
};
|
3861
3870
|
throw eslintError;
|
3862
3871
|
}
|
3863
|
-
e.message = `[graphql-eslint]: ${e.message}`;
|
3864
3872
|
throw e;
|
3865
3873
|
}
|
3866
3874
|
}
|