@arcgis/eslint-config 4.33.0-next.97 → 4.33.0-next.99

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 = "4.33.0-next.97";
2
+ const version = "4.33.0-next.99";
3
3
  function makeEslintPlugin(pluginName, urlCreator) {
4
4
  const rules = [];
5
5
  const creator = ESLintUtils.RuleCreator(urlCreator);
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin } from "../../makePlugin-B-FfUnYf.js";
1
+ import { m as makeEslintPlugin } from "../../makePlugin-DjYsAJ7j.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/components-utils";
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin } from "../../makePlugin-B-FfUnYf.js";
1
+ import { m as makeEslintPlugin } from "../../makePlugin-DjYsAJ7j.js";
2
2
  import { resolve } from "node:path/posix";
3
3
  import { AST_NODE_TYPES } from "@typescript-eslint/utils";
4
4
  const plugin = makeEslintPlugin(
@@ -6,16 +6,16 @@ const plugin = makeEslintPlugin(
6
6
  (rule) => `https://devtopia.esri.com/WebGIS/arcgis-web-components/tree/main/packages/support-packages/eslint-config/src/plugins/webgis/rules/${rule}.ts`
7
7
  );
8
8
  const isTestFile = (filePath) => filePath.includes("/test") || filePath.includes(".test") || filePath.includes(".spec") || filePath.includes("e2e") || filePath.includes("__") || filePath.includes("/.");
9
- const description$2 = `Imports of files outside the src/ folder are not-portable and likely to break for consumers of this package.`;
9
+ const description$3 = `Imports of files outside the src/ folder are not-portable and likely to break for consumers of this package.`;
10
10
  plugin.createRule({
11
11
  name: "no-import-outside-src",
12
12
  meta: {
13
13
  docs: {
14
- description: description$2,
14
+ description: description$3,
15
15
  defaultLevel: "error"
16
16
  },
17
17
  messages: {
18
- noImportOutsideSrc: description$2
18
+ noImportOutsideSrc: description$3
19
19
  },
20
20
  type: "problem",
21
21
  schema: []
@@ -49,16 +49,16 @@ plugin.createRule({
49
49
  };
50
50
  }
51
51
  });
52
- 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 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
53
  plugin.createRule({
54
54
  name: "no-touching-jsdoc",
55
55
  meta: {
56
56
  docs: {
57
- description: description$1,
57
+ description: description$2,
58
58
  defaultLevel: "warn"
59
59
  },
60
60
  messages: {
61
- noTouchingJsDoc: description$1
61
+ noTouchingJsDoc: description$2
62
62
  },
63
63
  type: "problem",
64
64
  schema: []
@@ -94,16 +94,16 @@ plugin.createRule({
94
94
  }
95
95
  });
96
96
  const reTouchingJsDoc = /\*\/\s+\/\*\*/gu;
97
- const description = `@arcgis/core imports need to end with .js for better compatibility with @arcgis/core ESM CDN builds.`;
97
+ const description$1 = `@arcgis/core imports need to end with .js for better compatibility with @arcgis/core ESM CDN builds.`;
98
98
  plugin.createRule({
99
99
  name: "require-js-in-core-import",
100
100
  meta: {
101
101
  docs: {
102
- description,
102
+ description: description$1,
103
103
  defaultLevel: "warn"
104
104
  },
105
105
  messages: {
106
- requireJsInCoreImport: description
106
+ requireJsInCoreImport: description$1
107
107
  },
108
108
  type: "problem",
109
109
  fixable: "code",
@@ -135,6 +135,46 @@ plugin.createRule({
135
135
  };
136
136
  }
137
137
  });
138
+ const description = "Using .d.ts files is discouraged. Prefer .ts files instead, as they are type-checked and not in global scope.";
139
+ const allowedNames = /* @__PURE__ */ new Set(["vite-env.d.ts", "component.d.ts"]);
140
+ plugin.createRule({
141
+ name: "no-dts-files",
142
+ meta: {
143
+ docs: {
144
+ description,
145
+ defaultLevel: "warn"
146
+ },
147
+ messages: {
148
+ avoidDtsFiles: description
149
+ },
150
+ type: "suggestion",
151
+ schema: []
152
+ },
153
+ defaultOptions: [],
154
+ create(context) {
155
+ if (!context.filename.endsWith(".d.ts")) {
156
+ return {};
157
+ }
158
+ if (isTestFile(context.filename)) {
159
+ return {};
160
+ }
161
+ const lastSegment = context.filename.split("/").pop();
162
+ if (lastSegment !== void 0 && allowedNames.has(lastSegment)) {
163
+ return {};
164
+ }
165
+ if (context.sourceCode.text.includes("\ndeclare ") || context.sourceCode.text.startsWith("declare ") || context.sourceCode.text.includes("export declare ") || context.sourceCode.text.includes("/// <reference")) {
166
+ return {};
167
+ }
168
+ return {
169
+ Program(node) {
170
+ context.report({
171
+ node,
172
+ messageId: "avoidDtsFiles"
173
+ });
174
+ }
175
+ };
176
+ }
177
+ });
138
178
  const webgisPlugin = plugin.finalize();
139
179
  export {
140
180
  webgisPlugin
@@ -0,0 +1,2 @@
1
+ declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"avoidDtsFiles", [], 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.97",
3
+ "version": "4.33.0-next.99",
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.97",
22
+ "@arcgis/components-utils": "4.33.0-next.99",
23
23
  "@eslint/js": "^9.17.0",
24
24
  "@types/confusing-browser-globals": "^1.0.3",
25
25
  "confusing-browser-globals": "^1.0.11",