@arcgis/eslint-config 5.1.0-next.87 → 5.1.0-next.89

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.
@@ -34,7 +34,11 @@ const storybookConfig = [
34
34
  // We never used storiesOf, and it's no longer included in Storybook
35
35
  "storybook/no-stories-of": "off",
36
36
  // Redundant with TypeScript
37
- "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"
38
42
  }
39
43
  }
40
44
  ];
@@ -1,5 +1,5 @@
1
1
  import { ESLintUtils, AST_NODE_TYPES } from "@typescript-eslint/utils";
2
- const version = "5.1.0-next.87";
2
+ const version = "5.1.0-next.89";
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-Blx7w727.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-Cg4iVsEi.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";
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin, e as extractDeclareElementsInterface, g as getComponentDeclaration } from "../../estree-Blx7w727.js";
1
+ import { m as makeEslintPlugin, e as extractDeclareElementsInterface, g as getComponentDeclaration } from "../../estree-Cg4iVsEi.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: []
@@ -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/webgis/core/core/documenting-api#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,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/eslint-config",
3
- "version": "5.1.0-next.87",
3
+ "version": "5.1.0-next.89",
4
4
  "description": "ESLint configuration for WebGIS SDK",
5
5
  "type": "module",
6
6
  "exports": {
@@ -32,7 +32,7 @@
32
32
  "tslib": "^2.8.1",
33
33
  "typescript": "~6.0.2",
34
34
  "typescript-eslint": "^8.58.0",
35
- "@arcgis/toolkit": "5.1.0-next.87"
35
+ "@arcgis/toolkit": "5.1.0-next.89"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "eslint": "^10.2.0"