@discourse/lint-configs 2.29.0 → 2.30.0

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.
@@ -0,0 +1,42 @@
1
+ export default {
2
+ meta: {
3
+ type: "suggestion",
4
+ docs: {
5
+ description: "Use the correct import paths",
6
+ },
7
+ fixable: "code",
8
+ schema: [], // no options
9
+ },
10
+
11
+ create(context) {
12
+ return {
13
+ ImportDeclaration(node) {
14
+ if (node.source.value === "discourse/helpers/get-url") {
15
+ context.report({
16
+ node,
17
+ message:
18
+ "Use 'discourse/lib/get-url' instead of 'discourse/helpers/get-url'",
19
+ fix(fixer) {
20
+ return fixer.replaceText(node.source, `"discourse/lib/get-url"`);
21
+ },
22
+ });
23
+ } else if (
24
+ node.source.value === "discourse/helpers/html-safe" &&
25
+ node.specifiers[0]?.local.name === "htmlSafe"
26
+ ) {
27
+ context.report({
28
+ node,
29
+ message:
30
+ "Use '@ember/template' instead of 'discourse/helpers/html-safe'",
31
+ fix(fixer) {
32
+ return fixer.replaceText(
33
+ node,
34
+ `import { htmlSafe } from "@ember/template";`
35
+ );
36
+ },
37
+ });
38
+ }
39
+ },
40
+ };
41
+ },
42
+ };
package/eslint.mjs CHANGED
@@ -13,6 +13,7 @@ import SimpleImportSort from "eslint-plugin-simple-import-sort";
13
13
  import SortClassMembers from "eslint-plugin-sort-class-members";
14
14
  import globals from "globals";
15
15
  import capitalComponents from "./eslint-rules/capital-components.mjs";
16
+ import deprecatedImports from "./eslint-rules/deprecated-imports.mjs";
16
17
  import deprecatedLookups from "./eslint-rules/deprecated-lookups.mjs";
17
18
  import deprecatedPluginApis from "./eslint-rules/deprecated-plugin-apis.mjs";
18
19
  import discourseCommonImports from "./eslint-rules/discourse-common-imports.mjs";
@@ -124,6 +125,7 @@ export default [
124
125
  "no-simple-query-selector": noSimpleQuerySelector,
125
126
  "deprecated-lookups": deprecatedLookups,
126
127
  "discourse-common-imports": discourseCommonImports,
128
+ "deprecated-imports": deprecatedImports,
127
129
  "lines-between-class-members": linesBetweenClassMembers,
128
130
  "deprecated-plugin-apis": deprecatedPluginApis,
129
131
  "line-after-imports": lineAfterImports,
@@ -297,6 +299,7 @@ export default [
297
299
  "discourse/no-simple-query-selector": ["error"],
298
300
  "discourse/deprecated-lookups": ["error"],
299
301
  "discourse/discourse-common-imports": ["error"],
302
+ "discourse/deprecated-imports": ["error"],
300
303
  "discourse/lines-between-class-members": ["error"],
301
304
  "discourse/deprecated-plugin-apis": ["error"],
302
305
  "discourse/line-after-imports": ["error"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discourse/lint-configs",
3
- "version": "2.29.0",
3
+ "version": "2.30.0",
4
4
  "description": "Shareable lint configs for Discourse core, plugins, and themes",
5
5
  "author": "Discourse",
6
6
  "license": "MIT",