@arcgis/eslint-config 5.2.0-next.15 → 5.2.0-next.151

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.
@@ -1,42 +1,27 @@
1
+ import { d as disabledRules } from "../chunks/disabledRules.js";
1
2
  import eslintPluginStorybook from "eslint-plugin-storybook";
2
3
  import { luminaPlugin } from "../plugins/lumina/index.js";
4
+ const disabledLuminaRules = [
5
+ // It's a good practice for @method() in components to be async even if
6
+ // they don't have await
7
+ "@typescript-eslint/require-await"
8
+ ];
3
9
  const storybookConfig = [
4
10
  {
5
11
  ignores: ["**/storybook-static*"]
6
12
  },
7
- ...eslintPluginStorybook.configs["flat/recommended"].map((config2) => ({
8
- ...config2,
9
- files: ["**/*.stories.@(ts|tsx)"]
10
- })),
11
- ...eslintPluginStorybook.configs["flat/addon-interactions"].map((config2) => ({
12
- ...config2,
13
- files: ["**/*.stories.@(ts|tsx)"]
14
- })),
15
- ...eslintPluginStorybook.configs["flat/csf-strict"].map((config2) => ({
16
- ...config2,
17
- files: ["**/*.stories.@(ts|tsx)"]
18
- })),
19
13
  {
20
14
  files: ["**/*.stories.@(ts|tsx)"],
15
+ plugins: { storybook: eslintPluginStorybook },
21
16
  rules: {
22
- // Redundant with https://typescript-eslint.io/rules/no-floating-promises/
23
- "storybook/await-interactions": "off",
24
- // Not applicable in our web-component setup
25
- "storybook/csf-component": "off",
26
- // This rule is for detecting usages of deprecated feature that we don't use
27
- "storybook/hierarchy-separator": "off",
28
- // Not applicable in our web-component setup
29
- "storybook/no-title-property-in-meta": "off",
30
- // Not applicable as we have a central Storybook config (@arcgis/storybook-utils)
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",
34
- // We never used storiesOf, and it's no longer included in Storybook
35
- "storybook/no-stories-of": "off",
36
- // Redundant with TypeScript
37
- "storybook/context-in-play-function": "off",
17
+ "storybook/default-exports": "error",
38
18
  // Enforces writing satisfies Meta after the meta object definition to ensure that stories use the correct properties in the metadata.
39
19
  "storybook/meta-satisfies-type": "error",
20
+ "storybook/no-redundant-story-name": "warn",
21
+ "storybook/prefer-pascal-case": "warn",
22
+ "storybook/story-exports": "error",
23
+ "storybook/use-storybook-expect": "error",
24
+ "storybook/use-storybook-testing-library": "error",
40
25
  // In our Lumina stories, render args should infer from Meta<T>/StoryObj<T>.
41
26
  "webgis/no-story-render-args-type-annotation": "error"
42
27
  }
@@ -59,11 +44,7 @@ const config = [
59
44
  {
60
45
  files: ["**/*.tsx"],
61
46
  rules: {
62
- // It's a good practice for @method() in components to be async even if
63
- // they don't have await
64
- "@typescript-eslint/require-await": "off",
65
- // Too many offenders for now to report this as an error. Assigned issues to tackle this.
66
- "lumina/no-create-element-component": "warn",
47
+ ...disabledRules(disabledLuminaRules),
67
48
  "@typescript-eslint/no-restricted-imports": [
68
49
  "error",
69
50
  {
@@ -137,7 +118,9 @@ declare global {
137
118
  }
138
119
  ]
139
120
  }
140
- ]
121
+ ],
122
+ // Too many offenders for now to report this as an error. Assigned issues to tackle this.
123
+ "lumina/no-create-element-component": "warn"
141
124
  }
142
125
  }
143
126
  /*{
@@ -1,18 +1,21 @@
1
- import { m as makeEslintPlugin } from "../../makePlugin-C2bqt5zI.js";
2
- import { AST_NODE_TYPES, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
1
+ import { m as makeEslintPlugin } from "../../chunks/makePlugin.js";
3
2
  import { generateDifferences, showInvisibles } from "prettier-linter-helpers";
3
+ import { AST_NODE_TYPES, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
4
4
  import path, { relative, win32, posix, normalize } from "path";
5
+ import { dirname, join } from "node:path";
6
+ import { existsSync } from "node:fs";
5
7
  import { execSync } from "child_process";
6
8
  const plugin = makeEslintPlugin(
7
9
  "core",
8
- (rule) => `https://devtopia.esri.com/WebGIS/arcgis-web-components/tree/main/packages/support-packages/eslint-config/src/plugins/core/rules/${rule}.ts`
10
+ (rule) => `https://devtopia.esri.com/WebGIS/webgis-sdk/tree/main/packages/support-packages/eslint-config/src/plugins/core/rules/${rule}.ts`
9
11
  );
10
12
  plugin.createRule({
11
13
  name: "glsl-whitespace",
12
14
  meta: {
13
15
  docs: {
14
16
  description: "Checks that glsl tagged template strings don't have extra whitespace.",
15
- defaultLevel: "error"
17
+ defaultLevel: "error",
18
+ isTypeChecked: false
16
19
  },
17
20
  messages: {
18
21
  delete: "Delete `{{ deleteText }}`",
@@ -93,20 +96,26 @@ function removeLeadingBlankLines(text) {
93
96
  function removeTrailingBlankLines(text) {
94
97
  return text.replace(/(\r?\n)(\r?\n)*([ \t]*)`$/gu, "$1$3`");
95
98
  }
99
+ const projectMarker = "/src/";
100
+ let projectRoot = void 0;
96
101
  function findProjectRoot(filename) {
97
102
  const normalized = filename.replaceAll("\\", "/");
98
- let minimumIndex = Number.POSITIVE_INFINITY;
99
- for (const marker of ["src/", "tests/", "test-apps/", "esri/"]) {
100
- const index = normalized.indexOf(marker);
101
- if (index === 0) {
102
- return ".";
103
- } else if (index > 0 && normalized.charCodeAt(index - 1) === slashCharCode) {
104
- minimumIndex = Math.min(minimumIndex, index);
103
+ const isProjectFile = normalized.includes(projectMarker);
104
+ if (isProjectFile && projectRoot) {
105
+ return projectRoot;
106
+ }
107
+ const fileToFind = "package.json";
108
+ for (let root = dirname(filename), previousRoot = filename; root !== previousRoot; previousRoot = root, root = dirname(root)) {
109
+ const filepath = join(root, fileToFind);
110
+ if (existsSync(filepath)) {
111
+ if (isProjectFile) {
112
+ projectRoot = root;
113
+ }
114
+ return root;
105
115
  }
106
116
  }
107
- return minimumIndex === Number.POSITIVE_INFINITY ? void 0 : normalized.slice(0, minimumIndex);
117
+ return;
108
118
  }
109
- const slashCharCode = 47;
110
119
  const isWindows = process.platform === "win32";
111
120
  const collator = new Intl.Collator("en-US");
112
121
  plugin.createRule({
@@ -114,7 +123,8 @@ plugin.createRule({
114
123
  meta: {
115
124
  docs: {
116
125
  description: "Checks that imports are sorted and grouped",
117
- defaultLevel: "error"
126
+ defaultLevel: "error",
127
+ isTypeChecked: false
118
128
  },
119
129
  messages: {
120
130
  importFormat: "Imports are incorrectly sorted and/or grouped",
@@ -226,7 +236,7 @@ function groupImportsByPath(imports, absImportPath, basePath) {
226
236
  });
227
237
  }
228
238
  function importStatementPathName(importStatement, absImportPath, basePath) {
229
- return importPathName(importStatementPathString(importStatement), absImportPath, basePath);
239
+ return normalizeImportPath(importPathName(importStatementPathString(importStatement), absImportPath, basePath));
230
240
  }
231
241
  function importStatementPathString(importStatement) {
232
242
  return importStatement.source.value;
@@ -248,10 +258,25 @@ function importPathName(importPath, absImportPath, basePath) {
248
258
  return path.dirname(relative(basePath, importPath));
249
259
  }
250
260
  function formatGroupedImports(sourceCode, groupedImports, newLine) {
251
- const importHeader = `// ${groupedImports.path.replace(/[\\/]/gu, ".")}`;
261
+ const importHeader = `// ${formatImportHeaderPath(groupedImports.path)}`;
252
262
  const imports = groupedImports.imports.map((importDeclaration) => sourceCode.getText(importDeclaration).trim()).join(newLine).trim();
253
263
  return `${importHeader}${newLine}${imports}`;
254
264
  }
265
+ function formatImportHeaderPath(importPath) {
266
+ return normalizeImportPath(importPath).replace(/[\\/]/gu, ".");
267
+ }
268
+ function normalizeImportPath(importPath) {
269
+ const parts = importPath.split(/[\\/]/gu);
270
+ if (parts[0] === "src") {
271
+ parts[0] = "esri";
272
+ } else if (parts[0] === "tests") {
273
+ const srcPart = parts.indexOf("src");
274
+ if (srcPart !== -1) {
275
+ parts[srcPart] = "esri";
276
+ }
277
+ }
278
+ return parts.join(path.sep);
279
+ }
255
280
  function getAttachedCommentStart(sourceCode, statement) {
256
281
  const comments = sourceCode.getCommentsBefore(statement);
257
282
  let start = statement.range[0];
@@ -326,7 +351,8 @@ plugin.createRule({
326
351
  meta: {
327
352
  docs: {
328
353
  description: "Checks for duplicate comments before the first import declaration.",
329
- defaultLevel: "error"
354
+ defaultLevel: "error",
355
+ isTypeChecked: false
330
356
  },
331
357
  messages: { duplicate: "Delete duplicate comment" },
332
358
  schema: [],
@@ -368,7 +394,8 @@ plugin.createRule({
368
394
  meta: {
369
395
  docs: {
370
396
  description: "Checks for `todo` JSDoc tags with missing descriptions.",
371
- defaultLevel: "error"
397
+ defaultLevel: "error",
398
+ isTypeChecked: false
372
399
  },
373
400
  messages: { empty: "JSDoc `todo` tag description required" },
374
401
  schema: [],
@@ -393,7 +420,8 @@ plugin.createRule({
393
420
  meta: {
394
421
  docs: {
395
422
  description: "Enforces the declared class name passed to the @subclass() decorator",
396
- defaultLevel: "error"
423
+ defaultLevel: "error",
424
+ isTypeChecked: false
397
425
  },
398
426
  messages: {
399
427
  invalidPath: "Invalid path passed to @subclass(). It should be a string literal matching the file path, without the extension and with path separators replaced with `.`"
@@ -452,7 +480,7 @@ function getDeclaredClass(filename) {
452
480
  if (!root) {
453
481
  return;
454
482
  }
455
- const relativePath = relative(root, filename).replaceAll(win32.sep, ".").replaceAll(posix.sep, ".").replace(/\.[^/.]+$/u, "");
483
+ const relativePath = relative(root, filename).replaceAll(win32.sep, ".").replaceAll(posix.sep, ".").replace(/^src\./u, "esri.").replace(/\.[^/.]+$/u, "");
456
484
  return relativePath;
457
485
  }
458
486
  const tsRe = /\.tsx?$/u;
@@ -476,7 +504,8 @@ plugin.createRule({
476
504
  meta: {
477
505
  docs: {
478
506
  description: "Checks that files redundant to TypeScript implementation files are not checked in.",
479
- defaultLevel: "error"
507
+ defaultLevel: "error",
508
+ isTypeChecked: false
480
509
  },
481
510
  messages: {
482
511
  js: "Redundant JavaScript file detected. Please `git rm -f {{file}}`",
@@ -492,16 +521,16 @@ plugin.createRule({
492
521
  return {
493
522
  Program(node) {
494
523
  if (!filePath.endsWith(".d.ts") && tsRe.test(filePath)) {
495
- const projectRoot = findProjectRoot(filePath);
496
- if (!projectRoot) {
524
+ const projectRoot2 = findProjectRoot(filePath);
525
+ if (!projectRoot2) {
497
526
  context.report({ node, messageId: "missingProjectRoot" });
498
527
  return;
499
528
  }
500
- const gitIndexFiles2 = getGitIndexFiles(projectRoot);
529
+ const gitIndexFiles2 = getGitIndexFiles(projectRoot2);
501
530
  if (!gitIndexFiles2) {
502
531
  return;
503
532
  }
504
- filePath = relative(projectRoot, filePath);
533
+ filePath = relative(projectRoot2, filePath);
505
534
  const jsFilename = filePath.replace(tsRe, ".js");
506
535
  if (gitIndexFiles2.has(jsFilename)) {
507
536
  context.report({ node, messageId: "js", data: { file: jsFilename } });
@@ -519,8 +548,9 @@ plugin.createRule({
519
548
  name: "prefer-relative-imports",
520
549
  meta: {
521
550
  docs: {
522
- description: "Checks that whenever possible import and export paths are relative instead of absolute.",
523
- defaultLevel: "error"
551
+ description: "Checks that whenever possible, import and export paths are relative instead of absolute.",
552
+ defaultLevel: "error",
553
+ isTypeChecked: false
524
554
  },
525
555
  messages: {
526
556
  importFormat: 'Prefer relative ("{{relPath}}") over absolute path',
@@ -562,14 +592,24 @@ plugin.createRule({
562
592
  }
563
593
  });
564
594
  function pathRoot(p) {
565
- const dirName = path.dirname(p);
566
- return dirName === "." ? p : pathRoot(dirName);
595
+ const pathImplementation = win32.isAbsolute(p) && !posix.isAbsolute(p) ? win32 : path;
596
+ let root = p;
597
+ while (true) {
598
+ const parent = pathImplementation.dirname(root);
599
+ if (parent === "." || parent === root) {
600
+ return root;
601
+ }
602
+ root = parent;
603
+ }
567
604
  }
568
605
  function verifyRelativeImport(context, node, absImportPath, basePath, importRoot) {
569
- const modulePath = node.value;
606
+ let modulePath = node.value;
570
607
  if (modulePath.startsWith(".")) {
571
608
  return;
572
609
  }
610
+ if (modulePath.startsWith("esri/")) {
611
+ modulePath = modulePath.replace("esri/", "src/");
612
+ }
573
613
  if (pathRoot(modulePath) === importRoot) {
574
614
  let relPath = path.relative(path.join(basePath, absImportPath), path.join(basePath, modulePath));
575
615
  if (!relPath.startsWith(".")) {
@@ -591,7 +631,8 @@ plugin.createRule({
591
631
  meta: {
592
632
  docs: {
593
633
  description: "Checks that the corresponding calcite component import exists for each calcite component tag used. It also checks that there are no extra unnecessary imports.",
594
- defaultLevel: "error"
634
+ defaultLevel: "error",
635
+ isTypeChecked: false
595
636
  },
596
637
  messages: {
597
638
  missingImport: 'Import missing: import("@esri/calcite-components/dist/components/{{tag}}")',
@@ -640,7 +681,8 @@ plugin.createRule({
640
681
  meta: {
641
682
  docs: {
642
683
  description: "Enforce filenames to be part of spec (test) top-level suites.",
643
- defaultLevel: "error"
684
+ defaultLevel: "error",
685
+ isTypeChecked: false
644
686
  },
645
687
  messages: {
646
688
  name: "Suite name must be the name of the spec file",
@@ -694,7 +736,7 @@ function getToplevelSuiteName(filename) {
694
736
  return;
695
737
  }
696
738
  const relativePath = relative(root, filename).replaceAll(win32.sep, posix.sep);
697
- return relativePath.replace(/^tests\/(.*)\.spec\.ts/u, "$1");
739
+ return relativePath.replace(/^tests\/(.*)\.spec\.ts/u, "$1").replace("src/", "esri/");
698
740
  }
699
741
  const corePlugin = plugin.finalize();
700
742
  export {
@@ -1,11 +1,11 @@
1
- import { m as makeEslintPlugin } from "../../makePlugin-C2bqt5zI.js";
1
+ import { m as makeEslintPlugin } from "../../chunks/makePlugin.js";
2
2
  import { AST_NODE_TYPES, ESLintUtils, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
3
- import { 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-CDc-die8.js";
3
+ import { l as luminaJsxExportName, a as luminaEntrypointName, b as luminaTestEntrypointName, s as sourceCodeDeclaresComponent, p as parsePropertyDecorator, g as getProperty, i as isGetterWithoutSetter, e as extractDeclareElementsInterface, c as isCreateEvent, h as hasDecorator, d as getName, f as checkForLuminaJsx, j as isBindThisCallee, k as getComponentDeclaration, u as unwrapExpression } from "../../chunks/estree.js";
4
4
  import ts from "typescript";
5
5
  import { camelToKebab } from "@arcgis/toolkit/string";
6
6
  const plugin = makeEslintPlugin(
7
7
  "lumina",
8
- (rule) => `https://devtopia.esri.com/WebGIS/arcgis-web-components/tree/main/packages/support-packages/eslint-config/src/plugins/lumina/rules/${rule}.ts`
8
+ (rule) => `https://devtopia.esri.com/WebGIS/webgis-sdk/tree/main/packages/support-packages/eslint-config/src/plugins/lumina/rules/${rule}.ts`
9
9
  );
10
10
  const importDeclaration = `import { ${luminaJsxExportName} } from "${luminaEntrypointName}";`;
11
11
  const description$m = `To use Lumina's JSX, you need to ${importDeclaration}`;
@@ -14,7 +14,8 @@ plugin.createRule({
14
14
  meta: {
15
15
  docs: {
16
16
  description: description$m,
17
- defaultLevel: "error"
17
+ defaultLevel: "error",
18
+ isTypeChecked: false
18
19
  },
19
20
  messages: {
20
21
  addMissingJsxImport: description$m
@@ -80,12 +81,13 @@ plugin.createRule({
80
81
  meta: {
81
82
  docs: {
82
83
  description: description$l,
83
- defaultLevel: "warn"
84
+ defaultLevel: "warn",
85
+ isTypeChecked: true
84
86
  },
85
87
  messages: {
86
88
  addType: `This property is of {{ type }} type, yet the type is not trivially inferrable from the AST without type-checking. Such properties require a { type: {{ type }} } annotation.
87
89
 
88
- More information: https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/1991`,
90
+ More information: https://devtopia.esri.com/WebGIS/webgis-sdk/issues/1991`,
89
91
  typeAnnotationMismatchesActualType: "The @property({type: {{type}} }) doesn't match the actual property type ({{actualType}}).",
90
92
  noEmptyPropertyObject: "Replace @property({}) with @property()",
91
93
  noUnnecessaryType: "Property type is trivially inferrable without type-checking - remove needless { type: {{ type }} } annotation.",
@@ -249,7 +251,8 @@ plugin.createRule({
249
251
  meta: {
250
252
  docs: {
251
253
  description: "This rule helps ban or warn against listened event types",
252
- defaultLevel: "off"
254
+ defaultLevel: "off",
255
+ isTypeChecked: false
253
256
  },
254
257
  messages: {
255
258
  default: "{{message}}"
@@ -319,7 +322,8 @@ plugin.createRule({
319
322
  meta: {
320
323
  docs: {
321
324
  description: description$k,
322
- defaultLevel: "error"
325
+ defaultLevel: "error",
326
+ isTypeChecked: false
323
327
  },
324
328
  messages: {
325
329
  fileFolderNameMismatch: "Lumina component must be declared in a file whose name (without extension) matches the parent folder name.\n\nCreating components in nested folders is supported as long as the file name matches the immediate parent folder name.",
@@ -369,7 +373,8 @@ plugin.createRule({
369
373
  meta: {
370
374
  docs: {
371
375
  description: description$j,
372
- defaultLevel: "warn"
376
+ defaultLevel: "warn",
377
+ isTypeChecked: false
373
378
  },
374
379
  messages: {
375
380
  eventNamespaceError: `Custom event name must start with one of the following prefixes: {{ prefixes }}.
@@ -377,7 +382,7 @@ plugin.createRule({
377
382
  Details: https://webgis.esri.com/references/lumina/events#best-practices-around-emitting-events`,
378
383
  componentNameInEventError: `For consistency, event name should not start with component name.
379
384
 
380
- Discussion: https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/307`,
385
+ Discussion: https://devtopia.esri.com/WebGIS/webgis-sdk/discussions/307`,
381
386
  noComponentNameInEventError: `For consistency, event name should include component name.`,
382
387
  missingPrivateJsDocTag: `Internal and private events must be marked with @internal or @private JSDoc tag.`
383
388
  },
@@ -476,7 +481,8 @@ plugin.createRule({
476
481
  docs: {
477
482
  description: description$i,
478
483
  // TODO: enable this by default
479
- defaultLevel: "off"
484
+ defaultLevel: "off",
485
+ isTypeChecked: false
480
486
  },
481
487
  messages: {
482
488
  consistentNullabilityError: `For consistency, use {{propertyName}}?:{{newType}} to denote property as optional, rather than {{propertyName}}:{{oldType}}.`,
@@ -556,7 +562,8 @@ plugin.createRule({
556
562
  meta: {
557
563
  docs: {
558
564
  description: description$h,
559
- defaultLevel: "error"
565
+ defaultLevel: "error",
566
+ isTypeChecked: false
560
567
  },
561
568
  messages: {
562
569
  publicApiMustBePublic: `@property(), @method() and createEvent() members must not have private or protected modifier.
@@ -664,7 +671,8 @@ plugin.createRule({
664
671
  meta: {
665
672
  docs: {
666
673
  description: description$g,
667
- defaultLevel: "error"
674
+ defaultLevel: "error",
675
+ isTypeChecked: true
668
676
  },
669
677
  messages: {
670
678
  explicitSetterType: description$g,
@@ -762,6 +770,10 @@ plugin.createRule({
762
770
  }
763
771
  });
764
772
  const ordering = [
773
+ /**
774
+ * Special well-known members that do not exist at runtime.
775
+ */
776
+ "Type-only metadata members",
765
777
  /*
766
778
  * Putting static before instance members is a common OOP convention.
767
779
  * Static members are always evaluated before instance members.
@@ -818,12 +830,13 @@ const getWireframe = () => new Map(ordering.map((region) => [region, []]));
818
830
  const entries = Object.entries;
819
831
  const regionMatchers = entries({
820
832
  "Static Members": (node) => node.type === AST_NODE_TYPES.StaticBlock || "static" in node && node.static,
833
+ "Type-only metadata members": (node) => node.type === AST_NODE_TYPES.PropertyDefinition && node.definite && node.override && node.key.type === AST_NODE_TYPES.Literal && node.key.value?.startsWith?.("@") === true,
821
834
  "Lifecycle": (_node, name) => lifecyclesSet.has(name),
822
835
  "Public Methods": (node) => "decorators" in node && hasDecorator(node, "method"),
823
836
  "Public Properties": (node) => "decorators" in node && hasDecorator(node, "property"),
824
837
  "State Properties": (node) => "decorators" in node && hasDecorator(node, "state"),
825
838
  "Events": isEvent,
826
- "Rendering": (_node, name) => name.startsWith("render") || name.startsWith("_render"),
839
+ "Rendering": (_node, name) => name.startsWith("render") || name.startsWith("_render") || name.startsWith("#render"),
827
840
  "Private Properties": (node) => node.type === AST_NODE_TYPES.PropertyDefinition || // We don't yet support public accessor properties
828
841
  node.type === AST_NODE_TYPES.AccessorProperty || node.type === AST_NODE_TYPES.MethodDefinition && (node.kind === "get" || node.kind === "set"),
829
842
  "Private Methods": () => true
@@ -1051,7 +1064,8 @@ plugin.createRule({
1051
1064
  meta: {
1052
1065
  docs: {
1053
1066
  description: baseDescription$2,
1054
- defaultLevel: "warn"
1067
+ defaultLevel: "warn",
1068
+ isTypeChecked: false
1055
1069
  },
1056
1070
  messages: {
1057
1071
  memberOrdering: "Component member ordering is not consistent. Run ESLint autofix to sort members.",
@@ -1173,7 +1187,8 @@ plugin.createRule({
1173
1187
  meta: {
1174
1188
  docs: {
1175
1189
  description: "This rule ensures that components are not created with `document.createElement()` to ensure imports are tracked by the compiler.",
1176
- defaultLevel: "error"
1190
+ defaultLevel: "error",
1191
+ isTypeChecked: false
1177
1192
  },
1178
1193
  fixable: "code",
1179
1194
  messages: {
@@ -1219,7 +1234,8 @@ plugin.createRule({
1219
1234
  meta: {
1220
1235
  docs: {
1221
1236
  description: description$f,
1222
- defaultLevel: "error"
1237
+ defaultLevel: "error",
1238
+ isTypeChecked: false
1223
1239
  },
1224
1240
  messages: {
1225
1241
  noIgnoreJsDocTag: description$f
@@ -1257,7 +1273,8 @@ plugin.createRule({
1257
1273
  meta: {
1258
1274
  docs: {
1259
1275
  description: description$e,
1260
- defaultLevel: "error"
1276
+ defaultLevel: "error",
1277
+ isTypeChecked: true
1261
1278
  },
1262
1279
  messages: {
1263
1280
  incorrectDynamicTagName: `This is using incorrect dynamic tag name syntax. See documentation on how to use dynamic tag in Lumina's JSX: https://webgis.esri.com/references/lumina/jsx#dynamic-tag-name`
@@ -1307,7 +1324,8 @@ plugin.createRule({
1307
1324
  meta: {
1308
1325
  docs: {
1309
1326
  description: description$d,
1310
- defaultLevel: "warn"
1327
+ defaultLevel: "warn",
1328
+ isTypeChecked: false
1311
1329
  },
1312
1330
  messages: {
1313
1331
  errorInlineArrow: description$d
@@ -1342,7 +1360,8 @@ plugin.createRule({
1342
1360
  meta: {
1343
1361
  docs: {
1344
1362
  description: description$c,
1345
- defaultLevel: "error"
1363
+ defaultLevel: "error",
1364
+ isTypeChecked: false
1346
1365
  },
1347
1366
  messages: {
1348
1367
  inlineExposure: description$c
@@ -1387,7 +1406,8 @@ plugin.createRule({
1387
1406
  meta: {
1388
1407
  docs: {
1389
1408
  description: description$b,
1390
- defaultLevel: "error"
1409
+ defaultLevel: "error",
1410
+ isTypeChecked: false
1391
1411
  },
1392
1412
  messages: {
1393
1413
  noJsDocXrefLinks: description$b
@@ -1430,7 +1450,8 @@ plugin.createRule({
1430
1450
  meta: {
1431
1451
  docs: {
1432
1452
  description: description$a,
1433
- defaultLevel: "error"
1453
+ defaultLevel: "error",
1454
+ isTypeChecked: false
1434
1455
  },
1435
1456
  messages: {
1436
1457
  noInvalidDirectivesProp: description$a
@@ -1476,7 +1497,8 @@ plugin.createRule({
1476
1497
  meta: {
1477
1498
  docs: {
1478
1499
  description: description$9,
1479
- defaultLevel: "error"
1500
+ defaultLevel: "error",
1501
+ isTypeChecked: false
1480
1502
  },
1481
1503
  messages: {
1482
1504
  noJsxSpread: description$9
@@ -1521,7 +1543,8 @@ plugin.createRule({
1521
1543
  meta: {
1522
1544
  docs: {
1523
1545
  description: baseDescription$1,
1524
- defaultLevel: "error"
1546
+ defaultLevel: "error",
1547
+ isTypeChecked: false
1525
1548
  },
1526
1549
  messages: {
1527
1550
  errorListenInConnectedCallback: description$8
@@ -1565,7 +1588,8 @@ plugin.createRule({
1565
1588
  meta: {
1566
1589
  docs: {
1567
1590
  description: description$7,
1568
- defaultLevel: "warn"
1591
+ defaultLevel: "warn",
1592
+ isTypeChecked: false
1569
1593
  },
1570
1594
  messages: {
1571
1595
  noNonComponentExports: description$7,
@@ -1654,7 +1678,8 @@ plugin.createRule({
1654
1678
  meta: {
1655
1679
  docs: {
1656
1680
  description: description$6,
1657
- defaultLevel: "error"
1681
+ defaultLevel: "error",
1682
+ isTypeChecked: false
1658
1683
  },
1659
1684
  messages: {
1660
1685
  noPropertyNameStartWithOn: description$6
@@ -1699,7 +1724,8 @@ plugin.createRule({
1699
1724
  meta: {
1700
1725
  docs: {
1701
1726
  description: baseDescription,
1702
- defaultLevel: "warn"
1727
+ defaultLevel: "warn",
1728
+ isTypeChecked: true
1703
1729
  },
1704
1730
  messages: {
1705
1731
  errorFalseRendered: description$5
@@ -1750,7 +1776,8 @@ plugin.createRule({
1750
1776
  meta: {
1751
1777
  docs: {
1752
1778
  description: description$4,
1753
- defaultLevel: "warn"
1779
+ defaultLevel: "warn",
1780
+ isTypeChecked: false
1754
1781
  },
1755
1782
  messages: {
1756
1783
  needlessInlineJsxEventTypeAnnotation: "There is no need for this type annotation as JSX types already define event types.",
@@ -1840,7 +1867,8 @@ plugin.createRule({
1840
1867
  meta: {
1841
1868
  docs: {
1842
1869
  description: description$3,
1843
- defaultLevel: "warn"
1870
+ defaultLevel: "warn",
1871
+ isTypeChecked: false
1844
1872
  },
1845
1873
  messages: {
1846
1874
  noUnnecessaryAttributeName: description$3
@@ -1893,7 +1921,8 @@ plugin.createRule({
1893
1921
  meta: {
1894
1922
  docs: {
1895
1923
  description: description$2,
1896
- defaultLevel: "warn"
1924
+ defaultLevel: "warn",
1925
+ isTypeChecked: false
1897
1926
  },
1898
1927
  messages: {
1899
1928
  noUnnecessaryBindThis: description$2
@@ -1956,7 +1985,8 @@ plugin.createRule({
1956
1985
  meta: {
1957
1986
  docs: {
1958
1987
  description: description$1,
1959
- defaultLevel: "warn"
1988
+ defaultLevel: "warn",
1989
+ isTypeChecked: false
1960
1990
  },
1961
1991
  messages: {
1962
1992
  noUnnecessaryKey: description$1
@@ -2022,7 +2052,8 @@ plugin.createRule({
2022
2052
  meta: {
2023
2053
  docs: {
2024
2054
  description,
2025
- defaultLevel: "error"
2055
+ defaultLevel: "error",
2056
+ isTypeChecked: false
2026
2057
  },
2027
2058
  messages: {
2028
2059
  requireNamespace: "Custom element tag names in this project must start with one of the following namespaces: {{namespaces}}",
@@ -2,10 +2,22 @@ import type { RuleModule } from "@typescript-eslint/utils/ts-eslint";
2
2
  import type { TSESLint } from "@typescript-eslint/utils";
3
3
 
4
4
  export interface EslintPlugin extends TSESLint.FlatConfig.Plugin {
5
+ meta: EslintPluginMeta;
5
6
  configs: { recommended: TSESLint.FlatConfig.Config; };
6
7
  rules: Record<string, RuleModule<string, readonly unknown[], CommonDocs>>;
7
8
  }
8
9
 
10
+ export interface EslintPluginMeta extends TSESLint.FlatConfig.PluginMeta {
11
+ /**
12
+ * A set of rule names from current plugin that require type information.
13
+ *
14
+ * Generally, type checked rules are much slower as they need type checking.
15
+ * But once the first typed rule does the type checking, the other type
16
+ * checked rules don't add as much overhead.
17
+ */
18
+ typeCheckedRules: ReadonlySet<string>;
19
+ }
20
+
9
21
  export type CommonDocs = {
10
22
  /** Rule description */
11
23
  description: string;
@@ -13,4 +25,9 @@ export type CommonDocs = {
13
25
  defaultLevel: "error" | "off" | "warn";
14
26
  /** Short rule name - inherited from the createRule`s name property */
15
27
  name: string;
28
+ /**
29
+ * Whether the rule needs type information (whether it calls
30
+ * ESLintUtils.getParserServices).
31
+ */
32
+ isTypeChecked: boolean;
16
33
  };