@arcgis/eslint-config 5.1.0-next.12 → 5.1.0-next.121

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.
@@ -213,6 +213,18 @@ const defaultConfig = [
213
213
  "@typescript-eslint/restrict-plus-operands": ["warn", { allowNumberAndString: true }],
214
214
  // We often actually have control characters in our regexes
215
215
  "no-control-regex": "off",
216
+ "@typescript-eslint/no-restricted-imports": [
217
+ "error",
218
+ {
219
+ paths: [
220
+ {
221
+ name: "commander",
222
+ importNames: ["Command"],
223
+ message: "Import from @commander-js/extra-typings instead."
224
+ }
225
+ ]
226
+ }
227
+ ],
216
228
  // Functions that deal with JSON.stringify/localStorage may have a type
217
229
  // parameter as a more readable alternative to a type assertion.
218
230
  // Also, this rule is quite complicated/expensive.
@@ -446,7 +458,13 @@ const defaultConfig = [
446
458
  "@typescript-eslint/no-duplicate-type-constituents": ["warn"],
447
459
  "@typescript-eslint/no-unnecessary-boolean-literal-compare": ["warn"],
448
460
  "@typescript-eslint/no-extra-non-null-assertion": ["warn"],
449
- "@typescript-eslint/no-unnecessary-type-arguments": ["warn"],
461
+ // False positive for the following:
462
+ // this.listen<CustomEvent>("arcgisChartsJSDataProcessComplete", this.handleDataProcessComplete);
463
+ "@typescript-eslint/no-unnecessary-type-arguments": "off",
464
+ // The autofix creates TS errors in makeT9nController(). This is a new
465
+ // rule - give it more time to catch the bug cases. Also, this rule
466
+ // changes runtime behavior, and may lead to breaking changes.
467
+ "@typescript-eslint/no-useless-default-assignment": "off",
450
468
  "@typescript-eslint/no-unnecessary-type-assertion": ["warn"],
451
469
  "@typescript-eslint/prefer-includes": ["warn"],
452
470
  "@typescript-eslint/prefer-reduce-type-parameter": ["warn"],
@@ -587,6 +605,18 @@ const defaultConfig = [
587
605
  // Allow empty "files" field to explicitly indicate that no files
588
606
  // should be included in the package
589
607
  "package-json/no-empty-fields": ["error", { ignoreProperties: ["files"] }],
608
+ // We use license instead
609
+ "package-json/require-attribution": "off",
610
+ // We are not open source
611
+ "package-json/require-repository": "off",
612
+ // This option is tricky to set right, especially for web component
613
+ // libraries that have many side effect entrypoints. It can also get out
614
+ // of date easily. If we don't explicitly indicate sideEffects, bundlers
615
+ // have good default AST-based heuristics.
616
+ "package-json/require-sideEffects": "off",
617
+ // Can't address these till 6.0 without breaking changes.
618
+ // Most errors are in react wrappers which will be dropped in 6.0.
619
+ "package-json/require-exports": "off",
590
620
  // Enforce a specific property order for better readability and consistency
591
621
  "package-json/order-properties": [
592
622
  "warn",
@@ -29,10 +29,16 @@ const storybookConfig = [
29
29
  "storybook/no-title-property-in-meta": "off",
30
30
  // Not applicable as we have a central Storybook config (@arcgis/storybook-utils)
31
31
  "storybook/no-uninstalled-addons": "off",
32
+ // Not that helpful as we have a central Storybook config (@arcgis/storybook-utils)
33
+ "storybook/no-renderer-packages": "off",
32
34
  // We never used storiesOf, and it's no longer included in Storybook
33
35
  "storybook/no-stories-of": "off",
34
36
  // Redundant with TypeScript
35
- "storybook/context-in-play-function": "off"
37
+ "storybook/context-in-play-function": "off",
38
+ // Enforces writing satisfies Meta after the meta object definition to ensure that stories use the correct properties in the metadata.
39
+ "storybook/meta-satisfies-type": "error",
40
+ // In our Lumina stories, render args should infer from Meta<T>/StoryObj<T>.
41
+ "webgis/no-story-render-args-type-annotation": "error"
36
42
  }
37
43
  }
38
44
  ];
@@ -1,5 +1,5 @@
1
1
  import { ESLintUtils, AST_NODE_TYPES } from "@typescript-eslint/utils";
2
- const version = "5.1.0-next.12";
2
+ const version = "5.1.0-next.121";
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-ClxbjPiK.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-PlJ5xFdO.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: []
@@ -1354,25 +1354,75 @@ plugin.createRule({
1354
1354
  return {
1355
1355
  "Program:exit"() {
1356
1356
  const source = context.sourceCode.text;
1357
- for (const match of source.matchAll(/@(?:internal|private)\b/gu)) {
1358
- const idx = match.index;
1359
- const lineStart = source.lastIndexOf("\n", idx - 1) + 1;
1360
- const before = source.slice(lineStart, idx).trim();
1361
- if (before === "*" || before === "/**") {
1357
+ for (const comment of context.sourceCode.getAllComments()) {
1358
+ const commentText = source.slice(comment.range[0], comment.range[1]);
1359
+ if (!commentText.startsWith("/**")) {
1362
1360
  continue;
1363
1361
  }
1364
- context.report({
1365
- messageId: "inlineExposure",
1366
- loc: {
1367
- start: context.sourceCode.getLocFromIndex(idx - 1),
1368
- end: context.sourceCode.getLocFromIndex(idx + match[0].length)
1362
+ for (const match of comment.value.matchAll(/@(?:internal|private)\b/gu)) {
1363
+ const idx = comment.range[0] + 2 + match.index;
1364
+ const lineStart = source.lastIndexOf("\n", idx - 1) + 1;
1365
+ const before = source.slice(lineStart, idx).trim();
1366
+ if (before === "*" || before === "/**") {
1367
+ continue;
1369
1368
  }
1370
- });
1369
+ context.report({
1370
+ messageId: "inlineExposure",
1371
+ loc: {
1372
+ start: context.sourceCode.getLocFromIndex(idx - 1),
1373
+ end: context.sourceCode.getLocFromIndex(idx + match[0].length)
1374
+ }
1375
+ });
1376
+ }
1377
+ }
1378
+ }
1379
+ };
1380
+ }
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
+ }
1371
1420
  }
1372
1421
  }
1373
1422
  };
1374
1423
  }
1375
1424
  });
