@arcgis/eslint-config 5.2.0-next.12 → 5.2.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/LICENSE.md +4 -2
- package/README.md +2 -2
- package/dist/config/applications.js +0 -2
- package/dist/config/core.js +720 -0
- package/dist/config/extra.js +1 -1
- package/dist/config/index.js +35 -12
- package/dist/{estree-CDc-die8.js → estree-Ern7-L05.js} +8 -6
- package/dist/{makePlugin-B_8WcydL.js → makePlugin-CkrvQfdh.js} +6 -2
- package/dist/plugins/core/index.js +75 -33
- package/dist/plugins/lumina/index.js +63 -32
- package/dist/plugins/utils/makePlugin.d.ts +17 -0
- package/dist/plugins/webgis/index.js +171 -31
- package/dist/utils/disableRules.d.ts +3 -2
- package/dist/utils/disableRules.js +1 -1
- package/package.json +15 -9
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { m as makeEslintPlugin } from "../../makePlugin-
|
|
1
|
+
import { m as makeEslintPlugin } from "../../makePlugin-CkrvQfdh.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,
|
|
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 "../../estree-Ern7-L05.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/
|
|
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/
|
|
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/
|
|
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
|
};
|