@discourse/lint-configs 2.11.2 → 2.13.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,36 @@
1
+ export default {
2
+ meta: {
3
+ type: "suggestion",
4
+ docs: {
5
+ description: "use the shorter form of truth-helpers import",
6
+ },
7
+ fixable: "code",
8
+ schema: [], // no options
9
+ },
10
+
11
+ create(context) {
12
+ return {
13
+ ImportDeclaration(node) {
14
+ if (node.source.value.startsWith("truth-helpers/helpers/")) {
15
+ context.report({
16
+ node,
17
+ message: `It is recommended to use 'truth-helpers' import instead of '${node.source.value}'.`,
18
+ fix(fixer) {
19
+ let code;
20
+ const localName = node.specifiers[0].local.name;
21
+ const sourceName = node.source.value.match(/([^/]+)$/)[0];
22
+
23
+ if (localName === sourceName) {
24
+ code = `import { ${sourceName} } from 'truth-helpers';`;
25
+ } else {
26
+ code = `import { ${sourceName} as ${localName} } from 'truth-helpers';`;
27
+ }
28
+
29
+ return fixer.replaceText(node, code);
30
+ },
31
+ });
32
+ }
33
+ },
34
+ };
35
+ },
36
+ };
package/eslint.mjs CHANGED
@@ -20,6 +20,7 @@ import lineAfterImports from "./eslint-rules/line-after-imports.mjs";
20
20
  import linesBetweenClassMembers from "./eslint-rules/lines-between-class-members.mjs";
21
21
  import noSimpleQuerySelector from "./eslint-rules/no-simple-query-selector.mjs";
22
22
  import serviceInjectImport from "./eslint-rules/service-inject-import.mjs";
23
+ import truthHelpersImports from "./eslint-rules/truth-helpers-imports.mjs";
23
24
 
24
25
  // Copied from "ember-template-imports/lib/utils"
25
26
  const TEMPLATE_TAG_PLACEHOLDER = "__GLIMMER_TEMPLATE";
@@ -111,6 +112,7 @@ export default [
111
112
  "i18n-import-location": i18nImport,
112
113
  "i18n-t": i18nT,
113
114
  "service-inject-import": serviceInjectImport,
115
+ "truth-helpers-imports": truthHelpersImports,
114
116
  "no-simple-query-selector": noSimpleQuerySelector,
115
117
  "deprecated-lookups": deprecatedLookups,
116
118
  "discourse-common-imports": discourseCommonImports,
@@ -283,6 +285,7 @@ export default [
283
285
  "discourse/i18n-import-location": ["error"],
284
286
  "discourse/i18n-t": ["error"],
285
287
  "discourse/service-inject-import": ["error"],
288
+ "discourse/truth-helpers-imports": ["error"],
286
289
  "discourse/no-simple-query-selector": ["error"],
287
290
  "discourse/deprecated-lookups": ["error"],
288
291
  "discourse/discourse-common-imports": ["error"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discourse/lint-configs",
3
- "version": "2.11.2",
3
+ "version": "2.13.0",
4
4
  "description": "Shareable lint configs for Discourse core, plugins, and themes",
5
5
  "author": "Discourse",
6
6
  "license": "MIT",
package/stylelint.mjs CHANGED
@@ -26,6 +26,5 @@ export default {
26
26
  "scss/at-function-pattern": null,
27
27
  "scss/comment-no-empty": null,
28
28
  "scss/at-mixin-pattern": null,
29
- "media-feature-range-notation": "prefix",
30
29
  },
31
30
  };