@graphql-eslint/eslint-plugin 2.3.2-alpha-13a11c2.0 → 2.3.2-alpha-ace9d56.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.
Files changed (3) hide show
  1. package/index.js +12 -12
  2. package/index.mjs +12 -12
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1213,11 +1213,10 @@ const rule$6 = {
1213
1213
  const shouldCheckType = node => (options.checkMutations && isMutationType(node)) || (options.checkQueries && isQueryType(node));
1214
1214
  const listeners = {
1215
1215
  'FieldDefinition > InputValueDefinition': node => {
1216
- const name = node.name.value;
1217
- if (name !== 'input' && shouldCheckType(node.parent.parent)) {
1216
+ if (node.name.value !== 'input' && shouldCheckType(node.parent.parent)) {
1218
1217
  context.report({
1219
- loc: getLocation(node.loc, name),
1220
- message: `Input "${name}" should be called "input"`,
1218
+ node: node.name,
1219
+ message: `Input "${node.name.value}" should be called "input"`,
1221
1220
  });
1222
1221
  }
1223
1222
  },
@@ -1234,12 +1233,11 @@ const rule$6 = {
1234
1233
  const inputValueNode = findInputType(node);
1235
1234
  if (shouldCheckType(inputValueNode.parent.parent)) {
1236
1235
  const mutationName = `${inputValueNode.parent.name.value}Input`;
1237
- const name = node.name.value;
1238
1236
  if ((options.caseSensitiveInputType && node.name.value !== mutationName) ||
1239
- name.toLowerCase() !== mutationName.toLowerCase()) {
1237
+ node.name.value.toLowerCase() !== mutationName.toLowerCase()) {
1240
1238
  context.report({
1241
- loc: getLocation(node.loc, name),
1242
- message: `InputType "${name}" name should be "${mutationName}"`,
1239
+ node,
1240
+ message: `InputType "${node.name.value}" name should be "${mutationName}"`,
1243
1241
  });
1244
1242
  }
1245
1243
  }
@@ -1900,8 +1898,8 @@ const rule$b = {
1900
1898
  mutation {
1901
1899
  changeSomething(
1902
1900
  type: OLD # This is deprecated, so you'll get an error
1903
- ) {
1904
- ...
1901
+ ) {
1902
+ ...
1905
1903
  }
1906
1904
  }
1907
1905
  `,
@@ -1939,8 +1937,9 @@ const rule$b = {
1939
1937
  const typeInfo = node.typeInfo();
1940
1938
  if (typeInfo && typeInfo.enumValue) {
1941
1939
  if (typeInfo.enumValue.isDeprecated) {
1940
+ const enumValueName = node.value;
1942
1941
  context.report({
1943
- loc: node.loc,
1942
+ loc: getLocation(node.loc, enumValueName),
1944
1943
  messageId: NO_DEPRECATED,
1945
1944
  data: {
1946
1945
  type: 'enum value',
@@ -1955,8 +1954,9 @@ const rule$b = {
1955
1954
  const typeInfo = node.typeInfo();
1956
1955
  if (typeInfo && typeInfo.fieldDef) {
1957
1956
  if (typeInfo.fieldDef.isDeprecated) {
1957
+ const fieldName = node.name.value;
1958
1958
  context.report({
1959
- loc: node.loc,
1959
+ loc: getLocation(node.loc, fieldName),
1960
1960
  messageId: NO_DEPRECATED,
1961
1961
  data: {
1962
1962
  type: 'field',
package/index.mjs CHANGED
@@ -1207,11 +1207,10 @@ const rule$6 = {
1207
1207
  const shouldCheckType = node => (options.checkMutations && isMutationType(node)) || (options.checkQueries && isQueryType(node));
1208
1208
  const listeners = {
1209
1209
  'FieldDefinition > InputValueDefinition': node => {
1210
- const name = node.name.value;
1211
- if (name !== 'input' && shouldCheckType(node.parent.parent)) {
1210
+ if (node.name.value !== 'input' && shouldCheckType(node.parent.parent)) {
1212
1211
  context.report({
1213
- loc: getLocation(node.loc, name),
1214
- message: `Input "${name}" should be called "input"`,
1212
+ node: node.name,
1213
+ message: `Input "${node.name.value}" should be called "input"`,
1215
1214
  });
1216
1215
  }
1217
1216
  },
@@ -1228,12 +1227,11 @@ const rule$6 = {
1228
1227
  const inputValueNode = findInputType(node);
1229
1228
  if (shouldCheckType(inputValueNode.parent.parent)) {
1230
1229
  const mutationName = `${inputValueNode.parent.name.value}Input`;
1231
- const name = node.name.value;
1232
1230
  if ((options.caseSensitiveInputType && node.name.value !== mutationName) ||
1233
- name.toLowerCase() !== mutationName.toLowerCase()) {
1231
+ node.name.value.toLowerCase() !== mutationName.toLowerCase()) {
1234
1232
  context.report({
1235
- loc: getLocation(node.loc, name),
1236
- message: `InputType "${name}" name should be "${mutationName}"`,
1233
+ node,
1234
+ message: `InputType "${node.name.value}" name should be "${mutationName}"`,
1237
1235
  });
1238
1236
  }
1239
1237
  }
@@ -1894,8 +1892,8 @@ const rule$b = {
1894
1892
  mutation {
1895
1893
  changeSomething(
1896
1894
  type: OLD # This is deprecated, so you'll get an error
1897
- ) {
1898
- ...
1895
+ ) {
1896
+ ...
1899
1897
  }
1900
1898
  }
1901
1899
  `,
@@ -1933,8 +1931,9 @@ const rule$b = {
1933
1931
  const typeInfo = node.typeInfo();
1934
1932
  if (typeInfo && typeInfo.enumValue) {
1935
1933
  if (typeInfo.enumValue.isDeprecated) {
1934
+ const enumValueName = node.value;
1936
1935
  context.report({
1937
- loc: node.loc,
1936
+ loc: getLocation(node.loc, enumValueName),
1938
1937
  messageId: NO_DEPRECATED,
1939
1938
  data: {
1940
1939
  type: 'enum value',
@@ -1949,8 +1948,9 @@ const rule$b = {
1949
1948
  const typeInfo = node.typeInfo();
1950
1949
  if (typeInfo && typeInfo.fieldDef) {
1951
1950
  if (typeInfo.fieldDef.isDeprecated) {
1951
+ const fieldName = node.name.value;
1952
1952
  context.report({
1953
- loc: node.loc,
1953
+ loc: getLocation(node.loc, fieldName),
1954
1954
  messageId: NO_DEPRECATED,
1955
1955
  data: {
1956
1956
  type: 'field',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "2.3.2-alpha-13a11c2.0",
3
+ "version": "2.3.2-alpha-ace9d56.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0"