@discourse/lint-configs 2.18.0 → 2.19.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discourse/lint-configs",
3
- "version": "2.18.0",
3
+ "version": "2.19.0",
4
4
  "description": "Shareable lint configs for Discourse core, plugins, and themes",
5
5
  "author": "Discourse",
6
6
  "license": "MIT",
@@ -1,5 +1,6 @@
1
1
  import NoAtClass from "./no-at-class.mjs";
2
2
  import NoImplicitThis from "./no-implicit-this.mjs";
3
+ import PluginOutletLazyHash from "./plugin-outlet-lazy-hash.mjs";
3
4
 
4
5
  export default {
5
6
  // Name of plugin
@@ -9,5 +10,6 @@ export default {
9
10
  rules: {
10
11
  "discourse/no-at-class": NoAtClass,
11
12
  "discourse/no-implicit-this": NoImplicitThis,
13
+ "discourse/plugin-outlet-lazy-hash": PluginOutletLazyHash,
12
14
  },
13
15
  };
@@ -0,0 +1,27 @@
1
+ import { Rule } from "ember-template-lint";
2
+
3
+ export default class PluginOutletLazyHash extends Rule {
4
+ visitor() {
5
+ return {
6
+ ElementNode(node) {
7
+ if (node.tag === "PluginOutlet") {
8
+ const outletArgsAttr = node.attributes.find(
9
+ (attr) => attr.name === "@outletArgs"
10
+ );
11
+
12
+ if (
13
+ outletArgsAttr &&
14
+ outletArgsAttr.value.type === "MustacheStatement" &&
15
+ outletArgsAttr.value.path.original === "hash"
16
+ ) {
17
+ this.log({
18
+ message:
19
+ "Use {{lazyHash}} instead of {{hash}} for @outletArgs in <PluginOutlet>.",
20
+ node: outletArgsAttr.value,
21
+ });
22
+ }
23
+ }
24
+ },
25
+ };
26
+ }
27
+ }
@@ -54,6 +54,7 @@ module.exports = {
54
54
  /-/, // kebab-case, probably a component or helper
55
55
  ],
56
56
  },
57
+ "discourse/plugin-outlet-lazy-hash": true,
57
58
  },
58
59
  overrides: [
59
60
  {