@arcgis/eslint-config 5.2.0-next.59 → 5.2.0-next.60

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,5 +1,5 @@
1
1
  import { ESLintUtils } from "@typescript-eslint/utils";
2
- const version = "5.2.0-next.59";
2
+ const version = "5.2.0-next.60";
3
3
  const packageJson = {
4
4
  version
5
5
  };
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin } from "../../makePlugin-bHvUvBdT.js";
1
+ import { m as makeEslintPlugin } from "../../makePlugin-MXVxg4Ss.js";
2
2
  import { AST_NODE_TYPES, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
3
3
  import { generateDifferences, showInvisibles } from "prettier-linter-helpers";
4
4
  import path, { relative, win32, posix, normalize } from "path";
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin } from "../../makePlugin-bHvUvBdT.js";
1
+ import { m as makeEslintPlugin } from "../../makePlugin-MXVxg4Ss.js";
2
2
  import { AST_NODE_TYPES, ESLintUtils, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
3
3
  import { l as luminaJsxExportName, a as luminaEntrypointName, b as luminaTestEntrypointName, s as sourceCodeDeclaresComponent, p as parsePropertyDecorator, c as getProperty, i as isGetterWithoutSetter, e as extractDeclareElementsInterface, d as isCreateEvent, h as hasDecorator, f as getName, j as checkForLuminaJsx, k as isBindThisCallee, g as getComponentDeclaration, u as unwrapExpression } from "../../estree-CDc-die8.js";
4
4
  import ts from "typescript";
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin } from "../../makePlugin-bHvUvBdT.js";
1
+ import { m as makeEslintPlugin } from "../../makePlugin-MXVxg4Ss.js";
2
2
  import { TSESTree, AST_TOKEN_TYPES, AST_NODE_TYPES, TSESLint } from "@typescript-eslint/utils";
3
3
  import path from "node:path";
4
4
  import { resolve } from "path/posix";
@@ -1056,6 +1056,63 @@ plugin.createRule({
1056
1056
  };
1057
1057
  }
1058
1058
  });
1059
+ plugin.createRule({
1060
+ name: "require-ts-in-imports",
1061
+ meta: {
1062
+ docs: {
1063
+ description: "Require configured packages to be imported through their TypeScript source entrypoints when built output may be unavailable.",
1064
+ defaultLevel: "off",
1065
+ isTypeChecked: false
1066
+ },
1067
+ messages: {
1068
+ requireTsInImports: "Import '{{specifier}}' through its '/ts' source entrypoint because built output for '{{packageName}}' may not yet be available when current package is invoked."
1069
+ },
1070
+ type: "problem",
1071
+ schema: [
1072
+ {
1073
+ type: "array",
1074
+ items: { type: "string" },
1075
+ uniqueItems: true
1076
+ }
1077
+ ]
1078
+ },
1079
+ defaultOptions: [[]],
1080
+ create(context) {
1081
+ const packageNames = context.options[0];
1082
+ function checkSpecifier(node) {
1083
+ const specifier = node.value;
1084
+ const packageName = packageNames.find(
1085
+ (candidate) => specifier === candidate || specifier.startsWith(`${candidate}/`)
1086
+ );
1087
+ if (packageName === void 0 || specifier === `${packageName}/package.json` || specifier.endsWith("/ts")) {
1088
+ return;
1089
+ }
1090
+ context.report({
1091
+ node,
1092
+ messageId: "requireTsInImports",
1093
+ data: { packageName, specifier }
1094
+ });
1095
+ }
1096
+ return {
1097
+ ImportDeclaration(node) {
1098
+ checkSpecifier(node.source);
1099
+ },
1100
+ ImportExpression(node) {
1101
+ if (node.source.type === AST_NODE_TYPES.Literal && typeof node.source.value === "string") {
1102
+ checkSpecifier(node.source);
1103
+ }
1104
+ },
1105
+ ExportAllDeclaration(node) {
1106
+ checkSpecifier(node.source);
1107
+ },
1108
+ ExportNamedDeclaration(node) {
1109
+ if (node.source) {
1110
+ checkSpecifier(node.source);
1111
+ }
1112
+ }
1113
+ };
1114
+ }
1115
+ });
1059
1116
  const webgisPlugin = plugin.finalize();
1060
1117
  export {
1061
1118
  webgisPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/eslint-config",
3
- "version": "5.2.0-next.59",
3
+ "version": "5.2.0-next.60",
4
4
  "description": "ESLint configuration for WebGIS SDK",
5
5
  "type": "module",
6
6
  "exports": {
@@ -41,7 +41,7 @@
41
41
  "tslib": "^2.8.1",
42
42
  "typescript": "~6.0.3",
43
43
  "typescript-eslint": "^8.63.0",
44
- "@arcgis/toolkit": "5.2.0-next.59"
44
+ "@arcgis/toolkit": "5.2.0-next.60"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "eslint": "^10.6.0"