@arcgis/eslint-config 4.32.0-next.100
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 +13 -0
- package/README.md +21 -0
- package/dist/chunk-4VALMCCY.js +160 -0
- package/dist/chunk-ONXYPLSB.js +1975 -0
- package/dist/chunk-PNDNIABG.js +26 -0
- package/dist/config/extra.d.ts +24 -0
- package/dist/config/extra.js +36 -0
- package/dist/config/index.d.ts +22 -0
- package/dist/config/index.js +626 -0
- package/dist/config/lumina.d.ts +7 -0
- package/dist/config/lumina.js +227 -0
- package/dist/config/storybook.d.ts +2 -0
- package/dist/plugins/lumina/index.d.ts +6 -0
- package/dist/plugins/lumina/index.js +7 -0
- package/dist/plugins/lumina/rules/add-missing-jsx-import.d.ts +1 -0
- package/dist/plugins/lumina/rules/add-missing-jsx-import.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/auto-add-type.d.ts +2 -0
- package/dist/plugins/lumina/rules/auto-add-type.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/component-placement-rules.d.ts +1 -0
- package/dist/plugins/lumina/rules/component-placement-rules.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/consistent-event-naming.d.ts +15 -0
- package/dist/plugins/lumina/rules/consistent-event-naming.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/decorators-context.d.ts +1 -0
- package/dist/plugins/lumina/rules/decorators-context.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/member-ordering/build.d.ts +4 -0
- package/dist/plugins/lumina/rules/member-ordering/comments.d.ts +19 -0
- package/dist/plugins/lumina/rules/member-ordering/config.d.ts +36 -0
- package/dist/plugins/lumina/rules/member-ordering/normalize.d.ts +10 -0
- package/dist/plugins/lumina/rules/member-ordering.d.ts +1 -0
- package/dist/plugins/lumina/rules/member-ordering.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-ignore-jsdoc-tag.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-ignore-jsdoc-tag.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-incorrect-dynamic-tag-name.d.ts +2 -0
- package/dist/plugins/lumina/rules/no-incorrect-dynamic-tag-name.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-inline-arrow-in-ref.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-inline-arrow-in-ref.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-invalid-directives-prop.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-invalid-directives-prop.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-jsx-spread.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-jsx-spread.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-listen-in-connected-callback.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-listen-in-connected-callback.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-non-component-exports.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-non-component-exports.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-property-name-start-with-on.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-property-name-start-with-on.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-render-false.d.ts +2 -0
- package/dist/plugins/lumina/rules/no-render-false.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-unnecessary-attribute-name.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-unnecessary-attribute-name.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-unnecessary-bind-this.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-unnecessary-bind-this.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-unnecessary-key.d.ts +1 -0
- package/dist/plugins/lumina/rules/no-unnecessary-key.test.d.ts +1 -0
- package/dist/plugins/lumina/rules/tag-name-rules.d.ts +8 -0
- package/dist/plugins/lumina/rules/tag-name-rules.spec.d.ts +1 -0
- package/dist/plugins/lumina/utils/checker.d.ts +2 -0
- package/dist/plugins/lumina/utils/creator.d.ts +3 -0
- package/dist/plugins/lumina/utils/estree.d.ts +21 -0
- package/dist/plugins/utils/helpers.d.ts +1 -0
- package/dist/plugins/utils/makePlugin.d.ts +18 -0
- package/dist/plugins/utils/tests.d.ts +26 -0
- package/dist/plugins/webgis/index.d.ts +6 -0
- package/dist/plugins/webgis/index.js +7 -0
- package/dist/plugins/webgis/rules/no-import-outside-src.d.ts +1 -0
- package/dist/plugins/webgis/rules/no-import-outside-src.test.d.ts +1 -0
- package/dist/plugins/webgis/rules/no-touching-jsdoc.d.ts +1 -0
- package/dist/plugins/webgis/rules/no-touching-jsdoc.test.d.ts +1 -0
- package/dist/plugins/webgis/rules/require-js-in-core-import.d.ts +1 -0
- package/dist/plugins/webgis/rules/require-js-in-core-import.test.d.ts +1 -0
- package/dist/plugins/webgis/utils/creator.d.ts +3 -0
- package/package.json +37 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Licensing
|
|
2
|
+
|
|
3
|
+
COPYRIGHT © 2024 Esri
|
|
4
|
+
|
|
5
|
+
All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.
|
|
6
|
+
|
|
7
|
+
This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement. You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.
|
|
8
|
+
|
|
9
|
+
See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english
|
|
10
|
+
|
|
11
|
+
For additional information, contact: Environmental Systems Research Institute, Inc. Attn: Contracts and Legal Services Department 380 New York Street Redlands, California, USA 92373 USA
|
|
12
|
+
|
|
13
|
+
email: contracts@esri.com
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# ArcGIS Maps SDK for JavaScript - ESLint Config
|
|
2
|
+
|
|
3
|
+
**No Esri Technical Support included.**
|
|
4
|
+
|
|
5
|
+
Package that is part of the [ArcGIS Maps SDK for JavaScript](https://developers.arcgis.com/javascript).
|
|
6
|
+
|
|
7
|
+
It is not intended to be used directly, but rather used as a dependency by other packages in the SDK.
|
|
8
|
+
|
|
9
|
+
## License
|
|
10
|
+
|
|
11
|
+
COPYRIGHT © 2024 Esri
|
|
12
|
+
|
|
13
|
+
All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.
|
|
14
|
+
|
|
15
|
+
This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement. You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.
|
|
16
|
+
|
|
17
|
+
See use restrictions at <http://www.esri.com/legal/pdfs/mla_e204_e300/english>
|
|
18
|
+
|
|
19
|
+
For additional information, contact: Environmental Systems Research Institute, Inc. Attn: Contracts and Legal Services Department 380 New York Street Redlands, California, USA 92373 USA
|
|
20
|
+
|
|
21
|
+
email: contracts@esri.com
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
makeEslintPlugin
|
|
3
|
+
} from "./chunk-PNDNIABG.js";
|
|
4
|
+
|
|
5
|
+
// src/plugins/utils/helpers.ts
|
|
6
|
+
var isTestFile = (filePath) => filePath.includes("/test") || filePath.includes(".test") || filePath.includes(".spec") || filePath.includes("e2e") || filePath.includes("__") || filePath.includes("/.");
|
|
7
|
+
|
|
8
|
+
// src/plugins/webgis/utils/creator.ts
|
|
9
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
10
|
+
var createRule = ESLintUtils.RuleCreator(
|
|
11
|
+
(rule) => `https://devtopia.esri.com/WebGIS/arcgis-web-components/tree/main/packages/support-packages/eslint-config/src/plugins/webgis/rules/${rule}.ts`
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
// src/plugins/webgis/rules/no-import-outside-src.ts
|
|
15
|
+
import { resolve } from "path/posix";
|
|
16
|
+
var description = `Imports of files outside the src/ folder are not-portable and likely to break for consumers of this package.`;
|
|
17
|
+
var noImportOutsideSrc = createRule({
|
|
18
|
+
name: "no-import-outside-src",
|
|
19
|
+
meta: {
|
|
20
|
+
docs: {
|
|
21
|
+
description,
|
|
22
|
+
defaultLevel: "error"
|
|
23
|
+
},
|
|
24
|
+
messages: {
|
|
25
|
+
noImportOutsideSrc: description
|
|
26
|
+
},
|
|
27
|
+
type: "problem",
|
|
28
|
+
schema: []
|
|
29
|
+
},
|
|
30
|
+
defaultOptions: [],
|
|
31
|
+
create(context) {
|
|
32
|
+
const fileName = context.filename;
|
|
33
|
+
const srcIndex = fileName.indexOf("/src/");
|
|
34
|
+
if (srcIndex === -1) {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
const basePath = fileName.slice(0, srcIndex + "/src/".length);
|
|
38
|
+
if (isTestFile(fileName)) {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
ImportDeclaration(node) {
|
|
43
|
+
const specifier = node.source.value;
|
|
44
|
+
const isRelativeAncestor = specifier.startsWith("../");
|
|
45
|
+
if (!isRelativeAncestor) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const relativePath = resolve(fileName, "..", specifier);
|
|
49
|
+
if (!relativePath.startsWith(basePath) && !relativePath.endsWith(".json")) {
|
|
50
|
+
context.report({
|
|
51
|
+
messageId: "noImportOutsideSrc",
|
|
52
|
+
node: node.source
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// src/plugins/webgis/rules/no-touching-jsdoc.ts
|
|
61
|
+
var description2 = `Having two JSDoc comments next to each other is most likely a mistake - consider combining them into one, or separating them for clarity.`;
|
|
62
|
+
var noTouchingJsDoc = createRule({
|
|
63
|
+
name: "no-touching-jsdoc",
|
|
64
|
+
meta: {
|
|
65
|
+
docs: {
|
|
66
|
+
description: description2,
|
|
67
|
+
defaultLevel: "warn"
|
|
68
|
+
},
|
|
69
|
+
messages: {
|
|
70
|
+
noTouchingJsDoc: description2
|
|
71
|
+
},
|
|
72
|
+
type: "problem",
|
|
73
|
+
schema: []
|
|
74
|
+
},
|
|
75
|
+
defaultOptions: [],
|
|
76
|
+
create(context) {
|
|
77
|
+
return {
|
|
78
|
+
Program() {
|
|
79
|
+
Array.from(context.sourceCode.text.matchAll(reTouchingJsDoc), (match) => {
|
|
80
|
+
const previousJsDocStart = context.sourceCode.text.slice(0, match.index).lastIndexOf("/**");
|
|
81
|
+
if (previousJsDocStart === -1) {
|
|
82
|
+
return void 0;
|
|
83
|
+
}
|
|
84
|
+
const previousJsDocContent = context.sourceCode.text.slice(
|
|
85
|
+
previousJsDocStart + "/**".length,
|
|
86
|
+
match.index - "*/".length
|
|
87
|
+
);
|
|
88
|
+
const containsOtherComments = previousJsDocContent.includes("*/");
|
|
89
|
+
if (containsOtherComments) {
|
|
90
|
+
return void 0;
|
|
91
|
+
}
|
|
92
|
+
context.report({
|
|
93
|
+
messageId: "noTouchingJsDoc",
|
|
94
|
+
loc: {
|
|
95
|
+
start: context.sourceCode.getLocFromIndex(match.index),
|
|
96
|
+
end: context.sourceCode.getLocFromIndex(match.index + match[0].length)
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return void 0;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
var reTouchingJsDoc = /\*\/\s+\/\*\*/gu;
|
|
106
|
+
|
|
107
|
+
// src/plugins/webgis/rules/require-js-in-core-import.ts
|
|
108
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
109
|
+
var description3 = `@arcgis/core imports need to end with .js for better compatibility with @arcgis/core ESM CDN builds.`;
|
|
110
|
+
var requireJsInCoreImport = createRule({
|
|
111
|
+
name: "require-js-in-core-import",
|
|
112
|
+
meta: {
|
|
113
|
+
docs: {
|
|
114
|
+
description: description3,
|
|
115
|
+
defaultLevel: "warn"
|
|
116
|
+
},
|
|
117
|
+
messages: {
|
|
118
|
+
requireJsInCoreImport: description3
|
|
119
|
+
},
|
|
120
|
+
type: "problem",
|
|
121
|
+
fixable: "code",
|
|
122
|
+
schema: []
|
|
123
|
+
},
|
|
124
|
+
defaultOptions: [],
|
|
125
|
+
create(context) {
|
|
126
|
+
if (isTestFile(context.filename)) {
|
|
127
|
+
return {};
|
|
128
|
+
}
|
|
129
|
+
function updateSpecifier(node) {
|
|
130
|
+
if (node.source.type !== AST_NODE_TYPES.Literal || node.importKind === "type") {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const specifier = node.source.value;
|
|
134
|
+
if (typeof specifier !== "string" || !specifier.startsWith("@arcgis/core/") || // Already ends with .js or .json
|
|
135
|
+
specifier.includes(".")) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
context.report({
|
|
139
|
+
node: node.source,
|
|
140
|
+
messageId: "requireJsInCoreImport",
|
|
141
|
+
fix: (fixer) => fixer.replaceText(node.source, `"${specifier}.js"`)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
ImportDeclaration: updateSpecifier,
|
|
146
|
+
ImportExpression: updateSpecifier
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// src/plugins/webgis/index.ts
|
|
152
|
+
var webgis_default = makeEslintPlugin("webgis", {
|
|
153
|
+
"no-import-outside-src": noImportOutsideSrc,
|
|
154
|
+
"no-touching-jsdoc": noTouchingJsDoc,
|
|
155
|
+
"require-js-in-core-import": requireJsInCoreImport
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
webgis_default
|
|
160
|
+
};
|