@arcgis/eslint-config 4.33.0-next.93 → 4.33.0-next.95
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/dist/config/index.js +12 -30
- package/dist/config/lumina.js +12 -2
- package/dist/makePlugin-BgHjigyX.js +38 -0
- package/dist/plugins/lumina/index.d.ts +1 -2
- package/dist/plugins/lumina/index.js +161 -93
- package/dist/plugins/lumina/plugin.d.ts +8 -0
- package/dist/plugins/lumina/rules/add-missing-jsx-import.d.ts +2 -1
- package/dist/plugins/lumina/rules/auto-add-type.d.ts +2 -1
- package/dist/plugins/lumina/rules/ban-events.d.ts +2 -2
- package/dist/plugins/lumina/rules/component-placement-rules.d.ts +2 -1
- package/dist/plugins/lumina/rules/consistent-event-naming.d.ts +2 -2
- package/dist/plugins/lumina/rules/decorators-context.d.ts +2 -1
- package/dist/plugins/lumina/rules/explicit-setter-type.d.ts +2 -1
- package/dist/plugins/lumina/rules/member-ordering.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-create-element-component.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-ignore-jsdoc-tag.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-incorrect-dynamic-tag-name.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-inline-arrow-in-ref.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-invalid-directives-prop.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-jsx-spread.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-listen-in-connected-callback.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-non-component-exports.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-property-name-start-with-on.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-render-false.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-unnecessary-assertion-on-event.d.ts +3 -0
- package/dist/plugins/lumina/rules/no-unnecessary-attribute-name.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-unnecessary-bind-this.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-unnecessary-key.d.ts +2 -1
- package/dist/plugins/lumina/rules/tag-name-rules.d.ts +2 -2
- package/dist/plugins/lumina/utils/tags.d.ts +6 -0
- package/dist/plugins/utils/makePlugin.d.ts +12 -6
- package/dist/plugins/utils/tests.d.ts +5 -3
- package/dist/plugins/webgis/index.d.ts +1 -2
- package/dist/plugins/webgis/index.js +10 -13
- package/dist/plugins/webgis/plugin.d.ts +8 -0
- package/dist/plugins/webgis/rules/no-import-outside-src.d.ts +2 -1
- package/dist/plugins/webgis/rules/no-touching-jsdoc.d.ts +2 -1
- package/dist/plugins/webgis/rules/require-js-in-core-import.d.ts +2 -1
- package/package.json +2 -2
- package/dist/makePlugin-BEPHn5zU.js +0 -22
- package/dist/plugins/lumina/utils/creator.d.ts +0 -3
- package/dist/plugins/webgis/utils/creator.d.ts +0 -3
package/dist/config/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import eslint from "@eslint/js";
|
|
|
2
2
|
import tsEslint from "typescript-eslint";
|
|
3
3
|
import restrictedGlobals from "confusing-browser-globals";
|
|
4
4
|
import globals from "globals";
|
|
5
|
-
import webgisPlugin from "../plugins/webgis/index.js";
|
|
5
|
+
import { webgisPlugin } from "../plugins/webgis/index.js";
|
|
6
6
|
const index = [
|
|
7
7
|
{
|
|
8
8
|
ignores: ["**/www", "**/dist", "**/assets", "**/coverage", "**/.docs"]
|
|
@@ -159,35 +159,17 @@ const index = [
|
|
|
159
159
|
// variable. If you actually mean to use them, prepend with "globalThis."
|
|
160
160
|
"no-restricted-globals": [
|
|
161
161
|
"error",
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
"stop",
|
|
174
|
-
"toolbar",
|
|
175
|
-
"top",
|
|
176
|
-
// use Number.POSITIVE_INFINITY instead
|
|
177
|
-
"Infinity",
|
|
178
|
-
// use Number.NaN instead
|
|
179
|
-
"NaN",
|
|
180
|
-
// use Number.isNaN instead
|
|
181
|
-
"isNaN",
|
|
182
|
-
// Use Number.isFinite instead
|
|
183
|
-
"isFinite",
|
|
184
|
-
// use Number.parseFloat instead
|
|
185
|
-
"parseFloat",
|
|
186
|
-
// use Number.parseInt instead
|
|
187
|
-
"parseInt",
|
|
188
|
-
// Use Object.keys instead
|
|
189
|
-
"keys"
|
|
190
|
-
])
|
|
162
|
+
"i",
|
|
163
|
+
"index",
|
|
164
|
+
{ name: "Infinity", message: "Use Number.POSITIVE_INFINITY instead" },
|
|
165
|
+
{ name: "NaN", message: "Use Number.NaN instead" },
|
|
166
|
+
{ name: "isNaN", message: "Use Number.isNaN instead" },
|
|
167
|
+
{ name: "isFinite", message: "Use Number.isFinite instead" },
|
|
168
|
+
{ name: "parseFloat", message: "Use Number.parseFloat instead" },
|
|
169
|
+
{ name: "parseInt", message: "Use Number.parseInt instead" },
|
|
170
|
+
{ name: "keys", message: "Use Object.keys instead" },
|
|
171
|
+
{ name: "values", message: "Use Object.values instead" },
|
|
172
|
+
...restrictedGlobals
|
|
191
173
|
],
|
|
192
174
|
"@typescript-eslint/no-useless-empty-export": "warn",
|
|
193
175
|
// Consider using String.prototype.localeCompare()
|
package/dist/config/lumina.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import eslintPluginStorybook from "eslint-plugin-storybook";
|
|
2
|
-
import luminaPlugin from "../plugins/lumina/index.js";
|
|
2
|
+
import { luminaPlugin } from "../plugins/lumina/index.js";
|
|
3
3
|
const storybookConfig = [
|
|
4
4
|
{
|
|
5
5
|
ignores: ["**/storybook-static*"]
|
|
@@ -42,11 +42,11 @@ const lumina = [
|
|
|
42
42
|
...luminaPlugin.configs.recommended,
|
|
43
43
|
files: ["**/*.tsx"]
|
|
44
44
|
},
|
|
45
|
-
// Enable this rule in both .ts and .tsx files
|
|
46
45
|
{
|
|
47
46
|
files: ["**/*.ts", "**/*.tsx"],
|
|
48
47
|
plugins: { lumina: luminaPlugin },
|
|
49
48
|
rules: {
|
|
49
|
+
// Enable this rule in both .ts and .tsx files
|
|
50
50
|
"lumina/component-placement-rules": "error"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
@@ -56,6 +56,8 @@ const lumina = [
|
|
|
56
56
|
// It's a good practice for @method() in components to be async even if
|
|
57
57
|
// they don't have await
|
|
58
58
|
"@typescript-eslint/require-await": "off",
|
|
59
|
+
// Too many offenders for now to report this as an error. Assigned issues to tackle this.
|
|
60
|
+
"lumina/no-create-element-component": "warn",
|
|
59
61
|
/*
|
|
60
62
|
* This rule emits false warnings when using Controllers due to
|
|
61
63
|
* limitations of TypeScript when it comes to expressing the type of a
|
|
@@ -132,6 +134,14 @@ declare global {
|
|
|
132
134
|
importNames: ["ContextProvider", "ContextConsumer", "provide", "consume"],
|
|
133
135
|
message: `For lazy-loading compatibility, import the useContextProvider() and the useContextConsumer() controllers from @arcgis/lumina rather than directly calling the Lit's controllers/decorators.`,
|
|
134
136
|
caseSensitive: true
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
group: ["/@arcgis/components-controllers/accessor"],
|
|
140
|
+
message: 'Import from "@arcgis/lumina/controllers/accessor" instead'
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
group: ["/@arcgis/components-controllers"],
|
|
144
|
+
message: 'Import from "@arcgis/lumina/controllers" instead'
|
|
135
145
|
}
|
|
136
146
|
]
|
|
137
147
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
const version = "4.33.0-next.95";
|
|
3
|
+
function makeEslintPlugin(pluginName, urlCreator) {
|
|
4
|
+
const rules = [];
|
|
5
|
+
const creator = ESLintUtils.RuleCreator(urlCreator);
|
|
6
|
+
return {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
8
|
+
createRule(rule) {
|
|
9
|
+
const { meta, name, ...rest } = rule;
|
|
10
|
+
const docs = { ...meta.docs, name };
|
|
11
|
+
const ruleModule = creator({ ...rest, meta: { ...meta, docs }, name });
|
|
12
|
+
rules.push(ruleModule);
|
|
13
|
+
return ruleModule;
|
|
14
|
+
},
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
16
|
+
finalize() {
|
|
17
|
+
const config = {
|
|
18
|
+
rules: Object.fromEntries(
|
|
19
|
+
rules.map((rule) => [`${pluginName}/${rule.meta.docs.name}`, rule.meta.docs.defaultLevel])
|
|
20
|
+
)
|
|
21
|
+
};
|
|
22
|
+
const plugin = {
|
|
23
|
+
meta: { name: `@arcgis/eslint-plugin-${pluginName}`, version },
|
|
24
|
+
configs: {
|
|
25
|
+
recommended: config
|
|
26
|
+
},
|
|
27
|
+
rules: Object.fromEntries(rules.map((rule) => [rule.meta.docs.name, rule]))
|
|
28
|
+
};
|
|
29
|
+
config.plugins = {
|
|
30
|
+
[pluginName]: plugin
|
|
31
|
+
};
|
|
32
|
+
return plugin;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
makeEslintPlugin as m
|
|
38
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
export declare const luminaPlugin: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Plugin & {
|
|
2
2
|
configs: {
|
|
3
3
|
recommended: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config;
|
|
4
4
|
};
|
|
5
5
|
};
|
|
6
|
-
export default _default;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as makeEslintPlugin } from "../../makePlugin-BgHjigyX.js";
|
|
2
|
+
import { AST_NODE_TYPES, ESLintUtils, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
|
|
2
3
|
import ts from "typescript";
|
|
3
|
-
import { m as makeEslintPlugin } from "../../makePlugin-BEPHn5zU.js";
|
|
4
4
|
import { camelToKebab } from "@arcgis/components-utils";
|
|
5
|
-
const
|
|
5
|
+
const plugin = makeEslintPlugin(
|
|
6
|
+
"lumina",
|
|
6
7
|
(rule) => `https://devtopia.esri.com/WebGIS/arcgis-web-components/tree/main/packages/support-packages/eslint-config/src/plugins/lumina/rules/${rule}.ts`
|
|
7
8
|
);
|
|
8
9
|
const unwrapExpression = (expression) => expression.type === AST_NODE_TYPES.TSAsExpression || expression.type === AST_NODE_TYPES.TSNonNullExpression || expression.type === AST_NODE_TYPES.TSSatisfiesExpression ? unwrapExpression(expression.expression) : expression;
|
|
@@ -94,16 +95,16 @@ function isBindThisCallee(callee) {
|
|
|
94
95
|
callee.object.object.type === AST_NODE_TYPES.ThisExpression;
|
|
95
96
|
}
|
|
96
97
|
const importDeclaration = `import { ${luminaJsxExportName} } from "${luminaEntrypointName}";`;
|
|
97
|
-
const description$
|
|
98
|
-
|
|
98
|
+
const description$j = `To use Lumina's JSX, you need to ${importDeclaration}`;
|
|
99
|
+
plugin.createRule({
|
|
99
100
|
name: "add-missing-jsx-import",
|
|
100
101
|
meta: {
|
|
101
102
|
docs: {
|
|
102
|
-
description: description$
|
|
103
|
+
description: description$j,
|
|
103
104
|
defaultLevel: "error"
|
|
104
105
|
},
|
|
105
106
|
messages: {
|
|
106
|
-
addMissingJsxImport: description$
|
|
107
|
+
addMissingJsxImport: description$j
|
|
107
108
|
},
|
|
108
109
|
type: "problem",
|
|
109
110
|
schema: [],
|
|
@@ -160,12 +161,12 @@ const addMissingJsxImport = createRule({
|
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
163
|
});
|
|
163
|
-
const description$
|
|
164
|
-
|
|
164
|
+
const description$i = "Auto add { type: Boolean } or { type: Number } where necessary";
|
|
165
|
+
plugin.createRule({
|
|
165
166
|
name: "auto-add-type",
|
|
166
167
|
meta: {
|
|
167
168
|
docs: {
|
|
168
|
-
description: description$
|
|
169
|
+
description: description$i,
|
|
169
170
|
defaultLevel: "warn"
|
|
170
171
|
},
|
|
171
172
|
messages: {
|
|
@@ -326,13 +327,13 @@ function inferTrivialType(member) {
|
|
|
326
327
|
return "Other";
|
|
327
328
|
}
|
|
328
329
|
const builtInConverterTypes = /* @__PURE__ */ new Set(["Number", "Boolean", "Array", "Object"]);
|
|
329
|
-
|
|
330
|
+
plugin.createRule({
|
|
330
331
|
name: "ban-events",
|
|
331
332
|
defaultOptions: [],
|
|
332
333
|
meta: {
|
|
333
334
|
docs: {
|
|
334
335
|
description: "This rule helps ban or warn against listened event types",
|
|
335
|
-
defaultLevel: "
|
|
336
|
+
defaultLevel: "off"
|
|
336
337
|
},
|
|
337
338
|
messages: {
|
|
338
339
|
default: "{{message}}"
|
|
@@ -401,12 +402,12 @@ const banEvents = createRule({
|
|
|
401
402
|
};
|
|
402
403
|
}
|
|
403
404
|
});
|
|
404
|
-
const description$
|
|
405
|
-
|
|
405
|
+
const description$h = `Lumina component must be declared in a TSX file with a matching folder name located inside of src/components folder.`;
|
|
406
|
+
plugin.createRule({
|
|
406
407
|
name: "component-placement-rules",
|
|
407
408
|
meta: {
|
|
408
409
|
docs: {
|
|
409
|
-
description: description$
|
|
410
|
+
description: description$h,
|
|
410
411
|
defaultLevel: "error"
|
|
411
412
|
},
|
|
412
413
|
messages: {
|
|
@@ -445,18 +446,18 @@ const componentPlacementRules = createRule({
|
|
|
445
446
|
};
|
|
446
447
|
}
|
|
447
448
|
});
|
|
448
|
-
const description$
|
|
449
|
+
const description$g = `Enforce consistent event naming.`;
|
|
449
450
|
const defaultOptions$1 = [
|
|
450
451
|
{
|
|
451
452
|
eventNamespaces: ["arcgis"],
|
|
452
453
|
includeComponentNameInEventName: false
|
|
453
454
|
}
|
|
454
455
|
];
|
|
455
|
-
|
|
456
|
+
plugin.createRule({
|
|
456
457
|
name: "consistent-event-naming",
|
|
457
458
|
meta: {
|
|
458
459
|
docs: {
|
|
459
|
-
description: description$
|
|
460
|
+
description: description$g,
|
|
460
461
|
defaultLevel: "warn"
|
|
461
462
|
},
|
|
462
463
|
messages: {
|
|
@@ -557,12 +558,12 @@ Discussion: https://devtopia.esri.com/WebGIS/arcgis-web-components/discussions/3
|
|
|
557
558
|
}
|
|
558
559
|
});
|
|
559
560
|
const capitalAfterLower = /(?<=[a-z\d])[A-Z]/u;
|
|
560
|
-
const description$
|
|
561
|
-
|
|
561
|
+
const description$f = `Enforce that @property(), @method() and createEvent() members are used in the correct context.`;
|
|
562
|
+
plugin.createRule({
|
|
562
563
|
name: "decorators-context",
|
|
563
564
|
meta: {
|
|
564
565
|
docs: {
|
|
565
|
-
description: description$
|
|
566
|
+
description: description$f,
|
|
566
567
|
defaultLevel: "error"
|
|
567
568
|
},
|
|
568
569
|
messages: {
|
|
@@ -656,22 +657,22 @@ function isLuminaJsxType(type) {
|
|
|
656
657
|
}
|
|
657
658
|
const hasTypeFlag = (type, flag) => type.flags & flag ? true : (type.flags & ts.TypeFlags.Union) !== 0 && type.types.some((t) => hasTypeFlag(t, flag));
|
|
658
659
|
const literalTypeFlag = ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BooleanLike;
|
|
659
|
-
const description$
|
|
660
|
+
const description$e = `Need to add explicit type annotation: {{ setterType }}
|
|
660
661
|
|
|
661
662
|
Explanation:
|
|
662
663
|
Lumina automatically creates an attribute for a property if property type includes a literal type (string|number|boolean).
|
|
663
664
|
For bound properties, the property type by default comes from the bound getter type.
|
|
664
665
|
The property you are trying to bind includes a literal in the setter type, but not the getter type.
|
|
665
666
|
An explicit type annotation is required to ensure the property has an attribute created.`;
|
|
666
|
-
|
|
667
|
+
plugin.createRule({
|
|
667
668
|
name: "explicit-setter-type",
|
|
668
669
|
meta: {
|
|
669
670
|
docs: {
|
|
670
|
-
description: description$
|
|
671
|
+
description: description$e,
|
|
671
672
|
defaultLevel: "error"
|
|
672
673
|
},
|
|
673
674
|
messages: {
|
|
674
|
-
explicitSetterType: description$
|
|
675
|
+
explicitSetterType: description$e,
|
|
675
676
|
addExplicitSetterType: `Add {{ setterType }} type annotation`
|
|
676
677
|
},
|
|
677
678
|
type: "problem",
|
|
@@ -1050,7 +1051,7 @@ ${newBodyContent}
|
|
|
1050
1051
|
return newBody;
|
|
1051
1052
|
}
|
|
1052
1053
|
const baseDescription$3 = `Consistently sort component members`;
|
|
1053
|
-
|
|
1054
|
+
plugin.createRule({
|
|
1054
1055
|
name: "member-ordering",
|
|
1055
1056
|
meta: {
|
|
1056
1057
|
docs: {
|
|
@@ -1168,7 +1169,10 @@ const blockListedCustomElementNames = /* @__PURE__ */ new Set([
|
|
|
1168
1169
|
"font-face-name",
|
|
1169
1170
|
"missing-glyph"
|
|
1170
1171
|
]);
|
|
1171
|
-
|
|
1172
|
+
function isCustomElementTag(tag) {
|
|
1173
|
+
return tag.includes("-") && !blockListedCustomElementNames.has(tag);
|
|
1174
|
+
}
|
|
1175
|
+
plugin.createRule({
|
|
1172
1176
|
name: "no-create-element-component",
|
|
1173
1177
|
defaultOptions: [],
|
|
1174
1178
|
meta: {
|
|
@@ -1214,19 +1218,16 @@ function isCreateElementComponent(node) {
|
|
|
1214
1218
|
}
|
|
1215
1219
|
return false;
|
|
1216
1220
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1220
|
-
const description$c = `Use @internal or @private JSDoc tag over @ignore. See https://qawebgis.esri.com/components/lumina/documenting-components#excluding-api-from-public-documentation`;
|
|
1221
|
-
const noIgnoreJsDocTag = createRule({
|
|
1221
|
+
const description$d = `Use @internal or @private JSDoc tag over @ignore. See https://qawebgis.esri.com/components/lumina/documenting-components#excluding-api-from-public-documentation`;
|
|
1222
|
+
plugin.createRule({
|
|
1222
1223
|
name: "no-ignore-jsdoc-tag",
|
|
1223
1224
|
meta: {
|
|
1224
1225
|
docs: {
|
|
1225
|
-
description: description$
|
|
1226
|
+
description: description$d,
|
|
1226
1227
|
defaultLevel: "error"
|
|
1227
1228
|
},
|
|
1228
1229
|
messages: {
|
|
1229
|
-
noIgnoreJsDocTag: description$
|
|
1230
|
+
noIgnoreJsDocTag: description$d
|
|
1230
1231
|
},
|
|
1231
1232
|
type: "problem",
|
|
1232
1233
|
schema: []
|
|
@@ -1255,12 +1256,12 @@ const noIgnoreJsDocTag = createRule({
|
|
|
1255
1256
|
}
|
|
1256
1257
|
});
|
|
1257
1258
|
const reIgnore = /\* @ignore/gu;
|
|
1258
|
-
const description$
|
|
1259
|
-
|
|
1259
|
+
const description$c = `Detect incorrect usage of dynamic JSX tag name`;
|
|
1260
|
+
plugin.createRule({
|
|
1260
1261
|
name: "no-incorrect-dynamic-tag-name",
|
|
1261
1262
|
meta: {
|
|
1262
1263
|
docs: {
|
|
1263
|
-
description: description$
|
|
1264
|
+
description: description$c,
|
|
1264
1265
|
defaultLevel: "error"
|
|
1265
1266
|
},
|
|
1266
1267
|
messages: {
|
|
@@ -1304,10 +1305,10 @@ const noIncorrectDynamicTagName = createRule({
|
|
|
1304
1305
|
}
|
|
1305
1306
|
});
|
|
1306
1307
|
const baseDescription$2 = `Do not pass an inline arrow function to a ref prop - such syntax creates a new function on each render, which makes Lit call ref callback again on each render.`;
|
|
1307
|
-
const description$
|
|
1308
|
+
const description$b = `${baseDescription$2}
|
|
1308
1309
|
|
|
1309
1310
|
Alternatives: https://qawebgis.esri.com/components/lumina/jsx#refs`;
|
|
1310
|
-
|
|
1311
|
+
plugin.createRule({
|
|
1311
1312
|
name: "no-inline-arrow-in-ref",
|
|
1312
1313
|
meta: {
|
|
1313
1314
|
docs: {
|
|
@@ -1315,7 +1316,7 @@ const noInlineArrowInRef = createRule({
|
|
|
1315
1316
|
defaultLevel: "error"
|
|
1316
1317
|
},
|
|
1317
1318
|
messages: {
|
|
1318
|
-
errorInlineArrow: description$
|
|
1319
|
+
errorInlineArrow: description$b
|
|
1319
1320
|
},
|
|
1320
1321
|
type: "problem",
|
|
1321
1322
|
schema: []
|
|
@@ -1341,16 +1342,16 @@ const noInlineArrowInRef = createRule({
|
|
|
1341
1342
|
};
|
|
1342
1343
|
}
|
|
1343
1344
|
});
|
|
1344
|
-
const description$
|
|
1345
|
-
|
|
1345
|
+
const description$a = `directives={} prop value must be an array literal. Documentation: https://qawebgis.esri.com/components/lumina/jsx#lit-directives`;
|
|
1346
|
+
plugin.createRule({
|
|
1346
1347
|
name: "no-invalid-directives-prop",
|
|
1347
1348
|
meta: {
|
|
1348
1349
|
docs: {
|
|
1349
|
-
description: description$
|
|
1350
|
+
description: description$a,
|
|
1350
1351
|
defaultLevel: "error"
|
|
1351
1352
|
},
|
|
1352
1353
|
messages: {
|
|
1353
|
-
noInvalidDirectivesProp: description$
|
|
1354
|
+
noInvalidDirectivesProp: description$a
|
|
1354
1355
|
},
|
|
1355
1356
|
type: "problem",
|
|
1356
1357
|
schema: []
|
|
@@ -1387,16 +1388,16 @@ const noInvalidDirectivesProp = createRule({
|
|
|
1387
1388
|
};
|
|
1388
1389
|
}
|
|
1389
1390
|
});
|
|
1390
|
-
const description$
|
|
1391
|
-
|
|
1391
|
+
const description$9 = `This spread syntax is not supported. Alternatives: https://qawebgis.esri.com/components/lumina/jsx#spread-attributes`;
|
|
1392
|
+
plugin.createRule({
|
|
1392
1393
|
name: "no-jsx-spread",
|
|
1393
1394
|
meta: {
|
|
1394
1395
|
docs: {
|
|
1395
|
-
description: description$
|
|
1396
|
+
description: description$9,
|
|
1396
1397
|
defaultLevel: "error"
|
|
1397
1398
|
},
|
|
1398
1399
|
messages: {
|
|
1399
|
-
noJsxSpread: description$
|
|
1400
|
+
noJsxSpread: description$9
|
|
1400
1401
|
},
|
|
1401
1402
|
type: "problem",
|
|
1402
1403
|
schema: []
|
|
@@ -1426,14 +1427,14 @@ const noJsxSpread = createRule({
|
|
|
1426
1427
|
}
|
|
1427
1428
|
});
|
|
1428
1429
|
const baseDescription$1 = `Do not call this.listen()/this.listenOn() in connectedCallback.`;
|
|
1429
|
-
const description$
|
|
1430
|
+
const description$8 = `${baseDescription$1}
|
|
1430
1431
|
|
|
1431
1432
|
Instead, call this.listen()/this.listenOn() in constructor(), load() or loaded().
|
|
1432
1433
|
|
|
1433
1434
|
Reason:
|
|
1434
1435
|
this.listen() automatically creates and cleanups the listener on connect/disconnect.
|
|
1435
1436
|
Since connectedCallback can be called multiple times, duplicate listeners may be created.`;
|
|
1436
|
-
|
|
1437
|
+
plugin.createRule({
|
|
1437
1438
|
name: "no-listen-in-connected-callback",
|
|
1438
1439
|
meta: {
|
|
1439
1440
|
docs: {
|
|
@@ -1441,7 +1442,7 @@ const noListenInConnectedCallback = createRule({
|
|
|
1441
1442
|
defaultLevel: "error"
|
|
1442
1443
|
},
|
|
1443
1444
|
messages: {
|
|
1444
|
-
errorListenInConnectedCallback: description$
|
|
1445
|
+
errorListenInConnectedCallback: description$8
|
|
1445
1446
|
},
|
|
1446
1447
|
type: "problem",
|
|
1447
1448
|
schema: []
|
|
@@ -1476,18 +1477,18 @@ const noListenInConnectedCallback = createRule({
|
|
|
1476
1477
|
};
|
|
1477
1478
|
}
|
|
1478
1479
|
});
|
|
1479
|
-
const description$
|
|
1480
|
-
|
|
1480
|
+
const description$7 = `To ensure Hot Module Replacement (HMR) works correctly, the file that defines the Lumina component must not export anything other than the component. Exceptions: type-only exports, and the \`exportsForTests\` object for exposing additional things for usages in tests only`;
|
|
1481
|
+
plugin.createRule({
|
|
1481
1482
|
name: "no-non-component-exports",
|
|
1482
1483
|
meta: {
|
|
1483
1484
|
docs: {
|
|
1484
|
-
description: description$
|
|
1485
|
+
description: description$7,
|
|
1485
1486
|
defaultLevel: "warn"
|
|
1486
1487
|
},
|
|
1487
1488
|
messages: {
|
|
1488
|
-
noNonComponentExports: description$
|
|
1489
|
-
noDefaultExports: `Default exports are not allowed in files that export Lumina component - only named exports are allowed. ${description$
|
|
1490
|
-
noExportAll: `\`export *\` exports are not allowed in files that export Lumina component - only named exports are allowed. ${description$
|
|
1489
|
+
noNonComponentExports: description$7,
|
|
1490
|
+
noDefaultExports: `Default exports are not allowed in files that export Lumina component - only named exports are allowed. ${description$7}`,
|
|
1491
|
+
noExportAll: `\`export *\` exports are not allowed in files that export Lumina component - only named exports are allowed. ${description$7}`
|
|
1491
1492
|
},
|
|
1492
1493
|
type: "problem",
|
|
1493
1494
|
schema: []
|
|
@@ -1573,16 +1574,16 @@ const noNonComponentExports = createRule({
|
|
|
1573
1574
|
};
|
|
1574
1575
|
}
|
|
1575
1576
|
});
|
|
1576
|
-
const description$
|
|
1577
|
-
|
|
1577
|
+
const description$6 = `Do not start public property names with "on" as that can confuse frameworks into thinking this property is an event`;
|
|
1578
|
+
plugin.createRule({
|
|
1578
1579
|
name: "no-property-name-start-with-on",
|
|
1579
1580
|
meta: {
|
|
1580
1581
|
docs: {
|
|
1581
|
-
description: description$
|
|
1582
|
+
description: description$6,
|
|
1582
1583
|
defaultLevel: "error"
|
|
1583
1584
|
},
|
|
1584
1585
|
messages: {
|
|
1585
|
-
noPropertyNameStartWithOn: description$
|
|
1586
|
+
noPropertyNameStartWithOn: description$6
|
|
1586
1587
|
},
|
|
1587
1588
|
type: "problem",
|
|
1588
1589
|
schema: []
|
|
@@ -1616,10 +1617,10 @@ const noPropertyNameStartWithOn = createRule({
|
|
|
1616
1617
|
}
|
|
1617
1618
|
});
|
|
1618
1619
|
const baseDescription = `Avoid accidentally rendering "false" to the screen (Lit stringifies booleans, rather than drop them like React/Stencil).`;
|
|
1619
|
-
const description$
|
|
1620
|
+
const description$5 = `${baseDescription}
|
|
1620
1621
|
|
|
1621
1622
|
Lumina automatically handles some cases where "false" may get rendered to the screen, but the pattern this code is using is not handled.`;
|
|
1622
|
-
|
|
1623
|
+
plugin.createRule({
|
|
1623
1624
|
name: "no-render-false",
|
|
1624
1625
|
meta: {
|
|
1625
1626
|
docs: {
|
|
@@ -1627,7 +1628,7 @@ const noRenderFalse = createRule({
|
|
|
1627
1628
|
defaultLevel: "warn"
|
|
1628
1629
|
},
|
|
1629
1630
|
messages: {
|
|
1630
|
-
errorFalseRendered: description$
|
|
1631
|
+
errorFalseRendered: description$5
|
|
1631
1632
|
},
|
|
1632
1633
|
type: "problem",
|
|
1633
1634
|
schema: [],
|
|
@@ -1669,8 +1670,98 @@ const noRenderFalse = createRule({
|
|
|
1669
1670
|
};
|
|
1670
1671
|
}
|
|
1671
1672
|
});
|
|
1673
|
+
const description$4 = `Avoid using type assertions like 'event.target as ...', 'event.currentTarget as ...', or 'event.detail as ...'. Instead, improve the event argument type to avoid the need for assertions.`;
|
|
1674
|
+
plugin.createRule({
|
|
1675
|
+
name: "no-unnecessary-assertion-on-event",
|
|
1676
|
+
meta: {
|
|
1677
|
+
docs: {
|
|
1678
|
+
description: description$4,
|
|
1679
|
+
defaultLevel: "warn"
|
|
1680
|
+
},
|
|
1681
|
+
messages: {
|
|
1682
|
+
needlessInlineJsxEventTypeAnnotation: "There is no need for this type annotation as JSX types already define event types.",
|
|
1683
|
+
redundantTypeAssertion: "This type assertion is likely unnecessary.",
|
|
1684
|
+
avoidTypeAssertion: "This type assertion might be avoidable if you improve the event argument type. See examples in https://qawebgis.esri.com/components/lumina/events#listening-to-events-on-children-components"
|
|
1685
|
+
},
|
|
1686
|
+
hasSuggestions: true,
|
|
1687
|
+
fixable: "code",
|
|
1688
|
+
type: "suggestion",
|
|
1689
|
+
schema: []
|
|
1690
|
+
},
|
|
1691
|
+
defaultOptions: [],
|
|
1692
|
+
create(context) {
|
|
1693
|
+
const luminaJsxCheck = checkForLuminaJsx();
|
|
1694
|
+
return {
|
|
1695
|
+
ImportDeclaration: luminaJsxCheck,
|
|
1696
|
+
TSAsExpression(node) {
|
|
1697
|
+
if (!luminaJsxCheck.isLuminaJsx || node.expression.type !== AST_NODE_TYPES.MemberExpression || node.expression.object.type !== AST_NODE_TYPES.Identifier || node.expression.property.type !== AST_NODE_TYPES.Identifier || !["target", "currentTarget", "detail"].includes(node.expression.property.name)) {
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
const eventVariableName = node.expression.object.name;
|
|
1701
|
+
let parent = node.parent;
|
|
1702
|
+
let functionParent = void 0;
|
|
1703
|
+
while (parent != null) {
|
|
1704
|
+
if (parent.type === AST_NODE_TYPES.FunctionExpression || parent.type === AST_NODE_TYPES.FunctionDeclaration || parent.type === AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
1705
|
+
functionParent = parent;
|
|
1706
|
+
break;
|
|
1707
|
+
}
|
|
1708
|
+
parent = parent.parent;
|
|
1709
|
+
}
|
|
1710
|
+
if (functionParent === void 0) {
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
const argument = functionParent.params.at(0);
|
|
1714
|
+
if (argument === void 0 || argument.type !== AST_NODE_TYPES.Identifier || argument.name !== eventVariableName) {
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1717
|
+
const reportPossiblyUnnecessaryTypeAssertion = () => context.report({
|
|
1718
|
+
messageId: "redundantTypeAssertion",
|
|
1719
|
+
node,
|
|
1720
|
+
// If it is definitely unnecessary, it will be removed by
|
|
1721
|
+
// the `@typescript-eslint/no-unnecessary-type-assertion` rule.
|
|
1722
|
+
// So we only report as a suggestion for manual review.
|
|
1723
|
+
suggest: [
|
|
1724
|
+
{
|
|
1725
|
+
messageId: "redundantTypeAssertion",
|
|
1726
|
+
fix(fixer) {
|
|
1727
|
+
return fixer.replaceTextRange(
|
|
1728
|
+
[node.range[0], node.range[1]],
|
|
1729
|
+
context.sourceCode.getText(node.expression)
|
|
1730
|
+
);
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
]
|
|
1734
|
+
});
|
|
1735
|
+
const isInlineListener = functionParent.parent.type === AST_NODE_TYPES.JSXExpressionContainer;
|
|
1736
|
+
if (isInlineListener) {
|
|
1737
|
+
if (argument.typeAnnotation === void 0) {
|
|
1738
|
+
reportPossiblyUnnecessaryTypeAssertion();
|
|
1739
|
+
return;
|
|
1740
|
+
} else {
|
|
1741
|
+
const typeAnnotation = argument.typeAnnotation;
|
|
1742
|
+
context.report({
|
|
1743
|
+
messageId: "needlessInlineJsxEventTypeAnnotation",
|
|
1744
|
+
node: typeAnnotation,
|
|
1745
|
+
fix(fixer) {
|
|
1746
|
+
return fixer.remove(typeAnnotation);
|
|
1747
|
+
}
|
|
1748
|
+
});
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
if (argument.typeAnnotation?.typeAnnotation.type === AST_NODE_TYPES.TSUnionType) {
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
context.report({
|
|
1756
|
+
messageId: "avoidTypeAssertion",
|
|
1757
|
+
node
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
});
|
|
1672
1763
|
const description$3 = 'There is no need for { attribute: "name" } in @property() when attribute name is trivially inferrable from the property name';
|
|
1673
|
-
|
|
1764
|
+
plugin.createRule({
|
|
1674
1765
|
name: "no-unnecessary-attribute-name",
|
|
1675
1766
|
meta: {
|
|
1676
1767
|
docs: {
|
|
@@ -1723,7 +1814,7 @@ const noUnnecessaryAttributeName = createRule({
|
|
|
1723
1814
|
}
|
|
1724
1815
|
});
|
|
1725
1816
|
const description$2 = `.bind(this) is not necessary in Lit's event listener callbacks and ref callbacks as it is handled automatically.`;
|
|
1726
|
-
|
|
1817
|
+
plugin.createRule({
|
|
1727
1818
|
name: "no-unnecessary-bind-this",
|
|
1728
1819
|
meta: {
|
|
1729
1820
|
docs: {
|
|
@@ -1786,7 +1877,7 @@ const noUnnecessaryBindThis = createRule({
|
|
|
1786
1877
|
}
|
|
1787
1878
|
});
|
|
1788
1879
|
const description$1 = `In most cases, key={index} is not necessary in Lumina in .map(). Details: https://qawebgis.esri.com/components/lumina/jsx#key-prop`;
|
|
1789
|
-
|
|
1880
|
+
plugin.createRule({
|
|
1790
1881
|
name: "no-unnecessary-key",
|
|
1791
1882
|
meta: {
|
|
1792
1883
|
docs: {
|
|
@@ -1852,7 +1943,7 @@ const defaultOptions = [
|
|
|
1852
1943
|
namespaces: ["arcgis-"]
|
|
1853
1944
|
}
|
|
1854
1945
|
];
|
|
1855
|
-
|
|
1946
|
+
plugin.createRule({
|
|
1856
1947
|
name: "tag-name-rules",
|
|
1857
1948
|
meta: {
|
|
1858
1949
|
docs: {
|
|
@@ -2066,30 +2157,7 @@ declare global {
|
|
|
2066
2157
|
});
|
|
2067
2158
|
const tagNameToNormalizedClassName = (tagName) => tagName.replaceAll("-", "").toLowerCase();
|
|
2068
2159
|
const reCustomElementName = /^[a-z]+(?:-[a-z\d]+)+$/u;
|
|
2069
|
-
const luminaPlugin =
|
|
2070
|
-
"add-missing-jsx-import": addMissingJsxImport,
|
|
2071
|
-
"auto-add-type": autoAddType,
|
|
2072
|
-
"ban-events": banEvents,
|
|
2073
|
-
"component-placement-rules": componentPlacementRules,
|
|
2074
|
-
"consistent-event-naming": consistentEventNaming,
|
|
2075
|
-
"decorators-context": decoratorsContext,
|
|
2076
|
-
"explicit-setter-type": explicitSetterType,
|
|
2077
|
-
"member-ordering": memberOrdering,
|
|
2078
|
-
"no-create-element-component": noCreateElementComponent,
|
|
2079
|
-
"no-ignore-jsdoc-tag": noIgnoreJsDocTag,
|
|
2080
|
-
"no-incorrect-dynamic-tag-name": noIncorrectDynamicTagName,
|
|
2081
|
-
"no-inline-arrow-in-ref": noInlineArrowInRef,
|
|
2082
|
-
"no-invalid-directives-prop": noInvalidDirectivesProp,
|
|
2083
|
-
"no-jsx-spread": noJsxSpread,
|
|
2084
|
-
"no-listen-in-connected-callback": noListenInConnectedCallback,
|
|
2085
|
-
"no-non-component-exports": noNonComponentExports,
|
|
2086
|
-
"no-property-name-start-with-on": noPropertyNameStartWithOn,
|
|
2087
|
-
"no-render-false": noRenderFalse,
|
|
2088
|
-
"no-unnecessary-attribute-name": noUnnecessaryAttributeName,
|
|
2089
|
-
"no-unnecessary-bind-this": noUnnecessaryBindThis,
|
|
2090
|
-
"no-unnecessary-key": noUnnecessaryKey,
|
|
2091
|
-
"tag-name-rules": tagNameRules
|
|
2092
|
-
});
|
|
2160
|
+
const luminaPlugin = plugin.finalize();
|
|
2093
2161
|
export {
|
|
2094
|
-
luminaPlugin
|
|
2162
|
+
luminaPlugin
|
|
2095
2163
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const plugin: {
|
|
2
|
+
createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<import('@typescript-eslint/utils/eslint-utils').RuleWithMetaAndName<Options, MessageIds, Omit<import('../utils/makePlugin').CommonDocs, "name">>>) => import('@typescript-eslint/utils/ts-eslint').RuleModule<MessageIds, Options, import('../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
3
|
+
finalize: () => import("@typescript-eslint/utils/ts-eslint").FlatConfig.Plugin & {
|
|
4
|
+
configs: {
|
|
5
|
+
recommended: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"addMissingJsxImport", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
|
|
2
|
+
declare const _default: ESLintUtils.RuleModule<"addType" | "typeAnnotationMismatchesActualType" | "noEmptyPropertyObject" | "noUnnecessaryType" | "unhandledType", [], import('../../utils/makePlugin').CommonDocs, ESLintUtils.RuleListener>;
|
|
3
|
+
export default _default;
|
|
@@ -2,5 +2,5 @@ type Options = (string | {
|
|
|
2
2
|
event: string;
|
|
3
3
|
message?: string;
|
|
4
4
|
})[];
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"default", Options, import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
6
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"fileFolderNameMismatch" | "extensionNotTsx" | "noComponentOutsideSrcComponents", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -11,5 +11,5 @@ type Options = [
|
|
|
11
11
|
}
|
|
12
12
|
];
|
|
13
13
|
type Messages = "componentNameInEventError" | "eventNamespaceError" | "missingPrivateJsDocTag" | "noComponentNameInEventError";
|
|
14
|
-
|
|
15
|
-
export
|
|
14
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<Messages, Options, import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
15
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"publicApiMustBePublic" | "noPropertyDecoratorOnMethods" | "noCombinedPropertyEvent" | "noCombinedPropertyState" | "noComputedName", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -15,4 +15,5 @@ import { ESLintUtils } from '@typescript-eslint/utils';
|
|
|
15
15
|
* type. Then we can use it as is in the .d.ts file. The getter type can be
|
|
16
16
|
* retrieved easily via `typeof` operator.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
declare const _default: ESLintUtils.RuleModule<"explicitSetterType" | "addExplicitSetterType", [], import('../../utils/makePlugin').CommonDocs, ESLintUtils.RuleListener>;
|
|
19
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"memberOrdering" | "unsupportedElementType", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"default", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noIgnoreJsDocTag", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
|
|
2
|
+
declare const _default: ESLintUtils.RuleModule<"incorrectDynamicTagName", [], import('../../utils/makePlugin').CommonDocs, ESLintUtils.RuleListener>;
|
|
3
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"errorInlineArrow", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noInvalidDirectivesProp", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noJsxSpread", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"errorListenInConnectedCallback", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noNonComponentExports" | "noDefaultExports" | "noExportAll", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noPropertyNameStartWithOn", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
|
|
2
|
+
declare const _default: ESLintUtils.RuleModule<"errorFalseRendered", [], import('../../utils/makePlugin').CommonDocs, ESLintUtils.RuleListener>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
declare const _default: TSESLint.RuleModule<"needlessInlineJsxEventTypeAnnotation" | "redundantTypeAssertion" | "avoidTypeAssertion", [], import('../../utils/makePlugin').CommonDocs, TSESLint.RuleListener>;
|
|
3
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noUnnecessaryAttributeName", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noUnnecessaryBindThis", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noUnnecessaryKey", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -4,5 +4,5 @@ type Options = [
|
|
|
4
4
|
}
|
|
5
5
|
];
|
|
6
6
|
type Messages = "duplicateDeclaration" | "duplicateDeclareGlobal" | "invalidTagName" | "lowercaseTagName" | "missingClassDeclaration" | "missingHyphen" | "mustNotSubclassHtmlElement" | "mustSubclass" | "noComputedTagName" | "noNonStringTagName" | "noTagNameIdentifier" | "requireNamespace" | "reservedTagName" | "tagNameClassNameMismatch" | "unexpectedDeclarationType" | "unexpectedDeclareElementsEntry" | "unexpectedTypeArguments";
|
|
7
|
-
|
|
8
|
-
export
|
|
7
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<Messages, Options, import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
8
|
+
export default _default;
|
|
@@ -6,3 +6,9 @@
|
|
|
6
6
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define#valid_custom_element_names
|
|
7
7
|
*/
|
|
8
8
|
export declare const blockListedCustomElementNames: Set<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Simple check based on:
|
|
11
|
+
* - https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
12
|
+
* - https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define#valid_custom_element_names
|
|
13
|
+
*/
|
|
14
|
+
export declare function isCustomElementTag(tag: string): boolean;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TSESLint } from '@typescript-eslint/utils';
|
|
1
|
+
import { TSESLint, ESLintUtils } from '@typescript-eslint/utils';
|
|
3
2
|
export type CommonDocs = {
|
|
4
3
|
description: string;
|
|
5
|
-
defaultLevel: "error" | "warn";
|
|
4
|
+
defaultLevel: "error" | "off" | "warn";
|
|
5
|
+
name: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A helper function to create an ESLint plugin with less boilerplate
|
|
9
|
+
*/
|
|
10
|
+
export declare function makeEslintPlugin<PluginDocs extends CommonDocs = CommonDocs>(pluginName: string, urlCreator: (ruleName: string) => string): {
|
|
11
|
+
createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, Omit<PluginDocs, "name">>>) => ESLintUtils.RuleModule<MessageIds, Options, PluginDocs>;
|
|
12
|
+
finalize: () => TSESLint.FlatConfig.Plugin & {
|
|
13
|
+
configs: {
|
|
14
|
+
recommended: TSESLint.FlatConfig.Config;
|
|
15
|
+
};
|
|
10
16
|
};
|
|
11
17
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ESLintUtils, TSUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import { CommonDocs } from './makePlugin';
|
|
3
|
+
import { RunTests } from '@typescript-eslint/rule-tester';
|
|
4
|
+
export declare function testUntypedRule<MessageIds extends string, Options extends readonly unknown[]>(rule: ESLintUtils.RuleModule<MessageIds, Options, CommonDocs>, test: RunTests<TSUtils.NoInfer<MessageIds>, TSUtils.NoInfer<Options>>): void;
|
|
5
|
+
export declare function testTypedRule<MessageIds extends string, Options extends readonly unknown[]>(rule: ESLintUtils.RuleModule<MessageIds, Options, CommonDocs>, test: RunTests<TSUtils.NoInfer<MessageIds>, TSUtils.NoInfer<Options>>): void;
|
|
4
6
|
/**
|
|
5
7
|
* A helper for authoring before/after autofix diff in a way that makes it easy
|
|
6
8
|
* to see what part of the code changed, and avoids duplication.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
export declare const webgisPlugin: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Plugin & {
|
|
2
2
|
configs: {
|
|
3
3
|
recommended: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config;
|
|
4
4
|
};
|
|
5
5
|
};
|
|
6
|
-
export default _default;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { m as makeEslintPlugin } from "../../makePlugin-
|
|
2
|
-
import { ESLintUtils, AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
1
|
+
import { m as makeEslintPlugin } from "../../makePlugin-BgHjigyX.js";
|
|
3
2
|
import { resolve } from "node:path/posix";
|
|
4
|
-
|
|
5
|
-
const
|
|
3
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4
|
+
const plugin = makeEslintPlugin(
|
|
5
|
+
"webgis",
|
|
6
6
|
(rule) => `https://devtopia.esri.com/WebGIS/arcgis-web-components/tree/main/packages/support-packages/eslint-config/src/plugins/webgis/rules/${rule}.ts`
|
|
7
7
|
);
|
|
8
|
+
const isTestFile = (filePath) => filePath.includes("/test") || filePath.includes(".test") || filePath.includes(".spec") || filePath.includes("e2e") || filePath.includes("__") || filePath.includes("/.");
|
|
8
9
|
const description$2 = `Imports of files outside the src/ folder are not-portable and likely to break for consumers of this package.`;
|
|
9
|
-
|
|
10
|
+
plugin.createRule({
|
|
10
11
|
name: "no-import-outside-src",
|
|
11
12
|
meta: {
|
|
12
13
|
docs: {
|
|
@@ -49,7 +50,7 @@ const noImportOutsideSrc = createRule({
|
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
const description$1 = `Having two JSDoc comments next to each other is most likely a mistake - consider combining them into one, or separating them for clarity.`;
|
|
52
|
-
|
|
53
|
+
plugin.createRule({
|
|
53
54
|
name: "no-touching-jsdoc",
|
|
54
55
|
meta: {
|
|
55
56
|
docs: {
|
|
@@ -94,7 +95,7 @@ const noTouchingJsDoc = createRule({
|
|
|
94
95
|
});
|
|
95
96
|
const reTouchingJsDoc = /\*\/\s+\/\*\*/gu;
|
|
96
97
|
const description = `@arcgis/core imports need to end with .js for better compatibility with @arcgis/core ESM CDN builds.`;
|
|
97
|
-
|
|
98
|
+
plugin.createRule({
|
|
98
99
|
name: "require-js-in-core-import",
|
|
99
100
|
meta: {
|
|
100
101
|
docs: {
|
|
@@ -134,11 +135,7 @@ const requireJsInCoreImport = createRule({
|
|
|
134
135
|
};
|
|
135
136
|
}
|
|
136
137
|
});
|
|
137
|
-
const webgisPlugin =
|
|
138
|
-
"no-import-outside-src": noImportOutsideSrc,
|
|
139
|
-
"no-touching-jsdoc": noTouchingJsDoc,
|
|
140
|
-
"require-js-in-core-import": requireJsInCoreImport
|
|
141
|
-
});
|
|
138
|
+
const webgisPlugin = plugin.finalize();
|
|
142
139
|
export {
|
|
143
|
-
webgisPlugin
|
|
140
|
+
webgisPlugin
|
|
144
141
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const plugin: {
|
|
2
|
+
createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<import('@typescript-eslint/utils/eslint-utils').RuleWithMetaAndName<Options, MessageIds, Omit<import('../utils/makePlugin').CommonDocs, "name">>>) => import('@typescript-eslint/utils/ts-eslint').RuleModule<MessageIds, Options, import('../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
3
|
+
finalize: () => import("@typescript-eslint/utils/ts-eslint").FlatConfig.Plugin & {
|
|
4
|
+
configs: {
|
|
5
|
+
recommended: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noImportOutsideSrc", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noTouchingJsDoc", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"requireJsInCoreImport", [], import('../../utils/makePlugin').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": "4.33.0-next.
|
|
3
|
+
"version": "4.33.0-next.95",
|
|
4
4
|
"description": "ESLint configuration for arcgis-web-components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@arcgis/components-utils": "4.33.0-next.
|
|
22
|
+
"@arcgis/components-utils": "4.33.0-next.95",
|
|
23
23
|
"@eslint/js": "^9.17.0",
|
|
24
24
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
25
25
|
"confusing-browser-globals": "^1.0.11",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const version = "4.33.0-next.93";
|
|
2
|
-
function makeEslintPlugin(pluginName, rules) {
|
|
3
|
-
const config = {
|
|
4
|
-
rules: Object.fromEntries(
|
|
5
|
-
Object.entries(rules).map(([name, rule]) => [`${pluginName}/${name}`, rule.meta.docs.defaultLevel])
|
|
6
|
-
)
|
|
7
|
-
};
|
|
8
|
-
const plugin = {
|
|
9
|
-
meta: { name: "@arcgis/eslint-plugin-webgis", version },
|
|
10
|
-
configs: {
|
|
11
|
-
recommended: config
|
|
12
|
-
},
|
|
13
|
-
rules
|
|
14
|
-
};
|
|
15
|
-
config.plugins = {
|
|
16
|
-
[pluginName]: plugin
|
|
17
|
-
};
|
|
18
|
-
return plugin;
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
makeEslintPlugin as m
|
|
22
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
import { CommonDocs } from '../../utils/makePlugin';
|
|
3
|
-
export declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, CommonDocs>>) => ESLintUtils.RuleModule<MessageIds, Options, CommonDocs, ESLintUtils.RuleListener>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
import { CommonDocs } from '../../utils/makePlugin';
|
|
3
|
-
export declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, CommonDocs>>) => ESLintUtils.RuleModule<MessageIds, Options, CommonDocs, ESLintUtils.RuleListener>;
|