@arcgis/eslint-config 4.33.0-next.15 → 4.33.0-next.151
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/applications.d.ts +5 -0
- package/dist/config/applications.js +40 -0
- package/dist/config/extra.js +2 -3
- package/dist/config/index.d.ts +2 -19
- package/dist/config/index.js +52 -123
- package/dist/config/lumina.d.ts +1 -5
- package/dist/config/lumina.js +17 -20
- package/dist/config/storybook.d.ts +1 -1
- package/dist/makePlugin-DjfiqX_o.js +38 -0
- package/dist/plugins/lumina/index.d.ts +1 -2
- package/dist/plugins/lumina/index.js +2242 -5
- 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 +3 -2
- package/dist/plugins/lumina/rules/ban-events.d.ts +6 -0
- 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/consistent-nullability.d.ts +2 -0
- package/dist/plugins/lumina/rules/decorators-context.d.ts +2 -1
- package/dist/plugins/lumina/rules/explicit-setter-type.d.ts +19 -0
- 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 +2 -1
- package/dist/plugins/lumina/rules/no-create-element-component.d.ts +2 -0
- 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 +3 -2
- 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 +3 -2
- 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/checker.d.ts +3 -1
- package/dist/plugins/lumina/utils/estree.d.ts +2 -1
- package/dist/plugins/lumina/utils/tags.d.ts +14 -0
- package/dist/plugins/utils/makePlugin.d.ts +12 -13
- package/dist/plugins/webgis/index.d.ts +1 -2
- package/dist/plugins/webgis/index.js +180 -5
- package/dist/plugins/webgis/plugin.d.ts +8 -0
- package/dist/plugins/webgis/rules/no-dts-files.d.ts +2 -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-imports.d.ts +2 -0
- package/package.json +9 -10
- package/dist/chunk-FZOJA343.js +0 -26
- package/dist/chunk-TFRPLMXN.js +0 -160
- package/dist/chunk-UTXDHVIY.js +0 -1975
- 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/lumina/utils/creator.d.ts +0 -3
- package/dist/plugins/utils/tests.d.ts +0 -26
- 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.d.ts +0 -1
- package/dist/plugins/webgis/rules/require-js-in-core-import.test.d.ts +0 -1
- package/dist/plugins/webgis/utils/creator.d.ts +0 -3
|
@@ -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
|
-
import { ESLintUtils } from
|
|
2
|
-
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
declare const _default: ESLintUtils.RuleModule<"addType" | "typeAnnotationMismatchesActualType" | "noEmptyPropertyObject" | "noUnnecessaryType" | "unhandledType", [], import('../../utils/makePlugin').CommonDocs, ESLintUtils.RuleListener>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type Options = (string | {
|
|
2
|
+
event: string;
|
|
3
|
+
message?: string;
|
|
4
|
+
})[];
|
|
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;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
/**
|
|
3
|
+
* @remarks
|
|
4
|
+
* It is easier to to do this in an ESLint rule rather than at build-time.
|
|
5
|
+
* Reason:
|
|
6
|
+
* - TypeScript does not have a syntax for retrieving the setter type
|
|
7
|
+
* (https://github.com/microsoft/TypeScript/issues/60162)
|
|
8
|
+
* - While we could copy the setter type from bound setter at build-time,
|
|
9
|
+
* copying types between files is tricky because of need for adding correct
|
|
10
|
+
* imports for anything referenced in that type and not already included in
|
|
11
|
+
* current file. Doing so in automated way is quite tricky, slow and
|
|
12
|
+
* error-prone.
|
|
13
|
+
*
|
|
14
|
+
* Instead, this rule will require developer to explicitly provide the setter
|
|
15
|
+
* type. Then we can use it as is in the .d.ts file. The getter type can be
|
|
16
|
+
* retrieved easily via `typeof` operator.
|
|
17
|
+
*/
|
|
18
|
+
declare const _default: ESLintUtils.RuleModule<"explicitSetterType" | "addExplicitSetterType", [], import('../../utils/makePlugin').CommonDocs, ESLintUtils.RuleListener>;
|
|
19
|
+
export default _default;
|
|
@@ -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,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<"noIgnoreJsDocTag", [], import('../../utils/makePlugin').CommonDocs, import('@typescript-eslint/utils/ts-eslint').RuleListener>;
|
|
2
|
+
export default _default;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { ESLintUtils } from
|
|
2
|
-
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
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
|
-
import { ESLintUtils } from
|
|
2
|
-
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
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;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import ts from
|
|
1
|
+
import { default as ts } from 'typescript';
|
|
2
2
|
export declare function isLuminaJsxType(type: ts.Type): boolean;
|
|
3
|
+
export declare const hasTypeFlag: (type: ts.Type, flag: ts.TypeFlags) => boolean;
|
|
4
|
+
export declare const literalTypeFlag: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
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
|
+
export declare const luminaTestEntrypointName = "@arcgis/lumina-compiler/testing";
|
|
4
5
|
export declare const luminaJsxExportName = "h";
|
|
5
6
|
type LuminaJsxCheck = (node: TSESTree.ImportDeclaration) => void;
|
|
6
7
|
export declare function checkForLuminaJsx(): LuminaJsxCheck & {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Although most native elements do not contain dashes inside, there are a
|
|
3
|
+
* few exceptions. Explicitly declaring a custom element by this name is
|
|
4
|
+
* forbidden
|
|
5
|
+
*
|
|
6
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define#valid_custom_element_names
|
|
7
|
+
*/
|
|
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,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
* @remarks
|
|
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 { TSESLint, ESLintUtils } from '@typescript-eslint/utils';
|
|
10
2
|
export type CommonDocs = {
|
|
11
3
|
description: string;
|
|
12
|
-
defaultLevel: "error" | "warn";
|
|
4
|
+
defaultLevel: "error" | "off" | "warn";
|
|
5
|
+
name: string;
|
|
13
6
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
+
};
|
|
17
16
|
};
|
|
18
17
|
};
|
|
@@ -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,7 +1,182 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "
|
|
4
|
-
|
|
1
|
+
import { m as makeEslintPlugin } from "../../makePlugin-DjfiqX_o.js";
|
|
2
|
+
import { resolve } from "node:path/posix";
|
|
3
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4
|
+
const plugin = makeEslintPlugin(
|
|
5
|
+
"webgis",
|
|
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 isTestFile = (filePath) => filePath.includes("/test") || filePath.includes(".test") || filePath.includes(".spec") || filePath.includes("e2e") || filePath.includes("__") || filePath.includes("/.");
|
|
9
|
+
const description$3 = `Imports of files outside the src/ folder are not-portable and likely to break for consumers of this package.`;
|
|
10
|
+
plugin.createRule({
|
|
11
|
+
name: "no-import-outside-src",
|
|
12
|
+
meta: {
|
|
13
|
+
docs: {
|
|
14
|
+
description: description$3,
|
|
15
|
+
defaultLevel: "error"
|
|
16
|
+
},
|
|
17
|
+
messages: {
|
|
18
|
+
noImportOutsideSrc: description$3
|
|
19
|
+
},
|
|
20
|
+
type: "problem",
|
|
21
|
+
schema: []
|
|
22
|
+
},
|
|
23
|
+
defaultOptions: [],
|
|
24
|
+
create(context) {
|
|
25
|
+
const fileName = context.filename;
|
|
26
|
+
const srcIndex = fileName.indexOf("/src/");
|
|
27
|
+
if (srcIndex === -1) {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
const basePath = fileName.slice(0, srcIndex + "/src/".length);
|
|
31
|
+
if (isTestFile(fileName)) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
ImportDeclaration(node) {
|
|
36
|
+
const specifier = node.source.value;
|
|
37
|
+
const isRelativeAncestor = specifier.startsWith("../");
|
|
38
|
+
if (!isRelativeAncestor) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const relativePath = resolve(fileName, "..", specifier);
|
|
42
|
+
if (!relativePath.startsWith(basePath) && !relativePath.endsWith(".json")) {
|
|
43
|
+
context.report({
|
|
44
|
+
messageId: "noImportOutsideSrc",
|
|
45
|
+
node: node.source
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const description$2 = `Having two JSDoc comments next to each other is most likely a mistake - consider combining them into one, or separating them for clarity.`;
|
|
53
|
+
plugin.createRule({
|
|
54
|
+
name: "no-touching-jsdoc",
|
|
55
|
+
meta: {
|
|
56
|
+
docs: {
|
|
57
|
+
description: description$2,
|
|
58
|
+
defaultLevel: "warn"
|
|
59
|
+
},
|
|
60
|
+
messages: {
|
|
61
|
+
noTouchingJsDoc: description$2
|
|
62
|
+
},
|
|
63
|
+
type: "problem",
|
|
64
|
+
schema: []
|
|
65
|
+
},
|
|
66
|
+
defaultOptions: [],
|
|
67
|
+
create(context) {
|
|
68
|
+
return {
|
|
69
|
+
Program() {
|
|
70
|
+
Array.from(context.sourceCode.text.matchAll(reTouchingJsDoc), (match) => {
|
|
71
|
+
const previousJsDocStart = context.sourceCode.text.slice(0, match.index).lastIndexOf("/**");
|
|
72
|
+
if (previousJsDocStart === -1) {
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
75
|
+
const previousJsDocContent = context.sourceCode.text.slice(
|
|
76
|
+
previousJsDocStart + "/**".length,
|
|
77
|
+
match.index - "*/".length
|
|
78
|
+
);
|
|
79
|
+
const containsOtherComments = previousJsDocContent.includes("*/");
|
|
80
|
+
if (containsOtherComments) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
context.report({
|
|
84
|
+
messageId: "noTouchingJsDoc",
|
|
85
|
+
loc: {
|
|
86
|
+
start: context.sourceCode.getLocFromIndex(match.index),
|
|
87
|
+
end: context.sourceCode.getLocFromIndex(match.index + match[0].length)
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return void 0;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const reTouchingJsDoc = /\*\/\s+\/\*\*/gu;
|
|
97
|
+
const description$1 = `@arcgis/core imports need to end with .js for better compatibility with ESM CDN builds for @arcgis/core and other packages.`;
|
|
98
|
+
const packagesToEnforce = ["@arcgis/core/", "@amcharts/amcharts4/", "@amcharts/amcharts5/"];
|
|
99
|
+
plugin.createRule({
|
|
100
|
+
name: "require-js-in-imports",
|
|
101
|
+
meta: {
|
|
102
|
+
docs: {
|
|
103
|
+
description: description$1,
|
|
104
|
+
defaultLevel: "warn"
|
|
105
|
+
},
|
|
106
|
+
messages: {
|
|
107
|
+
requireJsInCoreImport: description$1
|
|
108
|
+
},
|
|
109
|
+
type: "problem",
|
|
110
|
+
fixable: "code",
|
|
111
|
+
schema: []
|
|
112
|
+
},
|
|
113
|
+
defaultOptions: [],
|
|
114
|
+
create(context) {
|
|
115
|
+
if (isTestFile(context.filename)) {
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
function updateSpecifier(node) {
|
|
119
|
+
if (node.source.type !== AST_NODE_TYPES.Literal || node.importKind === "type") {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const specifier = node.source.value;
|
|
123
|
+
if (typeof specifier !== "string" || !packagesToEnforce.some((pkg) => specifier.startsWith(pkg)) || // Already ends with .js or .json
|
|
124
|
+
specifier.includes(".")) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
context.report({
|
|
128
|
+
node: node.source,
|
|
129
|
+
messageId: "requireJsInCoreImport",
|
|
130
|
+
fix: (fixer) => fixer.replaceText(node.source, `"${specifier}.js"`)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
ImportDeclaration: updateSpecifier,
|
|
135
|
+
ImportExpression: updateSpecifier
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const description = "Using .d.ts files is discouraged. Prefer .ts files instead, as they are type-checked and not in global scope.";
|
|
140
|
+
const allowedNames = /* @__PURE__ */ new Set(["vite-env.d.ts", "components.d.ts"]);
|
|
141
|
+
plugin.createRule({
|
|
142
|
+
name: "no-dts-files",
|
|
143
|
+
meta: {
|
|
144
|
+
docs: {
|
|
145
|
+
description,
|
|
146
|
+
defaultLevel: "warn"
|
|
147
|
+
},
|
|
148
|
+
messages: {
|
|
149
|
+
avoidDtsFiles: description
|
|
150
|
+
},
|
|
151
|
+
type: "suggestion",
|
|
152
|
+
schema: []
|
|
153
|
+
},
|
|
154
|
+
defaultOptions: [],
|
|
155
|
+
create(context) {
|
|
156
|
+
if (!context.filename.endsWith(".d.ts")) {
|
|
157
|
+
return {};
|
|
158
|
+
}
|
|
159
|
+
if (isTestFile(context.filename)) {
|
|
160
|
+
return {};
|
|
161
|
+
}
|
|
162
|
+
const lastSegment = context.filename.split("/").pop();
|
|
163
|
+
if (lastSegment !== void 0 && allowedNames.has(lastSegment)) {
|
|
164
|
+
return {};
|
|
165
|
+
}
|
|
166
|
+
if (context.sourceCode.text.includes("\ndeclare ") || context.sourceCode.text.startsWith("declare ") || context.sourceCode.text.includes("export declare ") || context.sourceCode.text.includes("/// <reference")) {
|
|
167
|
+
return {};
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
Program(node) {
|
|
171
|
+
context.report({
|
|
172
|
+
node,
|
|
173
|
+
messageId: "avoidDtsFiles"
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
const webgisPlugin = plugin.finalize();
|
|
5
180
|
export {
|
|
6
|
-
|
|
181
|
+
webgisPlugin
|
|
7
182
|
};
|
|
@@ -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;
|
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.151",
|
|
4
4
|
"description": "ESLint configuration for arcgis-web-components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./dist/config/index.js",
|
|
11
|
+
"./application": "./dist/config/applications.js",
|
|
11
12
|
"./extra": "./dist/config/extra.js",
|
|
12
13
|
"./lumina": "./dist/config/lumina.js",
|
|
13
14
|
"./plugins/webgis": "./dist/plugins/webgis/index.js",
|
|
@@ -19,19 +20,17 @@
|
|
|
19
20
|
],
|
|
20
21
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@arcgis/components-utils": "4.33.0-next.
|
|
23
|
-
"@eslint/js": "^9.
|
|
23
|
+
"@arcgis/components-utils": "4.33.0-next.151",
|
|
24
|
+
"@eslint/js": "^9.23.0",
|
|
24
25
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
25
26
|
"confusing-browser-globals": "^1.0.11",
|
|
26
|
-
"eslint-plugin-
|
|
27
|
-
"eslint-plugin-storybook": "^0.11.1",
|
|
27
|
+
"eslint-plugin-storybook": "^0.12.0",
|
|
28
28
|
"globals": "^15.12.0",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"typescript": "
|
|
32
|
-
"typescript-eslint": "^8.18.1"
|
|
29
|
+
"tslib": "^2.8.1",
|
|
30
|
+
"typescript": "~5.8.3",
|
|
31
|
+
"typescript-eslint": "^8.28.0"
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
35
|
-
"eslint": "^9.
|
|
34
|
+
"eslint": "^9.23.0"
|
|
36
35
|
}
|
|
37
36
|
}
|
package/dist/chunk-FZOJA343.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// package.json
|
|
2
|
-
var version = "4.33.0-next.15";
|
|
3
|
-
|
|
4
|
-
// src/plugins/utils/makePlugin.ts
|
|
5
|
-
function makeEslintPlugin(pluginName, rules) {
|
|
6
|
-
const config = {
|
|
7
|
-
rules: Object.fromEntries(
|
|
8
|
-
Object.entries(rules).map(([name, rule]) => [`${pluginName}/${name}`, rule.meta.docs.defaultLevel])
|
|
9
|
-
)
|
|
10
|
-
};
|
|
11
|
-
const plugin = {
|
|
12
|
-
meta: { name: "@arcgis/eslint-plugin-webgis", version },
|
|
13
|
-
configs: {
|
|
14
|
-
recommended: config
|
|
15
|
-
},
|
|
16
|
-
rules
|
|
17
|
-
};
|
|
18
|
-
config.plugins = {
|
|
19
|
-
[pluginName]: plugin
|
|
20
|
-
};
|
|
21
|
-
return plugin;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
makeEslintPlugin
|
|
26
|
-
};
|