@graphql-eslint/eslint-plugin 4.0.0-alpha.11 → 4.0.0-alpha.12

Sign up to get free protection for your applications and to get access to all the features.
package/cjs/index.d.cts CHANGED
@@ -48,10 +48,10 @@ declare const _default: {
48
48
  };
49
49
  rules: {
50
50
  alphabetize: GraphQLESLintRule<{
51
- values?: boolean | undefined;
52
51
  definitions?: boolean | undefined;
53
52
  selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
54
53
  arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
54
+ values?: boolean | undefined;
55
55
  fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
56
56
  variables?: boolean | undefined;
57
57
  groups?: string[] | undefined;
package/cjs/meta.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-UIAXBAMD.js');
2
- const version = "4.0.0-alpha.11";
2
+ const version = "4.0.0-alpha.12";
3
3
 
4
4
 
5
5
  exports.version = version;
@@ -12,10 +12,10 @@ import 'json-schema-to-ts';
12
12
 
13
13
  declare const rules: {
14
14
  alphabetize: GraphQLESLintRule<{
15
- values?: boolean | undefined;
16
15
  definitions?: boolean | undefined;
17
16
  selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
18
17
  arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
18
+ values?: boolean | undefined;
19
19
  fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
20
20
  variables?: boolean | undefined;
21
21
  groups?: string[] | undefined;
@@ -384,12 +384,14 @@ ${_utilsjs.TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
384
384
  };
385
385
  }
386
386
  }, checkUnderscore = (isLeading) => (node) => {
387
+ if (node.parent.kind === "Field" && node.parent.alias !== node)
388
+ return;
387
389
  const suggestedName = node.value.replace(isLeading ? /^_+/ : /_+$/, "");
388
390
  report(node, `${isLeading ? "Leading" : "Trailing"} underscores are not allowed`, [
389
391
  suggestedName
390
392
  ]);
391
393
  }, listeners = {};
392
- allowLeadingUnderscore || (listeners["Name[value=/^_/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!1));
394
+ allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
393
395
  const selectors = new Set(
394
396
  [types && _utilsjs.TYPES_KINDS, Object.keys(restOptions)].flat().filter(_utilsjs.truthy)
395
397
  );
@@ -104,7 +104,7 @@ Include it in your selection set{{ addition }}.`
104
104
  schema
105
105
  },
106
106
  create(context) {
107
- const schema2 = _utilsjs.requireGraphQLSchemaFromContext.call(void 0, RULE_ID, context), siblings = _utilsjs.requireSiblingsOperations.call(void 0, RULE_ID, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = _utils.asArray.call(void 0, fieldName), selector = "OperationDefinition SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new (0, _graphql.TypeInfo)(schema2);
107
+ const schema2 = _utilsjs.requireGraphQLSchemaFromContext.call(void 0, RULE_ID, context), siblings = _utilsjs.requireSiblingsOperations.call(void 0, RULE_ID, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = _utils.asArray.call(void 0, fieldName), selector = "SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new (0, _graphql.TypeInfo)(schema2);
108
108
  function checkFragments(node) {
109
109
  for (const selection of node.selections) {
110
110
  if (selection.kind !== _graphql.Kind.FRAGMENT_SPREAD)
package/esm/index.d.ts CHANGED
@@ -48,10 +48,10 @@ declare const _default: {
48
48
  };
49
49
  rules: {
50
50
  alphabetize: GraphQLESLintRule<{
51
+ values?: boolean | undefined;
51
52
  definitions?: boolean | undefined;
52
53
  selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
53
54
  arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
54
- values?: boolean | undefined;
55
55
  fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
56
56
  variables?: boolean | undefined;
57
57
  groups?: string[] | undefined;
package/esm/meta.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./chunk-UIAXBAMD.js";
2
- const version = "4.0.0-alpha.11";
2
+ const version = "4.0.0-alpha.12";
3
3
  export {
4
4
  version
5
5
  };
@@ -12,10 +12,10 @@ import 'json-schema-to-ts';
12
12
 
13
13
  declare const rules: {
14
14
  alphabetize: GraphQLESLintRule<{
15
+ values?: boolean | undefined;
15
16
  definitions?: boolean | undefined;
16
17
  selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined;
17
18
  arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined;
18
- values?: boolean | undefined;
19
19
  fields?: ("ObjectTypeDefinition" | "InterfaceTypeDefinition" | "InputObjectTypeDefinition")[] | undefined;
20
20
  variables?: boolean | undefined;
21
21
  groups?: string[] | undefined;
@@ -384,12 +384,14 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
384
384
  };
385
385
  }
386
386
  }, checkUnderscore = (isLeading) => (node) => {
387
+ if (node.parent.kind === "Field" && node.parent.alias !== node)
388
+ return;
387
389
  const suggestedName = node.value.replace(isLeading ? /^_+/ : /_+$/, "");
388
390
  report(node, `${isLeading ? "Leading" : "Trailing"} underscores are not allowed`, [
389
391
  suggestedName
390
392
  ]);
391
393
  }, listeners = {};
392
- allowLeadingUnderscore || (listeners["Name[value=/^_/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!1));
394
+ allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
393
395
  const selectors = new Set(
394
396
  [types && TYPES_KINDS, Object.keys(restOptions)].flat().filter(truthy)
395
397
  );
@@ -104,7 +104,7 @@ Include it in your selection set{{ addition }}.`
104
104
  schema
105
105
  },
106
106
  create(context) {
107
- const schema2 = requireGraphQLSchemaFromContext(RULE_ID, context), siblings = requireSiblingsOperations(RULE_ID, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "OperationDefinition SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo(schema2);
107
+ const schema2 = requireGraphQLSchemaFromContext(RULE_ID, context), siblings = requireSiblingsOperations(RULE_ID, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo(schema2);
108
108
  function checkFragments(node) {
109
109
  for (const selection of node.selections) {
110
110
  if (selection.kind !== Kind.FRAGMENT_SPREAD)
package/index.browser.js CHANGED
@@ -2509,12 +2509,14 @@ ${TYPES_KINDS.map((kind) => `- \`${kind}\``).join(`
2509
2509
  };
2510
2510
  }
2511
2511
  }, checkUnderscore = (isLeading) => (node) => {
2512
+ if (node.parent.kind === "Field" && node.parent.alias !== node)
2513
+ return;
2512
2514
  let suggestedName = node.value.replace(isLeading ? /^_+/ : /_+$/, "");
2513
2515
  report(node, `${isLeading ? "Leading" : "Trailing"} underscores are not allowed`, [
2514
2516
  suggestedName
2515
2517
  ]);
2516
2518
  }, listeners = {};
2517
- allowLeadingUnderscore || (listeners["Name[value=/^_/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]:matches([parent.kind!=Field], [parent.kind=Field][parent.alias])"] = checkUnderscore(!1));
2519
+ allowLeadingUnderscore || (listeners["Name[value=/^_/]"] = checkUnderscore(!0)), allowTrailingUnderscore || (listeners["Name[value=/_$/]"] = checkUnderscore(!1));
2518
2520
  let selectors = new Set(
2519
2521
  [types && TYPES_KINDS, Object.keys(restOptions)].flat().filter(truthy)
2520
2522
  );
@@ -4765,7 +4767,7 @@ Include it in your selection set{{ addition }}.`
4765
4767
  schema: schema13
4766
4768
  },
4767
4769
  create(context) {
4768
- let schema16 = requireGraphQLSchemaFromContext(RULE_ID19, context), siblings = requireSiblingsOperations(RULE_ID19, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "OperationDefinition SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo3(schema16);
4770
+ let schema16 = requireGraphQLSchemaFromContext(RULE_ID19, context), siblings = requireSiblingsOperations(RULE_ID19, context), { fieldName = DEFAULT_ID_FIELD_NAME } = context.options[0] || {}, idNames = asArray(fieldName), selector = "SelectionSet[parent.kind!=/(^OperationDefinition|InlineFragment)$/]", typeInfo = new TypeInfo3(schema16);
4769
4771
  function checkFragments(node) {
4770
4772
  for (let selection of node.selections) {
4771
4773
  if (selection.kind !== Kind21.FRAGMENT_SPREAD)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "4.0.0-alpha.11",
3
+ "version": "4.0.0-alpha.12",
4
4
  "type": "module",
5
5
  "description": "GraphQL plugin for ESLint",
6
6
  "repository": "https://github.com/B2o5T/graphql-eslint",