1425
+ const reXrefUrl = /xref:\/\/[\w./#-]+/gu;
1376
1426
  const description$a = `directives={} prop value must be an array literal. Documentation: https://webgis.esri.com/references/lumina/jsx#lit-directives`;
1377
1427
  plugin.createRule({
1378
1428
  name: "no-invalid-directives-prop",
@@ -1734,7 +1784,7 @@ plugin.createRule({
1734
1784
  return;
1735
1785
  }
1736
1786
  const argument = functionParent.params.at(0);
1737
- if (argument === void 0 || argument.type !== AST_NODE_TYPES.Identifier || argument.name !== eventVariableName) {
1787
+ if (argument?.type !== AST_NODE_TYPES.Identifier || argument.name !== eventVariableName) {
1738
1788
  return;
1739
1789
  }
1740
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-ClxbjPiK.js";
1
+ import { m as makeEslintPlugin, e as extractDeclareElementsInterface, g as getComponentDeclaration } from "../../estree-PlJ5xFdO.js";
2
2
  import { resolve } from "path/posix";
3
3
  import { AST_NODE_TYPES } from "@typescript-eslint/utils";
4
4
  const plugin = makeEslintPlugin(
@@ -7,16 +7,16 @@ const plugin = makeEslintPlugin(
7
7
  );
8
8
  const isTestFile = (filePath) => filePath.includes("/test") || filePath.includes(".test") || filePath.includes(".spec") || filePath.includes("e2e") || filePath.includes("__") || filePath.includes("/.");
9
9
  const isStorybookFile = (filePath) => filePath.includes(".stories");
10
- const description$5 = `Imports of files outside the src/ folder are not-portable and likely to break for consumers of this package.`;
10
+ const description$6 = `Imports of files outside the src/ folder are not-portable and likely to break for consumers of this package.`;
11
11
  plugin.createRule({
12
12
  name: "no-import-outside-src",
13
13
  meta: {
14
14
  docs: {
15
- description: description$5,
15
+ description: description$6,
16
16
  defaultLevel: "error"
17
17
  },
18
18
  messages: {
19
- noImportOutsideSrc: description$5
19
+ noImportOutsideSrc: description$6
20
20
  },
21
21
  type: "problem",
22
22
  schema: []
@@ -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 {
@@ -50,16 +50,16 @@ plugin.createRule({
50
50
  };
51
51
  }
52
52
  });
53
- const description$4 = `Having two JSDoc comments next to each other is most likely a mistake - consider combining them into one, or separating them for clarity.`;
53
+ const description$5 = `Having two JSDoc comments next to each other is most likely a mistake - consider combining them into one, or separating them for clarity.`;
54
54
  plugin.createRule({
55
55
  name: "no-touching-jsdoc",
56
56
  meta: {
57
57
  docs: {
58
- description: description$4,
58
+ description: description$5,
59
59
  defaultLevel: "warn"
60
60
  },
61
61
  messages: {
62
- noTouchingJsDoc: description$4
62
+ noTouchingJsDoc: description$5
63
63
  },
64
64
  type: "problem",
65
65
  schema: []
@@ -95,17 +95,17 @@ plugin.createRule({
95
95
  }
96
96
  });
97
97
  const reTouchingJsDoc = /\*\/\s+\/\*\*/gu;
98
- const description$3 = `@arcgis/core imports need to end with .js for better compatibility with ESM CDN builds for @arcgis/core and other packages.`;
98
+ const description$4 = `@arcgis/core imports need to end with .js for better compatibility with ESM CDN builds for @arcgis/core and other packages.`;
99
99
  const packagesToEnforce = ["@arcgis/core/", "@amcharts/amcharts4/", "@amcharts/amcharts5/"];
100
100
  plugin.createRule({
101
101
  name: "require-js-in-imports",
102
102
  meta: {
103
103
  docs: {
104
- description: description$3,
104
+ description: description$4,
105
105
  defaultLevel: "warn"
106
106
  },
107
107
  messages: {
108
- requireJsInCoreImport: description$3
108
+ requireJsInCoreImport: description$4
109
109
  },
110
110
  type: "problem",
111
111
  fixable: "code",
@@ -139,17 +139,17 @@ plugin.createRule({
139
139
  };
140
140
  }
141
141
  });
142
- const description$2 = "Using .d.ts files is discouraged. Prefer .ts files instead, as they are type-checked and not in global scope.";
142
+ const description$3 = "Using .d.ts files is discouraged. Prefer .ts files instead, as they are type-checked and not in global scope.";
143
143
  const allowedNames = /* @__PURE__ */ new Set(["vite-env.d.ts", "components.d.ts"]);
144
144
  plugin.createRule({
145
145
  name: "no-dts-files",
146
146
  meta: {
147
147
  docs: {
148
- description: description$2,
148
+ description: description$3,
149
149
  defaultLevel: "warn"
150
150
  },
151
151
  messages: {
152
- avoidDtsFiles: description$2
152
+ avoidDtsFiles: description$3
153
153
  },
154
154
  type: "suggestion",
155
155
  schema: []
@@ -179,12 +179,12 @@ plugin.createRule({
179
179
  };
180
180
  }
181
181
  });
182
- const description$1 = `Enforce consistent logging so that ArcGIS developers can easily debug errors or warnings logged by our web components, which may lack a meaningful context in compiled code. See [our documentation on @arcgis/toolkit/log](https://webgis.esri.com/references/toolkit/log).`;
182
+ const description$2 = `Enforce consistent logging so that ArcGIS developers can easily debug errors or warnings logged by our web components, which may lack a meaningful context in compiled code. See [our documentation on @arcgis/toolkit/log](https://webgis.esri.com/references/toolkit/log).`;
183
183
  plugin.createRule({
184
184
  name: "consistent-logging",
185
185
  meta: {
186
186
  docs: {
187
- description: description$1,
187
+ description: description$2,
188
188
  defaultLevel: "off"
189
189
  // NOTE: this is turned on conditionally in root eslint config
190
190
  },
@@ -217,16 +217,16 @@ plugin.createRule({
217
217
  };
218
218
  }
219
219
  });
220
- const description = `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/webgis/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: {
224
224
  docs: {
225
- description,
225
+ description: description$1,
226
226
  defaultLevel: "warn"
227
227
  },
228
228
  messages: {
229
- error: description
229
+ error: description$1
230
230
  },
231
231
  type: "problem",
232
232
  schema: [],
@@ -272,6 +272,47 @@ function computeReplacement(declareElementsInterface, anchor) {
272
272
  const tagName = declaration.key.value;
273
273
  return `components/${tagName}#${anchor}`;
274
274
  }
275
+ const description = "In Storybook render functions, let `args` infer from `Meta<T>` or `StoryObj<T>` instead of annotating the render parameter.";
276
+ plugin.createRule({
277
+ name: "no-story-render-args-type-annotation",
278
+ meta: {
279
+ docs: {
280
+ description,
281
+ defaultLevel: "off"
282
+ },
283
+ messages: {
284
+ noStoryRenderArgsTypeAnnotation: "Do not annotate `render(args)` in stories. Type the story with `Meta<T>` or `StoryObj<T>` and let `args` infer from that."
285
+ },
286
+ schema: [],
287
+ type: "suggestion",
288
+ fixable: "code"
289
+ },
290
+ defaultOptions: [],
291
+ create(context) {
292
+ if (!isStorybookFile(context.filename)) {
293
+ return {};
294
+ }
295
+ return {
296
+ Property(node) {
297
+ if (!isRenderProperty(node)) {
298
+ return;
299
+ }
300
+ const [firstParameter] = node.value.params;
301
+ if (firstParameter?.type !== AST_NODE_TYPES.Identifier || firstParameter.typeAnnotation === void 0) {
302
+ return;
303
+ }
304
+ context.report({
305
+ node: firstParameter.typeAnnotation,
306
+ messageId: "noStoryRenderArgsTypeAnnotation",
307
+ fix: (fixer) => fixer.remove(firstParameter.typeAnnotation)
308
+ });
309
+ }
310
+ };
311
+ }
312
+ });
313
+ function isRenderProperty(node) {
314
+ return node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "render" && (node.value.type === AST_NODE_TYPES.ArrowFunctionExpression || node.value.type === AST_NODE_TYPES.FunctionExpression);
315
+ }
275
316
  const webgisPlugin = plugin.finalize();
276
317
  export {
277
318
  webgisPlugin
@@ -0,0 +1,2 @@
1
+ declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noStoryRenderArgsTypeAnnotation", [], import('../../utils/makePlugin.ts').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
2
+ export default _default;
package/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "@arcgis/eslint-config",
3
- "version": "5.1.0-next.12",
4
- "description": "ESLint configuration for arcgis-web-components",
3
+ "version": "5.1.0-next.121",
4
+ "description": "ESLint configuration for WebGIS SDK",
5
5
  "type": "module",
6
- "main": "index.js",
7
- "module": "dist/index.js",
8
- "types": "dist/index.d.ts",
9
6
  "exports": {
10
7
  ".": "./dist/config/index.js",
11
8
  "./application": "./dist/config/applications.js",
@@ -21,21 +18,21 @@
21
18
  ],
22
19
  "license": "SEE LICENSE IN LICENSE.md",
23
20
  "dependencies": {
24
- "@eslint/js": "^9.39.1",
25
- "@eslint/markdown": "^7.5.1",
21
+ "@eslint/js": "^10.0.1",
22
+ "@eslint/markdown": "^8.0.1",
26
23
  "@types/confusing-browser-globals": "^1.0.3",
27
- "@typescript-eslint/utils": "^8.46.4",
24
+ "@typescript-eslint/utils": "^8.58.0",
28
25
  "confusing-browser-globals": "^1.0.11",
29
- "eslint-plugin-package-json": "^0.88.1",
30
- "eslint-plugin-storybook": "^0.12.0",
26
+ "eslint-plugin-package-json": "~0.91.1",
27
+ "eslint-plugin-storybook": "^10.3.4",
31
28
  "globals": "^16.5.0",
32
- "jsonc-eslint-parser": "^2.0.0",
29
+ "jsonc-eslint-parser": "^3.1.0",
33
30
  "tslib": "^2.8.1",
34
- "typescript": "~5.9.3",
35
- "typescript-eslint": "^8.46.3",
36
- "@arcgis/toolkit": "5.1.0-next.12"
31
+ "typescript": "~6.0.2",
32
+ "typescript-eslint": "^8.58.0",
33
+ "@arcgis/toolkit": "5.1.0-next.121"
37
34
  },
38
35
  "peerDependencies": {
39
- "eslint": "^9.39.1"
36
+ "eslint": "^10.2.0"
40
37
  }
41
38
  }