@arcgis/eslint-config 5.0.0-next.3 → 5.0.0-next.31
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,4 +1,4 @@
|
|
|
1
|
-
import { m as makeEslintPlugin } from "../../makePlugin-
|
|
1
|
+
import { m as makeEslintPlugin } from "../../makePlugin-Db9dZdZy.js";
|
|
2
2
|
import { AST_NODE_TYPES, ESLintUtils, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
|
|
3
3
|
import ts from "typescript";
|
|
4
4
|
import { camelToKebab } from "@arcgis/toolkit/string";
|
|
@@ -2037,17 +2037,12 @@ plugin.createRule({
|
|
|
2037
2037
|
noTagNameIdentifier: "Tag name must include a dash",
|
|
2038
2038
|
unexpectedDeclareElementsEntry: "Unexpected entry in declare elements interface. Expected a property signature",
|
|
2039
2039
|
unexpectedDeclarationType: "Unexpected declaration type. Expected component class identifier",
|
|
2040
|
-
duplicateDeclaration: "The same component may only be assigned to one class name. If you need
|
|
2040
|
+
duplicateDeclaration: "The same component may only be assigned to one class name. If you need multiple tag names, consider sub-classing the component",
|
|
2041
2041
|
missingClassDeclaration: "Missing class declaration",
|
|
2042
2042
|
unexpectedTypeArguments: "Unexpected type arguments in the component tag name declaration. Type arguments should be specified in the component class declaration",
|
|
2043
2043
|
reservedTagName: "This is a reserved html element tag name. Declaring components with this name is forbidden by the custom elements specification.",
|
|
2044
|
-
duplicateDeclareGlobal: `There should only be a single "declare global" block in a file
|
|
2045
|
-
declare global
|
|
2046
|
-
interface DeclareElements {
|
|
2047
|
-
"arcgis-test1": ArcgisTest1;
|
|
2048
|
-
"arcgis-test2": ArcgisTest2;
|
|
2049
|
-
}
|
|
2050
|
-
}`,
|
|
2044
|
+
duplicateDeclareGlobal: `There should only be a single "declare global" block in a file.`,
|
|
2045
|
+
multipleDeclarations: `There should only be a single "DeclareElements" interface in a "declare global" block with a single component declaration inside. Create a separate file to define additional components.`,
|
|
2051
2046
|
mustSubclass: "Lumina component is required to subclass LitElement or a subclass of LitElement",
|
|
2052
2047
|
mustNotSubclassHtmlElement: "Lumina component is not allowed to subclass HTMLElement classes directly. Subclass LitElement or a subclass of LitElement instead",
|
|
2053
2048
|
tagNameClassNameMismatch: 'The custom element tag name "{{tagName}}" does not seem to match the class name it is assigned to: "{{className}}". Make sure tag name and class name use the same characters in the same order (case insensitive, hyphens removed). {{namespaceNotice}}',
|
|
@@ -2090,123 +2085,130 @@ declare global {
|
|
|
2090
2085
|
return;
|
|
2091
2086
|
}
|
|
2092
2087
|
seenDeclareGlobal = true;
|
|
2093
|
-
luminaDeclarationInterface.body.body
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
} else {
|
|
2137
|
-
namespaceFreeTagName = tagName.slice(namespace.length);
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
if (!tagName.includes("-")) {
|
|
2141
|
-
context.report({
|
|
2142
|
-
messageId: "missingHyphen",
|
|
2143
|
-
node: member.key
|
|
2144
|
-
});
|
|
2145
|
-
return;
|
|
2146
|
-
}
|
|
2147
|
-
if (tagName.toLowerCase() !== tagName) {
|
|
2148
|
-
context.report({
|
|
2149
|
-
messageId: "lowercaseTagName",
|
|
2150
|
-
node: member.key
|
|
2151
|
-
});
|
|
2152
|
-
return;
|
|
2153
|
-
}
|
|
2154
|
-
if (!reCustomElementName.test(tagName)) {
|
|
2088
|
+
const members = luminaDeclarationInterface.body.body;
|
|
2089
|
+
if (members.length !== 1) {
|
|
2090
|
+
context.report({
|
|
2091
|
+
messageId: "multipleDeclarations",
|
|
2092
|
+
node: luminaDeclarationInterface
|
|
2093
|
+
});
|
|
2094
|
+
return;
|
|
2095
|
+
}
|
|
2096
|
+
const member = members[0];
|
|
2097
|
+
if (member.type !== AST_NODE_TYPES.TSPropertySignature) {
|
|
2098
|
+
context.report({
|
|
2099
|
+
messageId: "unexpectedDeclareElementsEntry",
|
|
2100
|
+
node: member
|
|
2101
|
+
});
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2104
|
+
if (member.computed) {
|
|
2105
|
+
context.report({
|
|
2106
|
+
messageId: "noComputedTagName",
|
|
2107
|
+
node: member.key
|
|
2108
|
+
});
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
if (member.key.type === AST_NODE_TYPES.Identifier) {
|
|
2112
|
+
context.report({
|
|
2113
|
+
messageId: "noTagNameIdentifier",
|
|
2114
|
+
node: member.key
|
|
2115
|
+
});
|
|
2116
|
+
return;
|
|
2117
|
+
}
|
|
2118
|
+
if (typeof member.key.value !== "string") {
|
|
2119
|
+
context.report({
|
|
2120
|
+
messageId: "noNonStringTagName",
|
|
2121
|
+
node: member.key
|
|
2122
|
+
});
|
|
2123
|
+
return;
|
|
2124
|
+
}
|
|
2125
|
+
const tagName = member.key.value;
|
|
2126
|
+
let namespaceFreeTagName = tagName;
|
|
2127
|
+
const namespaces = options[0].namespaces;
|
|
2128
|
+
if (namespaces.length > 0) {
|
|
2129
|
+
const namespace = namespaces.find((ns) => tagName.startsWith(ns));
|
|
2130
|
+
if (namespace === void 0) {
|
|
2155
2131
|
context.report({
|
|
2156
|
-
messageId: "
|
|
2132
|
+
messageId: "requireNamespace",
|
|
2157
2133
|
node: member.key,
|
|
2158
2134
|
data: {
|
|
2159
|
-
|
|
2135
|
+
namespaces: namespaces.join(", ")
|
|
2160
2136
|
}
|
|
2161
2137
|
});
|
|
2162
2138
|
return;
|
|
2139
|
+
} else {
|
|
2140
|
+
namespaceFreeTagName = tagName.slice(namespace.length);
|
|
2163
2141
|
}
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2142
|
+
}
|
|
2143
|
+
if (!tagName.includes("-")) {
|
|
2144
|
+
context.report({
|
|
2145
|
+
messageId: "missingHyphen",
|
|
2146
|
+
node: member.key
|
|
2147
|
+
});
|
|
2148
|
+
return;
|
|
2149
|
+
}
|
|
2150
|
+
if (tagName.toLowerCase() !== tagName) {
|
|
2151
|
+
context.report({
|
|
2152
|
+
messageId: "lowercaseTagName",
|
|
2153
|
+
node: member.key
|
|
2154
|
+
});
|
|
2155
|
+
return;
|
|
2156
|
+
}
|
|
2157
|
+
if (!reCustomElementName.test(tagName)) {
|
|
2158
|
+
context.report({
|
|
2159
|
+
messageId: "invalidTagName",
|
|
2160
|
+
node: member.key,
|
|
2161
|
+
data: {
|
|
2162
|
+
regex: reCustomElementName.toString()
|
|
2163
|
+
}
|
|
2164
|
+
});
|
|
2165
|
+
return;
|
|
2166
|
+
}
|
|
2167
|
+
if (blockListedCustomElementNames.has(tagName)) {
|
|
2168
|
+
context.report({
|
|
2169
|
+
messageId: "reservedTagName",
|
|
2170
|
+
node: member.key
|
|
2171
|
+
});
|
|
2172
|
+
return;
|
|
2173
|
+
}
|
|
2174
|
+
const type = member.typeAnnotation?.typeAnnotation;
|
|
2175
|
+
if (type?.type !== AST_NODE_TYPES.TSTypeReference || type.typeName.type !== AST_NODE_TYPES.Identifier) {
|
|
2176
|
+
context.report({
|
|
2177
|
+
messageId: "unexpectedDeclarationType",
|
|
2178
|
+
node: type ?? member
|
|
2179
|
+
});
|
|
2180
|
+
return;
|
|
2181
|
+
}
|
|
2182
|
+
if (type.typeArguments !== void 0) {
|
|
2183
|
+
context.report({
|
|
2184
|
+
messageId: "unexpectedTypeArguments",
|
|
2185
|
+
node: type
|
|
2186
|
+
});
|
|
2187
|
+
return;
|
|
2188
|
+
}
|
|
2189
|
+
const className = type.typeName.name;
|
|
2190
|
+
const classNameFromTagName = tagNameToNormalizedClassName(tagName);
|
|
2191
|
+
const classNameFromShortTagName = tagNameToNormalizedClassName(namespaceFreeTagName);
|
|
2192
|
+
if (classNameFromTagName !== className.toLowerCase() && classNameFromShortTagName !== className.toLowerCase()) {
|
|
2193
|
+
context.report({
|
|
2194
|
+
messageId: "tagNameClassNameMismatch",
|
|
2195
|
+
node: type.typeName,
|
|
2196
|
+
data: {
|
|
2197
|
+
tagName,
|
|
2198
|
+
className,
|
|
2199
|
+
namespaceNotice: namespaces.length > 0 ? `In addition, the following tag name prefixes are expected: ${namespaces.join(", ")}` : ""
|
|
2200
|
+
}
|
|
2201
|
+
});
|
|
2202
|
+
return;
|
|
2203
|
+
}
|
|
2204
|
+
if (declaredComponents.has(className)) {
|
|
2205
|
+
context.report({
|
|
2206
|
+
messageId: "duplicateDeclaration",
|
|
2207
|
+
node: type.typeName
|
|
2208
|
+
});
|
|
2209
|
+
return;
|
|
2210
|
+
}
|
|
2211
|
+
declaredComponents.set(className, type.typeName);
|
|
2210
2212
|
},
|
|
2211
2213
|
"ClassDeclaration"(node) {
|
|
2212
2214
|
if (node.id !== null && declaredComponents.has(node.id.name)) {
|
|
@@ -3,6 +3,6 @@ type Options = [
|
|
|
3
3
|
namespaces?: readonly string[];
|
|
4
4
|
}
|
|
5
5
|
];
|
|
6
|
-
type Messages = "duplicateDeclaration" | "duplicateDeclareGlobal" | "invalidTagName" | "lowercaseTagName" | "missingClassDeclaration" | "missingHyphen" | "mustNotSubclassHtmlElement" | "mustSubclass" | "noComputedTagName" | "noNonStringTagName" | "noTagNameIdentifier" | "requireNamespace" | "reservedTagName" | "tagNameClassNameMismatch" | "unexpectedDeclarationType" | "unexpectedDeclareElementsEntry" | "unexpectedTypeArguments";
|
|
6
|
+
type Messages = "duplicateDeclaration" | "duplicateDeclareGlobal" | "invalidTagName" | "lowercaseTagName" | "missingClassDeclaration" | "missingHyphen" | "multipleDeclarations" | "mustNotSubclassHtmlElement" | "mustSubclass" | "noComputedTagName" | "noNonStringTagName" | "noTagNameIdentifier" | "requireNamespace" | "reservedTagName" | "tagNameClassNameMismatch" | "unexpectedDeclarationType" | "unexpectedDeclareElementsEntry" | "unexpectedTypeArguments";
|
|
7
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
8
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as makeEslintPlugin } from "../../makePlugin-
|
|
1
|
+
import { m as makeEslintPlugin } from "../../makePlugin-Db9dZdZy.js";
|
|
2
2
|
import { resolve } from "path/posix";
|
|
3
3
|
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4
4
|
const plugin = makeEslintPlugin(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/eslint-config",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.31",
|
|
4
4
|
"description": "ESLint configuration for arcgis-web-components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@arcgis/toolkit": "5.0.0-next.
|
|
23
|
+
"@arcgis/toolkit": "5.0.0-next.31",
|
|
24
24
|
"@eslint/js": "^9.29.0",
|
|
25
25
|
"@eslint/markdown": "^6.6.0",
|
|
26
26
|
"@types/confusing-browser-globals": "^1.0.3",
|