@arcgis/eslint-config 4.33.0-next.61 → 4.33.0-next.63
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/extra.js +2 -3
- package/dist/config/index.d.ts +1 -18
- package/dist/config/index.js +4 -9
- package/dist/config/lumina.d.ts +1 -5
- package/dist/config/lumina.js +6 -13
- package/dist/config/storybook.d.ts +1 -1
- package/dist/{chunk-XL2W5WPA.js → makePlugin-BttlhEW-.js} +2 -6
- package/dist/plugins/lumina/index.js +1855 -5
- package/dist/plugins/lumina/rules/add-missing-jsx-import.d.ts +1 -1
- package/dist/plugins/lumina/rules/auto-add-type.d.ts +2 -2
- package/dist/plugins/lumina/rules/component-placement-rules.d.ts +1 -1
- package/dist/plugins/lumina/rules/consistent-event-naming.d.ts +1 -1
- package/dist/plugins/lumina/rules/decorators-context.d.ts +1 -1
- package/dist/plugins/lumina/rules/member-ordering/build.d.ts +3 -3
- package/dist/plugins/lumina/rules/member-ordering/comments.d.ts +2 -2
- package/dist/plugins/lumina/rules/member-ordering/config.d.ts +1 -1
- package/dist/plugins/lumina/rules/member-ordering/normalize.d.ts +2 -2
- package/dist/plugins/lumina/rules/member-ordering.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-ignore-jsdoc-tag.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-incorrect-dynamic-tag-name.d.ts +2 -2
- package/dist/plugins/lumina/rules/no-inline-arrow-in-ref.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-invalid-directives-prop.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-jsx-spread.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-listen-in-connected-callback.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-non-component-exports.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-property-name-start-with-on.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-render-false.d.ts +2 -2
- package/dist/plugins/lumina/rules/no-unnecessary-attribute-name.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-unnecessary-bind-this.d.ts +1 -1
- package/dist/plugins/lumina/rules/no-unnecessary-key.d.ts +1 -1
- package/dist/plugins/lumina/rules/tag-name-rules.d.ts +1 -1
- package/dist/plugins/lumina/utils/checker.d.ts +1 -1
- package/dist/plugins/lumina/utils/creator.d.ts +2 -2
- package/dist/plugins/lumina/utils/estree.d.ts +1 -1
- package/dist/plugins/utils/makePlugin.d.ts +2 -9
- package/dist/plugins/utils/tests.d.ts +1 -1
- package/dist/plugins/webgis/index.js +142 -5
- package/dist/plugins/webgis/rules/no-import-outside-src.d.ts +1 -1
- package/dist/plugins/webgis/rules/no-touching-jsdoc.d.ts +1 -1
- package/dist/plugins/webgis/rules/require-js-in-core-import.d.ts +1 -1
- package/dist/plugins/webgis/utils/creator.d.ts +2 -2
- package/package.json +2 -2
- package/dist/chunk-2YLP4Q2L.js +0 -160
- package/dist/chunk-4ICYLGON.js +0 -1978
- package/dist/plugins/lumina/rules/add-missing-jsx-import.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/auto-add-type.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/component-placement-rules.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/consistent-event-naming.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/decorators-context.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/member-ordering.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-ignore-jsdoc-tag.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-incorrect-dynamic-tag-name.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-inline-arrow-in-ref.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-invalid-directives-prop.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-jsx-spread.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-listen-in-connected-callback.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-non-component-exports.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-property-name-start-with-on.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-render-false.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-unnecessary-attribute-name.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-unnecessary-bind-this.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-unnecessary-key.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/tag-name-rules.spec.d.ts +0 -1
- package/dist/plugins/webgis/rules/no-import-outside-src.test.d.ts +0 -1
- package/dist/plugins/webgis/rules/no-touching-jsdoc.test.d.ts +0 -1
- package/dist/plugins/webgis/rules/require-js-in-core-import.test.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const addMissingJsxImport: import(
|
|
1
|
+
export declare const addMissingJsxImport: import('@typescript-eslint/utils/ts-eslint').RuleModule<"addMissingJsxImport", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ESLintUtils } from
|
|
2
|
-
export declare const autoAddType: ESLintUtils.RuleModule<"addType" | "typeAnnotationMismatchesActualType" | "noEmptyPropertyObject" | "noUnnecessaryType" | "unhandledType", [], import(
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
export declare const autoAddType: ESLintUtils.RuleModule<"addType" | "typeAnnotationMismatchesActualType" | "noEmptyPropertyObject" | "noUnnecessaryType" | "unhandledType", [], import('../../utils/makePlugin').CommonDocs, ESLintUtils.RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const componentPlacementRules: import(
|
|
1
|
+
export declare const componentPlacementRules: import('@typescript-eslint/utils/ts-eslint').RuleModule<"fileFolderNameMismatch" | "extensionNotTsx" | "noComponentOutsideSrcComponents", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -11,5 +11,5 @@ type Options = [
|
|
|
11
11
|
}
|
|
12
12
|
];
|
|
13
13
|
type Messages = "componentNameInEventError" | "eventNamespaceError" | "missingPrivateJsDocTag" | "noComponentNameInEventError";
|
|
14
|
-
export declare const consistentEventNaming: import(
|
|
14
|
+
export declare const consistentEventNaming: import('@typescript-eslint/utils/ts-eslint').RuleModule<Messages, Options, import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
15
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const decoratorsContext: import(
|
|
1
|
+
export declare const decoratorsContext: import('@typescript-eslint/utils/ts-eslint').RuleModule<"publicApiMustBePublic" | "noPropertyDecoratorOnMethods" | "noCombinedPropertyEvent" | "noCombinedPropertyState" | "noComputedName", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { StrayComments } from './comments';
|
|
2
|
+
import { NormalizedRegions } from './normalize';
|
|
3
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
4
4
|
export declare function buildNewBody(normalizedRegions: NormalizedRegions, strayComments: Omit<StrayComments, "membersByName">, sourceCode: TSESLint.SourceCode): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
import { MemberData } from './config';
|
|
3
3
|
export type StrayComments = {
|
|
4
4
|
header: TSESTree.Comment[];
|
|
5
5
|
regionFooter: Map<string, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { StrayComments } from './comments';
|
|
2
|
+
import { MemberData, RegionName } from './config';
|
|
3
3
|
export type NormalizedRegions = readonly (readonly [RegionName, MemberData[]])[];
|
|
4
4
|
export declare function getNormalizedRegions(membersByName: StrayComments["membersByName"]): NormalizedRegions;
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const memberOrdering: import(
|
|
1
|
+
export declare const memberOrdering: import('@typescript-eslint/utils/ts-eslint').RuleModule<"memberOrdering" | "unsupportedElementType", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noIgnoreJsDocTag: import(
|
|
1
|
+
export declare const noIgnoreJsDocTag: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noIgnoreJsDocTag", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ESLintUtils } from
|
|
2
|
-
export declare const noIncorrectDynamicTagName: ESLintUtils.RuleModule<"incorrectDynamicTagName", [], import(
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
export declare const noIncorrectDynamicTagName: ESLintUtils.RuleModule<"incorrectDynamicTagName", [], import('../../utils/makePlugin').CommonDocs, ESLintUtils.RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noInlineArrowInRef: import(
|
|
1
|
+
export declare const noInlineArrowInRef: import('@typescript-eslint/utils/ts-eslint').RuleModule<"errorInlineArrow", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noInvalidDirectivesProp: import(
|
|
1
|
+
export declare const noInvalidDirectivesProp: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noInvalidDirectivesProp", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noJsxSpread: import(
|
|
1
|
+
export declare const noJsxSpread: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noJsxSpread", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noListenInConnectedCallback: import(
|
|
1
|
+
export declare const noListenInConnectedCallback: import('@typescript-eslint/utils/ts-eslint').RuleModule<"errorListenInConnectedCallback", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noNonComponentExports: import(
|
|
1
|
+
export declare const noNonComponentExports: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noNonComponentExports" | "noDefaultExports" | "noExportAll", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noPropertyNameStartWithOn: import(
|
|
1
|
+
export declare const noPropertyNameStartWithOn: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noPropertyNameStartWithOn", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ESLintUtils } from
|
|
2
|
-
export declare const noRenderFalse: ESLintUtils.RuleModule<"errorFalseRendered", [], import(
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
export declare const noRenderFalse: ESLintUtils.RuleModule<"errorFalseRendered", [], import('../../utils/makePlugin').CommonDocs, ESLintUtils.RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noUnnecessaryAttributeName: import(
|
|
1
|
+
export declare const noUnnecessaryAttributeName: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noUnnecessaryAttributeName", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noUnnecessaryBindThis: import(
|
|
1
|
+
export declare const noUnnecessaryBindThis: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noUnnecessaryBindThis", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noUnnecessaryKey: import(
|
|
1
|
+
export declare const noUnnecessaryKey: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noUnnecessaryKey", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -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
|
-
export declare const tagNameRules: import(
|
|
7
|
+
export declare const tagNameRules: import('@typescript-eslint/utils/ts-eslint').RuleModule<Messages, Options, import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
8
8
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import ts from
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
2
|
export declare function isLuminaJsxType(type: ts.Type): boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ESLintUtils } from
|
|
2
|
-
import
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import { CommonDocs } from '../../utils/makePlugin';
|
|
3
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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TSESTree } from '@typescript-eslint/utils';
|
|
2
2
|
export declare const unwrapExpression: <T extends TSESTree.Node>(expression: T) => T | TSESTree.Expression;
|
|
3
3
|
export declare const luminaEntrypointName = "@arcgis/lumina";
|
|
4
4
|
export declare const luminaTestEntrypointName = "@arcgis/lumina-compiler/testing";
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Not using eslint-plugin-eslint-plugin as most rules there are not applicable
|
|
4
|
-
* when using TypeScript. Sad that ESLint ecosystem doesn't have a strong
|
|
5
|
-
* TypeScript culture. Some other rules are not applicable since we are using
|
|
6
|
-
* typescript-eslint.
|
|
7
|
-
*/
|
|
8
|
-
import type { RuleModule } from "@typescript-eslint/utils/ts-eslint";
|
|
9
|
-
import type { TSESLint } from "@typescript-eslint/utils";
|
|
1
|
+
import { RuleModule } from '@typescript-eslint/utils/ts-eslint';
|
|
2
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
10
3
|
export type CommonDocs = {
|
|
11
4
|
description: string;
|
|
12
5
|
defaultLevel: "error" | "warn";
|
|
@@ -1,7 +1,144 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
|
|
1
|
+
import { m as makeEslintPlugin } from "../../makePlugin-BttlhEW-.js";
|
|
2
|
+
import { ESLintUtils, AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
3
|
+
import { resolve } from "node:path/posix";
|
|
4
|
+
const isTestFile = (filePath) => filePath.includes("/test") || filePath.includes(".test") || filePath.includes(".spec") || filePath.includes("e2e") || filePath.includes("__") || filePath.includes("/.");
|
|
5
|
+
const createRule = ESLintUtils.RuleCreator(
|
|
6
|
+
(rule) => `https://devtopia.esri.com/WebGIS/arcgis-web-components/tree/main/packages/support-packages/eslint-config/src/plugins/webgis/rules/${rule}.ts`
|
|
7
|
+
);
|
|
8
|
+
const description$2 = `Imports of files outside the src/ folder are not-portable and likely to break for consumers of this package.`;
|
|
9
|
+
const noImportOutsideSrc = createRule({
|
|
10
|
+
name: "no-import-outside-src",
|
|
11
|
+
meta: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: description$2,
|
|
14
|
+
defaultLevel: "error"
|
|
15
|
+
},
|
|
16
|
+
messages: {
|
|
17
|
+
noImportOutsideSrc: description$2
|
|
18
|
+
},
|
|
19
|
+
type: "problem",
|
|
20
|
+
schema: []
|
|
21
|
+
},
|
|
22
|
+
defaultOptions: [],
|
|
23
|
+
create(context) {
|
|
24
|
+
const fileName = context.filename;
|
|
25
|
+
const srcIndex = fileName.indexOf("/src/");
|
|
26
|
+
if (srcIndex === -1) {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
const basePath = fileName.slice(0, srcIndex + "/src/".length);
|
|
30
|
+
if (isTestFile(fileName)) {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
ImportDeclaration(node) {
|
|
35
|
+
const specifier = node.source.value;
|
|
36
|
+
const isRelativeAncestor = specifier.startsWith("../");
|
|
37
|
+
if (!isRelativeAncestor) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const relativePath = resolve(fileName, "..", specifier);
|
|
41
|
+
if (!relativePath.startsWith(basePath) && !relativePath.endsWith(".json")) {
|
|
42
|
+
context.report({
|
|
43
|
+
messageId: "noImportOutsideSrc",
|
|
44
|
+
node: node.source
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
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
|
+
const noTouchingJsDoc = createRule({
|
|
53
|
+
name: "no-touching-jsdoc",
|
|
54
|
+
meta: {
|
|
55
|
+
docs: {
|
|
56
|
+
description: description$1,
|
|
57
|
+
defaultLevel: "warn"
|
|
58
|
+
},
|
|
59
|
+
messages: {
|
|
60
|
+
noTouchingJsDoc: description$1
|
|
61
|
+
},
|
|
62
|
+
type: "problem",
|
|
63
|
+
schema: []
|
|
64
|
+
},
|
|
65
|
+
defaultOptions: [],
|
|
66
|
+
create(context) {
|
|
67
|
+
return {
|
|
68
|
+
Program() {
|
|
69
|
+
Array.from(context.sourceCode.text.matchAll(reTouchingJsDoc), (match) => {
|
|
70
|
+
const previousJsDocStart = context.sourceCode.text.slice(0, match.index).lastIndexOf("/**");
|
|
71
|
+
if (previousJsDocStart === -1) {
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
const previousJsDocContent = context.sourceCode.text.slice(
|
|
75
|
+
previousJsDocStart + "/**".length,
|
|
76
|
+
match.index - "*/".length
|
|
77
|
+
);
|
|
78
|
+
const containsOtherComments = previousJsDocContent.includes("*/");
|
|
79
|
+
if (containsOtherComments) {
|
|
80
|
+
return void 0;
|
|
81
|
+
}
|
|
82
|
+
context.report({
|
|
83
|
+
messageId: "noTouchingJsDoc",
|
|
84
|
+
loc: {
|
|
85
|
+
start: context.sourceCode.getLocFromIndex(match.index),
|
|
86
|
+
end: context.sourceCode.getLocFromIndex(match.index + match[0].length)
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return void 0;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const reTouchingJsDoc = /\*\/\s+\/\*\*/gu;
|
|
96
|
+
const description = `@arcgis/core imports need to end with .js for better compatibility with @arcgis/core ESM CDN builds.`;
|
|
97
|
+
const requireJsInCoreImport = createRule({
|
|
98
|
+
name: "require-js-in-core-import",
|
|
99
|
+
meta: {
|
|
100
|
+
docs: {
|
|
101
|
+
description,
|
|
102
|
+
defaultLevel: "warn"
|
|
103
|
+
},
|
|
104
|
+
messages: {
|
|
105
|
+
requireJsInCoreImport: description
|
|
106
|
+
},
|
|
107
|
+
type: "problem",
|
|
108
|
+
fixable: "code",
|
|
109
|
+
schema: []
|
|
110
|
+
},
|
|
111
|
+
defaultOptions: [],
|
|
112
|
+
create(context) {
|
|
113
|
+
if (isTestFile(context.filename)) {
|
|
114
|
+
return {};
|
|
115
|
+
}
|
|
116
|
+
function updateSpecifier(node) {
|
|
117
|
+
if (node.source.type !== AST_NODE_TYPES.Literal || node.importKind === "type") {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const specifier = node.source.value;
|
|
121
|
+
if (typeof specifier !== "string" || !specifier.startsWith("@arcgis/core/") || // Already ends with .js or .json
|
|
122
|
+
specifier.includes(".")) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
context.report({
|
|
126
|
+
node: node.source,
|
|
127
|
+
messageId: "requireJsInCoreImport",
|
|
128
|
+
fix: (fixer) => fixer.replaceText(node.source, `"${specifier}.js"`)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
ImportDeclaration: updateSpecifier,
|
|
133
|
+
ImportExpression: updateSpecifier
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
const webgisPlugin = makeEslintPlugin("webgis", {
|
|
138
|
+
"no-import-outside-src": noImportOutsideSrc,
|
|
139
|
+
"no-touching-jsdoc": noTouchingJsDoc,
|
|
140
|
+
"require-js-in-core-import": requireJsInCoreImport
|
|
141
|
+
});
|
|
5
142
|
export {
|
|
6
|
-
|
|
143
|
+
webgisPlugin as default
|
|
7
144
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noImportOutsideSrc: import(
|
|
1
|
+
export declare const noImportOutsideSrc: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noImportOutsideSrc", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noTouchingJsDoc: import(
|
|
1
|
+
export declare const noTouchingJsDoc: import('@typescript-eslint/utils/ts-eslint').RuleModule<"noTouchingJsDoc", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const requireJsInCoreImport: import(
|
|
1
|
+
export declare const requireJsInCoreImport: import('@typescript-eslint/utils/ts-eslint').RuleModule<"requireJsInCoreImport", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ESLintUtils } from
|
|
2
|
-
import
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import { CommonDocs } from '../../utils/makePlugin';
|
|
3
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>;
|
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.63",
|
|
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.63",
|
|
23
23
|
"@eslint/js": "^9.17.0",
|
|
24
24
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
25
25
|
"confusing-browser-globals": "^1.0.11",
|
package/dist/chunk-2YLP4Q2L.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
makeEslintPlugin
|
|
3
|
-
} from "./chunk-XL2W5WPA.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
|
-
};
|