@graphql-eslint/eslint-plugin 2.3.2-alpha-ace9d56.0 → 2.3.2-alpha-6695e95.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 +15 -14
  2. package/index.mjs +15 -14
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1898,8 +1898,8 @@ const rule$b = {
1898
1898
  mutation {
1899
1899
  changeSomething(
1900
1900
  type: OLD # This is deprecated, so you'll get an error
1901
- ) {
1902
- ...
1901
+ ) {
1902
+ ...
1903
1903
  }
1904
1904
  }
1905
1905
  `,
@@ -1937,9 +1937,8 @@ const rule$b = {
1937
1937
  const typeInfo = node.typeInfo();
1938
1938
  if (typeInfo && typeInfo.enumValue) {
1939
1939
  if (typeInfo.enumValue.isDeprecated) {
1940
- const enumValueName = node.value;
1941
1940
  context.report({
1942
- loc: getLocation(node.loc, enumValueName),
1941
+ loc: node.loc,
1943
1942
  messageId: NO_DEPRECATED,
1944
1943
  data: {
1945
1944
  type: 'enum value',
@@ -1954,9 +1953,8 @@ const rule$b = {
1954
1953
  const typeInfo = node.typeInfo();
1955
1954
  if (typeInfo && typeInfo.fieldDef) {
1956
1955
  if (typeInfo.fieldDef.isDeprecated) {
1957
- const fieldName = node.name.value;
1958
1956
  context.report({
1959
- loc: getLocation(node.loc, fieldName),
1957
+ loc: node.loc,
1960
1958
  messageId: NO_DEPRECATED,
1961
1959
  data: {
1962
1960
  type: 'field',
@@ -2417,10 +2415,10 @@ const rule$g = {
2417
2415
  ],
2418
2416
  },
2419
2417
  messages: {
2420
- [MESSAGE_REQUIRE_DATE]: 'Directive "@deprecated" must have a deletion date.',
2421
- [MESSAGE_INVALID_FORMAT]: 'Deletion date must be in format "DD/MM/YYYY".',
2422
- [MESSAGE_INVALID_DATE]: 'Invalid "{{ deletionDate }}" deletion date.',
2423
- [MESSAGE_CAN_BE_REMOVED]: '"{{ nodeName }}" сan be removed.',
2418
+ [MESSAGE_REQUIRE_DATE]: 'Directive "@deprecated" must have a deletion date',
2419
+ [MESSAGE_INVALID_FORMAT]: 'Deletion date must be in format "DD/MM/YYYY"',
2420
+ [MESSAGE_INVALID_DATE]: 'Invalid "{{ deletionDate }}" deletion date',
2421
+ [MESSAGE_CAN_BE_REMOVED]: '"{{ nodeName }}" сan be removed',
2424
2422
  },
2425
2423
  schema: [
2426
2424
  {
@@ -2441,13 +2439,16 @@ const rule$g = {
2441
2439
  const argName = ((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.argumentName) || 'deletionDate';
2442
2440
  const deletionDateNode = node.arguments.find(arg => arg.name.value === argName);
2443
2441
  if (!deletionDateNode) {
2444
- context.report({ node: node.name, messageId: MESSAGE_REQUIRE_DATE });
2442
+ context.report({
2443
+ loc: getLocation(node.loc, node.name.value, { offsetEnd: 0 }),
2444
+ messageId: MESSAGE_REQUIRE_DATE,
2445
+ });
2445
2446
  return;
2446
2447
  }
2447
2448
  const deletionDate = valueFromNode(deletionDateNode.value);
2448
2449
  const isValidDate = DATE_REGEX.test(deletionDate);
2449
2450
  if (!isValidDate) {
2450
- context.report({ node: node.name, messageId: MESSAGE_INVALID_FORMAT });
2451
+ context.report({ node: deletionDateNode.value, messageId: MESSAGE_INVALID_FORMAT });
2451
2452
  return;
2452
2453
  }
2453
2454
  let [day, month, year] = deletionDate.split('/');
@@ -2456,7 +2457,7 @@ const rule$g = {
2456
2457
  const deletionDateInMS = Date.parse(`${year}-${month}-${day}`);
2457
2458
  if (Number.isNaN(deletionDateInMS)) {
2458
2459
  context.report({
2459
- node: node.name,
2460
+ node: deletionDateNode.value,
2460
2461
  messageId: MESSAGE_INVALID_DATE,
2461
2462
  data: {
2462
2463
  deletionDate,
@@ -2467,7 +2468,7 @@ const rule$g = {
2467
2468
  const canRemove = Date.now() > deletionDateInMS;
2468
2469
  if (canRemove) {
2469
2470
  context.report({
2470
- node: node.name,
2471
+ node,
2471
2472
  messageId: MESSAGE_CAN_BE_REMOVED,
2472
2473
  data: {
2473
2474
  nodeName: node.parent.name.value,
package/index.mjs CHANGED
@@ -1892,8 +1892,8 @@ const rule$b = {
1892
1892
  mutation {
1893
1893
  changeSomething(
1894
1894
  type: OLD # This is deprecated, so you'll get an error
1895
- ) {
1896
- ...
1895
+ ) {
1896
+ ...
1897
1897
  }
1898
1898
  }
1899
1899
  `,
@@ -1931,9 +1931,8 @@ const rule$b = {
1931
1931
  const typeInfo = node.typeInfo();
1932
1932
  if (typeInfo && typeInfo.enumValue) {
1933
1933
  if (typeInfo.enumValue.isDeprecated) {
1934
- const enumValueName = node.value;
1935
1934
  context.report({
1936
- loc: getLocation(node.loc, enumValueName),
1935
+ loc: node.loc,
1937
1936
  messageId: NO_DEPRECATED,
1938
1937
  data: {
1939
1938
  type: 'enum value',
@@ -1948,9 +1947,8 @@ const rule$b = {
1948
1947
  const typeInfo = node.typeInfo();
1949
1948
  if (typeInfo && typeInfo.fieldDef) {
1950
1949
  if (typeInfo.fieldDef.isDeprecated) {
1951
- const fieldName = node.name.value;
1952
1950
  context.report({
1953
- loc: getLocation(node.loc, fieldName),
1951
+ loc: node.loc,
1954
1952
  messageId: NO_DEPRECATED,
1955
1953
  data: {
1956
1954
  type: 'field',
@@ -2411,10 +2409,10 @@ const rule$g = {
2411
2409
  ],
2412
2410
  },
2413
2411
  messages: {
2414
- [MESSAGE_REQUIRE_DATE]: 'Directive "@deprecated" must have a deletion date.',
2415
- [MESSAGE_INVALID_FORMAT]: 'Deletion date must be in format "DD/MM/YYYY".',
2416
- [MESSAGE_INVALID_DATE]: 'Invalid "{{ deletionDate }}" deletion date.',
2417
- [MESSAGE_CAN_BE_REMOVED]: '"{{ nodeName }}" сan be removed.',
2412
+ [MESSAGE_REQUIRE_DATE]: 'Directive "@deprecated" must have a deletion date',
2413
+ [MESSAGE_INVALID_FORMAT]: 'Deletion date must be in format "DD/MM/YYYY"',
2414
+ [MESSAGE_INVALID_DATE]: 'Invalid "{{ deletionDate }}" deletion date',
2415
+ [MESSAGE_CAN_BE_REMOVED]: '"{{ nodeName }}" сan be removed',
2418
2416
  },
2419
2417
  schema: [
2420
2418
  {
@@ -2435,13 +2433,16 @@ const rule$g = {
2435
2433
  const argName = ((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.argumentName) || 'deletionDate';
2436
2434
  const deletionDateNode = node.arguments.find(arg => arg.name.value === argName);
2437
2435
  if (!deletionDateNode) {
2438
- context.report({ node: node.name, messageId: MESSAGE_REQUIRE_DATE });
2436
+ context.report({
2437
+ loc: getLocation(node.loc, node.name.value, { offsetEnd: 0 }),
2438
+ messageId: MESSAGE_REQUIRE_DATE,
2439
+ });
2439
2440
  return;
2440
2441
  }
2441
2442
  const deletionDate = valueFromNode(deletionDateNode.value);
2442
2443
  const isValidDate = DATE_REGEX.test(deletionDate);
2443
2444
  if (!isValidDate) {
2444
- context.report({ node: node.name, messageId: MESSAGE_INVALID_FORMAT });
2445
+ context.report({ node: deletionDateNode.value, messageId: MESSAGE_INVALID_FORMAT });
2445
2446
  return;
2446
2447
  }
2447
2448
  let [day, month, year] = deletionDate.split('/');
@@ -2450,7 +2451,7 @@ const rule$g = {
2450
2451
  const deletionDateInMS = Date.parse(`${year}-${month}-${day}`);
2451
2452
  if (Number.isNaN(deletionDateInMS)) {
2452
2453
  context.report({
2453
- node: node.name,
2454
+ node: deletionDateNode.value,
2454
2455
  messageId: MESSAGE_INVALID_DATE,
2455
2456
  data: {
2456
2457
  deletionDate,
@@ -2461,7 +2462,7 @@ const rule$g = {
2461
2462
  const canRemove = Date.now() > deletionDateInMS;
2462
2463
  if (canRemove) {
2463
2464
  context.report({
2464
- node: node.name,
2465
+ node,
2465
2466
  messageId: MESSAGE_CAN_BE_REMOVED,
2466
2467
  data: {
2467
2468
  nodeName: node.parent.name.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-eslint/eslint-plugin",
3
- "version": "2.3.2-alpha-ace9d56.0",
3
+ "version": "2.3.2-alpha-6695e95.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"