@arcgis/eslint-config 5.0.0-next.83 → 5.0.0-next.85

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.
@@ -406,7 +406,7 @@ const defaultConfig = [
406
406
  }
407
407
  ],
408
408
  "@typescript-eslint/consistent-type-exports": ["warn", { fixMixedExportsWithInlineTypeSpecifier: true }],
409
- "@typescript-eslint/consistent-type-imports": "warn",
409
+ "@typescript-eslint/no-import-type-side-effects": "error",
410
410
  "default-param-last": "off",
411
411
  // `undefined` can also be used to trigger default value
412
412
  "@typescript-eslint/default-param-last": "off",
@@ -1,5 +1,5 @@
1
1
  import { ESLintUtils } from "@typescript-eslint/utils";
2
- const version = "5.0.0-next.83";
2
+ const version = "5.0.0-next.85";
3
3
  const packageJson = {
4
4
  version
5
5
  };
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin } from "../../makePlugin-TkMfopVQ.js";
1
+ import { m as makeEslintPlugin } from "../../makePlugin-D3i7HhLW.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/toolkit/string";
@@ -1,4 +1,4 @@
1
- import { m as makeEslintPlugin } from "../../makePlugin-TkMfopVQ.js";
1
+ import { m as makeEslintPlugin } from "../../makePlugin-D3i7HhLW.js";
2
2
  import { resolve } from "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$3 = `Imports of files outside the src/ folder are not-portable and likely to break for consumers of this package.`;
9
+ const description$4 = `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$3,
14
+ description: description$4,
15
15
  defaultLevel: "error"
16
16
  },
17
17
  messages: {
18
- noImportOutsideSrc: description$3
18
+ noImportOutsideSrc: description$4
19
19
  },
20
20
  type: "problem",
21
21
  schema: []
@@ -49,16 +49,16 @@ plugin.createRule({
49
49
  };
50
50
  }
51
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.`;
52
+ const description$3 = `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$2,
57
+ description: description$3,
58
58
  defaultLevel: "warn"
59
59
  },
60
60
  messages: {
61
- noTouchingJsDoc: description$2
61
+ noTouchingJsDoc: description$3
62
62
  },
63
63
  type: "problem",
64
64
  schema: []
@@ -94,17 +94,17 @@ plugin.createRule({
94
94
  }
95
95
  });
96
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.`;
97
+ const description$2 = `@arcgis/core imports need to end with .js for better compatibility with ESM CDN builds for @arcgis/core and other packages.`;
98
98
  const packagesToEnforce = ["@arcgis/core/", "@amcharts/amcharts4/", "@amcharts/amcharts5/"];
99
99
  plugin.createRule({
100
100
  name: "require-js-in-imports",
101
101
  meta: {
102
102
  docs: {
103
- description: description$1,
103
+ description: description$2,
104
104
  defaultLevel: "warn"
105
105
  },
106
106
  messages: {
107
- requireJsInCoreImport: description$1
107
+ requireJsInCoreImport: description$2
108
108
  },
109
109
  type: "problem",
110
110
  fixable: "code",
@@ -138,17 +138,17 @@ plugin.createRule({
138
138
  };
139
139
  }
140
140
  });
141
- const description = "Using .d.ts files is discouraged. Prefer .ts files instead, as they are type-checked and not in global scope.";
141
+ const description$1 = "Using .d.ts files is discouraged. Prefer .ts files instead, as they are type-checked and not in global scope.";
142
142
  const allowedNames = /* @__PURE__ */ new Set(["vite-env.d.ts", "components.d.ts"]);
143
143
  plugin.createRule({
144
144
  name: "no-dts-files",
145
145
  meta: {
146
146
  docs: {
147
- description,
147
+ description: description$1,
148
148
  defaultLevel: "warn"
149
149
  },
150
150
  messages: {
151
- avoidDtsFiles: description
151
+ avoidDtsFiles: description$1
152
152
  },
153
153
  type: "suggestion",
154
154
  schema: []
@@ -178,6 +178,41 @@ plugin.createRule({
178
178
  };
179
179
  }
180
180
  });
181
+ const description = `Enforce consistent logging so that ArcGIS developers can easily debug errors or warnings logged by our web components, which may lack a meaningful context in compiled code. See [our documentation on @arcgis/toolkit/log](https://webgis.esri.com/references/toolkit/log).`;
182
+ plugin.createRule({
183
+ name: "consistent-logging",
184
+ meta: {
185
+ docs: {
186
+ description,
187
+ defaultLevel: "off"
188
+ // NOTE: this is turned on conditionally in root eslint config
189
+ },
190
+ messages: {
191
+ consistentLoggingWarning: `For consistency, use the log utility from @arcgis/toolkit/log instead of console.{{logMethodName}}.`
192
+ },
193
+ schema: [],
194
+ fixable: void 0,
195
+ type: "suggestion"
196
+ },
197
+ defaultOptions: [],
198
+ create(context) {
199
+ return {
200
+ // NOTE: CallExpression is not enough. Use MemberExpression to handle callbacks, e.g. .catch(console.error)
201
+ MemberExpression(node) {
202
+ if (node.type === AST_NODE_TYPES.MemberExpression && node.object.type === AST_NODE_TYPES.Identifier && node.object.name === "console" && node.property.type === AST_NODE_TYPES.Identifier) {
203
+ const logMethodName = node.property.name;
204
+ context.report({
205
+ node,
206
+ messageId: "consistentLoggingWarning",
207
+ data: {
208
+ logMethodName
209
+ }
210
+ });
211
+ }
212
+ }
213
+ };
214
+ }
215
+ });
181
216
  const webgisPlugin = plugin.finalize();
182
217
  export {
183
218
  webgisPlugin
@@ -0,0 +1,2 @@
1
+ declare const _default: import('@typescript-eslint/utils/ts-eslint').RuleModule<"consistentLoggingWarning", [], import('../../utils/makePlugin.ts').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": "5.0.0-next.83",
3
+ "version": "5.0.0-next.85",
4
4
  "description": "ESLint configuration for arcgis-web-components",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "license": "SEE LICENSE IN LICENSE.md",
22
22
  "dependencies": {
23
- "@arcgis/toolkit": "5.0.0-next.83",
23
+ "@arcgis/toolkit": "5.0.0-next.85",
24
24
  "@eslint/js": "^9.39.1",
25
25
  "@eslint/markdown": "^7.5.1",
26
26
  "@types/confusing-browser-globals": "^1.0.3",