@arcgis/eslint-config 5.1.0-next.98 → 5.2.0-next.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/README.md CHANGED
@@ -8,5 +8,5 @@ It is not intended to be used directly, but rather used as a dependency by other
8
8
 
9
9
  ## License
10
10
 
11
- This package is licensed under the terms described in the `LICENSE.md` file, located in the root of the package, and at https://js.arcgis.com/5.0/LICENSE.txt.
12
- For third party notices, see https://js.arcgis.com/5.0/third-party-notices.txt.
11
+ This package is licensed under the terms described in the `LICENSE.md` file, located in the root of the package, and at https://js.arcgis.com/5.1/LICENSE.txt.
12
+ For third party notices, see https://js.arcgis.com/5.1/third-party-notices.txt.
@@ -1,5 +1,5 @@
1
1
  import { ESLintUtils, AST_NODE_TYPES } from "@typescript-eslint/utils";
2
- const version = "5.1.0-next.98";
2
+ const version = "5.2.0-next.0";
3
3
  const packageJson = {
4
4
  version
5
5
  };
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin, l as luminaJsxExportName, a as luminaEntrypointName, b as luminaTestEntrypointName, s as sourceCodeDeclaresComponent, p as parsePropertyDecorator, c as getProperty, i as isGetterWithoutSetter, e as extractDeclareElementsInterface, d as isCreateEvent, h as hasDecorator, f as getName, j as checkForLuminaJsx, k as isBindThisCallee, g as getComponentDeclaration, u as unwrapExpression } from "../../estree-M1-bSnaj.js";
1
+ import { m as makeEslintPlugin, l as luminaJsxExportName, a as luminaEntrypointName, b as luminaTestEntrypointName, s as sourceCodeDeclaresComponent, p as parsePropertyDecorator, c as getProperty, i as isGetterWithoutSetter, e as extractDeclareElementsInterface, d as isCreateEvent, h as hasDecorator, f as getName, j as checkForLuminaJsx, k as isBindThisCallee, g as getComponentDeclaration, u as unwrapExpression } from "../../estree-D4NC8KvY.js";
2
2
  import { AST_NODE_TYPES, ESLintUtils, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
3
3
  import ts from "typescript";
4
4
  import { camelToKebab } from "@arcgis/toolkit/string";
@@ -7,16 +7,16 @@ const plugin = makeEslintPlugin(
7
7
  (rule) => `https://devtopia.esri.com/WebGIS/arcgis-web-components/tree/main/packages/support-packages/eslint-config/src/plugins/lumina/rules/${rule}.ts`
8
8
  );
9
9
  const importDeclaration = `import { ${luminaJsxExportName} } from "${luminaEntrypointName}";`;
10
- const description$l = `To use Lumina's JSX, you need to ${importDeclaration}`;
10
+ const description$m = `To use Lumina's JSX, you need to ${importDeclaration}`;
11
11
  plugin.createRule({
12
12
  name: "add-missing-jsx-import",
13
13
  meta: {
14
14
  docs: {
15
- description: description$l,
15
+ description: description$m,
16
16
  defaultLevel: "error"
17
17
  },
18
18
  messages: {
19
- addMissingJsxImport: description$l
19
+ addMissingJsxImport: description$m
20
20
  },
21
21
  type: "problem",
22
22
  schema: [],
@@ -73,12 +73,12 @@ plugin.createRule({
73
73
  };
74
74
  }
75
75
  });
76
- const description$k = "Auto add { type: Boolean } or { type: Number } where necessary";
76
+ const description$l = "Auto add { type: Boolean } or { type: Number } where necessary";
77
77
  plugin.createRule({
78
78
  name: "auto-add-type",
79
79
  meta: {
80
80
  docs: {
81
- description: description$k,
81
+ description: description$l,
82
82
  defaultLevel: "warn"
83
83
  },
84
84
  messages: {
@@ -115,7 +115,7 @@ More information: https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/
115
115
  const typeProperty = getProperty(properties, "type");
116
116
  const converterProperty = getProperty(properties, "converter");
117
117
  const isTrivialType = trivialType === "Number" || trivialType === "Boolean";
118
- if (isTrivialType && typeProperty !== void 0 && typeProperty.type === AST_NODE_TYPES.Identifier && (typeProperty.name === "Number" || typeProperty.name === "Boolean")) {
118
+ if (isTrivialType && typeProperty?.type === AST_NODE_TYPES.Identifier && (typeProperty.name === "Number" || typeProperty.name === "Boolean")) {
119
119
  context.report({
120
120
  node: typeProperty,
121
121
  messageId: "noUnnecessaryType",
@@ -312,12 +312,12 @@ plugin.createRule({
312
312
  };
313
313
  }
314
314
  });
315
- const description$j = `Lumina component must be declared in a TSX file with a matching folder name located inside of src/components folder.`;
315
+ const description$k = `Lumina component must be declared in a TSX file with a matching folder name located inside of src/components folder.`;
316
316
  plugin.createRule({
317
317
  name: "component-placement-rules",
318
318
  meta: {
319
319
  docs: {
320
- description: description$j,
320
+ description: description$k,
321
321
  defaultLevel: "error"
322
322
  },
323
323
  messages: {
@@ -356,7 +356,7 @@ plugin.createRule({
356
356
  };
357
357
  }
358
358
  });
359
- const description$i = `Enforce consistent event naming.`;
359
+ const description$j = `Enforce consistent event naming.`;
360
360
  const defaultOptions$1 = [
361
361
  {
362
362
  eventNamespaces: ["arcgis"],
@@ -367,7 +367,7 @@ plugin.createRule({
367
367
  name: "consistent-event-naming",
368
368
  meta: {
369
369
  docs: {
370
- description: description$i,
370
+ description: description$j,
371
371
  defaultLevel: "warn"
372
372
  },
373
373
  messages: {
@@ -468,12 +468,12 @@ Discussion: https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/3
468
468
  }
469
469
  });
470
470
  const capitalAfterLower = /(?<=[a-z\d])[A-Z]/u;
471
- const description$h = `Enforce consistent usage of ? for marking property as nullable, rather than |null, |undefined or |Nil.`;
471
+ const description$i = `Enforce consistent usage of ? for marking property as nullable, rather than |null, |undefined or |Nil.`;
472
472
  plugin.createRule({
473
473
  name: "consistent-nullability",
474
474
  meta: {
475
475
  docs: {
476
- description: description$h,
476
+ description: description$i,
477
477
  // TODO: enable this by default
478
478
  defaultLevel: "off"
479
479
  },
@@ -549,18 +549,18 @@ plugin.createRule({
549
549
  };
550
550
  }
551
551
  });
552
- const description$g = `Enforce that @property(), @method() and createEvent() members are used in the correct context.`;
552
+ const description$h = `Enforce that @property(), @method() and createEvent() members are used in the correct context.`;
553
553
  plugin.createRule({
554
554
  name: "decorators-context",
555
555
  meta: {
556
556
  docs: {
557
- description: description$g,
557
+ description: description$h,
558
558
  defaultLevel: "error"
559
559
  },
560
560
  messages: {
561
561
  publicApiMustBePublic: `@property(), @method() and createEvent() members must not have private or protected modifier.
562
562
 
563
- If you wish to hide this member from public documentation, use @private or @protected JSDoc tags instead. Documentation: https://webgis.esri.com/references/lumina/documenting-components#excluding-api-from-public-documentation`,
563
+ If you wish to hide this member from public documentation, use @private or @internal JSDoc tags instead. Documentation: https://webgis.esri.com/references/api-extractor/tags-reference`,
564
564
  noPropertyDecoratorOnMethods: `Methods must not have @property() nor @state() decorator. Did you mean @property() instead?`,
565
565
  noCombinedPropertyEvent: `Property may either be an event (initialized with createEvent()) or a property (has @property() decorator), but not both`,
566
566
  noCombinedPropertyState: `Property may either be a state (initialized with @state()) or a property (has @property() decorator), but not both`,
@@ -651,7 +651,7 @@ function isLuminaJsxType(type) {
651
651
  }
652
652
  const hasTypeFlag = (type, flag) => type.flags & flag ? true : (type.flags & ts.TypeFlags.Union) !== 0 && type.types.some((t) => hasTypeFlag(t, flag));
653
653
  const literalTypeFlag = ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BooleanLike;
654
- const description$f = `Need to add explicit type annotation: {{ setterType }}
654
+ const description$g = `Need to add explicit type annotation: {{ setterType }}
655
655
 
656
656
  Explanation:
657
657
  Lumina automatically creates an attribute for a property if property type includes a literal type (string|number|boolean).
@@ -662,11 +662,11 @@ plugin.createRule({
662
662
  name: "explicit-setter-type",
663
663
  meta: {
664
664
  docs: {
665
- description: description$f,
665
+ description: description$g,
666
666
  defaultLevel: "error"
667
667
  },
668
668
  messages: {
669
- explicitSetterType: description$f,
669
+ explicitSetterType: description$g,
670
670
  addExplicitSetterType: `Add {{ setterType }} type annotation`
671
671
  },
672
672
  type: "problem",
@@ -1212,16 +1212,16 @@ function isCreateElementComponent(node) {
1212
1212
  }
1213
1213
  return false;
1214
1214
  }
1215
- const description$e = `Use @internal or @private JSDoc tag over @ignore. See https://webgis.esri.com/references/lumina/documenting-components#excluding-api-from-public-documentation`;
1215
+ const description$f = `Use @internal or @private JSDoc tag over @ignore. See https://webgis.esri.com/references/api-extractor/tags-reference`;
1216
1216
  plugin.createRule({
1217
1217
  name: "no-ignore-jsdoc-tag",
1218
1218
  meta: {
1219
1219
  docs: {
1220
- description: description$e,
1220
+ description: description$f,
1221
1221
  defaultLevel: "error"
1222
1222
  },
1223
1223
  messages: {
1224
- noIgnoreJsDocTag: description$e
1224
+ noIgnoreJsDocTag: description$f
1225
1225
  },
1226
1226
  type: "problem",
1227
1227
  schema: []
@@ -1250,12 +1250,12 @@ plugin.createRule({
1250
1250
  }
1251
1251
  });
1252
1252
  const reIgnore = /\* @ignore/gu;
1253
- const description$d = `Detect incorrect usage of dynamic JSX tag name`;
1253
+ const description$e = `Detect incorrect usage of dynamic JSX tag name`;
1254
1254
  plugin.createRule({
1255
1255
  name: "no-incorrect-dynamic-tag-name",
1256
1256
  meta: {
1257
1257
  docs: {
1258
- description: description$d,
1258
+ description: description$e,
1259
1259
  defaultLevel: "error"
1260
1260
  },
1261
1261
  messages: {
@@ -1298,18 +1298,18 @@ plugin.createRule({
1298
1298
  };
1299
1299
  }
1300
1300
  });
1301
- const description$c = `If inline arrow function is passed to ref, it will be called again on each render.
1301
+ const description$d = `If inline arrow function is passed to ref, it will be called again on each render.
1302
1302
 
1303
1303
  If this is not desirable, see alternatives: https://webgis.esri.com/references/lumina/jsx#refs`;
1304
1304
  plugin.createRule({
1305
1305
  name: "no-inline-arrow-in-ref",
1306
1306
  meta: {
1307
1307
  docs: {
1308
- description: description$c,
1308
+ description: description$d,
1309
1309
  defaultLevel: "warn"
1310
1310
  },
1311
1311
  messages: {
1312
- errorInlineArrow: description$c
1312
+ errorInlineArrow: description$d
1313
1313
  },
1314
1314
  type: "problem",
1315
1315
  schema: []
@@ -1335,16 +1335,16 @@ plugin.createRule({
1335
1335
  };
1336
1336
  }
1337
1337
  });
1338
- const description$b = `Put @internal and @private on their own JSDoc line, not inline.`;
1338
+ const description$c = `Put @internal and @private on their own JSDoc line, not inline.`;
1339
1339
  plugin.createRule({
1340
1340
  name: "no-inline-exposure-jsdoc-tag",
1341
1341
  meta: {
1342
1342
  docs: {
1343
- description: description$b,
1343
+ description: description$c,
1344
1344
  defaultLevel: "error"
1345
1345
  },
1346
1346
  messages: {
1347
- inlineExposure: description$b
1347
+ inlineExposure: description$c
1348
1348
  },
1349
1349
  type: "problem",
1350
1350
  schema: []
@@ -1379,6 +1379,50 @@ plugin.createRule({
1379
1379
  };
1380
1380
  }
1381
1381
  });
1382
+ const absoluteDocsBaseUrl = "https://next.gha.afd.arcgis.com/";
1383
+ const description$b = `xref:// URLs are not supported in JSDoc. Use absolute links to ${absoluteDocsBaseUrl} instead.`;
1384
+ plugin.createRule({
1385
+ name: "no-jsdoc-xref-links",
1386
+ meta: {
1387
+ docs: {
1388
+ description: description$b,
1389
+ defaultLevel: "error"
1390
+ },
1391
+ messages: {
1392
+ noJsDocXrefLinks: description$b
1393
+ },
1394
+ type: "problem",
1395
+ schema: []
1396
+ },
1397
+ defaultOptions: [],
1398
+ create(context) {
1399
+ return {
1400
+ "Program:exit"() {
1401
+ const source = context.sourceCode.text;
1402
+ if (!source.includes("xref://")) {
1403
+ return;
1404
+ }
1405
+ for (const comment of context.sourceCode.getAllComments()) {
1406
+ const commentText = source.slice(comment.range[0], comment.range[1]);
1407
+ if (!commentText.startsWith("/**") || !commentText.includes("xref://")) {
1408
+ continue;
1409
+ }
1410
+ for (const match of commentText.matchAll(reXrefUrl)) {
1411
+ const idx = comment.range[0] + (match.index ?? 0);
1412
+ context.report({
1413
+ messageId: "noJsDocXrefLinks",
1414
+ loc: {
1415
+ start: context.sourceCode.getLocFromIndex(idx),
1416
+ end: context.sourceCode.getLocFromIndex(idx + match[0].length)
1417
+ }
1418
+ });
1419
+ }
1420
+ }
1421
+ }
1422
+ };
1423
+ }
1424
+ });
1425
+ const reXrefUrl = /xref:\/\/[\w./#-]+/gu;
1382
1426
  const description$a = `directives={} prop value must be an array literal. Documentation: https://webgis.esri.com/references/lumina/jsx#lit-directives`;
1383
1427
  plugin.createRule({
1384
1428
  name: "no-invalid-directives-prop",
@@ -1740,7 +1784,7 @@ plugin.createRule({
1740
1784
  return;
1741
1785
  }
1742
1786
  const argument = functionParent.params.at(0);
1743
- if (argument === void 0 || argument.type !== AST_NODE_TYPES.Identifier || argument.name !== eventVariableName) {
1787
+ if (argument?.type !== AST_NODE_TYPES.Identifier || argument.name !== eventVariableName) {
1744
1788
  return;
1745
1789
  }
1746
1790
  const reportPossiblyUnnecessaryTypeAssertion = () => context.report({
@@ -0,0 +1,2 @@
1
+ declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noJsDocXrefLinks", [], import('../../utils/makePlugin.ts').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
2
+ export default _default;
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin, e as extractDeclareElementsInterface, g as getComponentDeclaration } from "../../estree-M1-bSnaj.js";
1
+ import { m as makeEslintPlugin, e as extractDeclareElementsInterface, g as getComponentDeclaration } from "../../estree-D4NC8KvY.js";
2
2
  import { resolve } from "path/posix";
3
3
  import { AST_NODE_TYPES } from "@typescript-eslint/utils";
4
4
  const plugin = makeEslintPlugin(
@@ -29,7 +29,7 @@ plugin.createRule({
29
29
  return {};
30
30
  }
31
31
  const basePath = fileName.slice(0, srcIndex + "/src/".length);
32
- if (isTestFile(fileName)) {
32
+ if (isTestFile(fileName) || isStorybookFile(fileName)) {
33
33
  return {};
34
34
  }
35
35
  return {
@@ -217,7 +217,7 @@ plugin.createRule({
217
217
  };
218
218
  }
219
219
  });
220
- const description$1 = `Do not use links like [](#something) as they are not portable across .d.ts, and are not validated at build time. Use {@link } syntax, or absolute links. See https://webgis.esri.com/sdk/contributing/core/core/documenting-api#link`;
220
+ const description$1 = `Do not use links like [](#something) as they are not portable across .d.ts, and are not validated at build time. Use {@link } syntax, or absolute links. See https://webgis.esri.com/references/api-extractor/tags-reference#link)`;
221
221
  plugin.createRule({
222
222
  name: "no-unsafe-hash-links",
223
223
  meta: {
package/package.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "name": "@arcgis/eslint-config",
3
- "version": "5.1.0-next.98",
3
+ "version": "5.2.0-next.0",
4
4
  "description": "ESLint configuration for WebGIS SDK",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./dist/config/index.js",
8
- "./ts": "./src/config/index.ts",
9
8
  "./application": "./dist/config/applications.js",
10
9
  "./extra": "./dist/config/extra.js",
11
10
  "./lumina": "./dist/config/lumina.js",
12
- "./lumina/ts": "./src/config/lumina.ts",
13
11
  "./plugins/webgis": "./dist/plugins/webgis/index.js",
14
12
  "./plugins/lumina": "./dist/plugins/lumina/index.js",
15
13
  "./utils/disable-rules": "./dist/utils/disable-rules.js",
@@ -32,7 +30,7 @@
32
30
  "tslib": "^2.8.1",
33
31
  "typescript": "~6.0.2",
34
32
  "typescript-eslint": "^8.58.0",
35
- "@arcgis/toolkit": "5.1.0-next.98"
33
+ "@arcgis/toolkit": "5.2.0-next.0"
36
34
  },
37
35
  "peerDependencies": {
38
36
  "eslint": "^10.2.0"