Skip to content

Commit 57d0a65

Browse files
Merge pull request #49 from suchitadoshi1987/suchita/supportwallstreet
Add support for ember-holy-futuristic-template-namespacing-batman syntax and Nested Invocations in Angle Bracket Syntax
2 parents 2101457 + cec9fc4 commit 57d0a65

6 files changed

Lines changed: 32 additions & 0 deletions

transforms/no-implicit-this/__testfixtures__/-mock-telemetry.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"some-component": { "type": "Component" },
33
"my-component": { "type": "Component" },
4+
"namespace/my-component": { "type": "Component" },
45
"block-component": { "type": "Component" },
56
"foo": { "type": "Component" },
67
"namespace/foo": { "type": "Component" },
@@ -32,6 +33,11 @@
3233
"computedProperties": ["foo", "property"],
3334
"ownActions": ["myAction"]
3435
},
36+
"handlebars-with-wall-street-syntax": {
37+
"type": "Component",
38+
"computedProperties": ["foo", "property"],
39+
"ownActions": ["myAction"]
40+
},
3541
"handlebars-with-hash-params": {
3642
"type": "Component",
3743
"computedProperties": ["foo", "property"],

transforms/no-implicit-this/__testfixtures__/angle-brackets-with-hash-params.input.hbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<SomeComponent @arg=1 />
66
<SomeComponent @arg=foo />
77
<SomeComponent @arg={{foo}} @bar={{property}} />
8+
<MyAddon$MyComponent @arg={{foo}} @bar={{property}} />
9+
<MyAddon$Namespace::MyComponent @arg={{foo}} @bar={{property}} />
810
<SomeComponent @arg={{foo}} @bar={{fn myAction}} />
911
<Select
1012
data-test-select

transforms/no-implicit-this/__testfixtures__/angle-brackets-with-hash-params.output.hbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<SomeComponent @arg=1 />
66
<SomeComponent @arg=foo />
77
<SomeComponent @arg={{this.foo}} @bar={{this.property}} />
8+
<MyAddon$MyComponent @arg={{this.foo}} @bar={{this.property}} />
9+
<MyAddon$Namespace::MyComponent @arg={{this.foo}} @bar={{this.property}} />
810
<SomeComponent @arg={{this.foo}} @bar={{fn this.myAction}} />
911
<Select
1012
data-test-select
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{my-addon$my-component foo}}
2+
{{my-addon$namespace::my-component @foo}}
3+
{{my-addon$namespace::my-component property}}
4+
{{my-addon$my-component (my-helper property)}}
5+
{{my-addon$my-component (my-helper "string")}}
6+
{{my-addon$namespace::my-component (my-helper 1)}}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{my-addon$my-component this.foo}}
2+
{{my-addon$namespace::my-component @foo}}
3+
{{my-addon$namespace::my-component this.property}}
4+
{{my-addon$my-component (my-helper this.property)}}
5+
{{my-addon$my-component (my-helper "string")}}
6+
{{my-addon$namespace::my-component (my-helper 1)}}

transforms/no-implicit-this/helpers/plugin.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ function doesTokenNeedThis(
8787
return true;
8888
}
8989

90+
// This is to support the ember-holy-futuristic-template-namespacing-batman syntax
91+
// as well as support for Nested Invocations in Angle Bracket Syntax
92+
// Ref: https://github.com/rwjblue/ember-holy-futuristic-template-namespacing-batman
93+
if (token.includes('$')) {
94+
token = token.split('$')[1];
95+
}
96+
if (token.includes('::')) {
97+
token = token.replace(/::/g, '/');
98+
}
99+
90100
let isComponent = components.find(path => path.endsWith(token));
91101

92102
if (isComponent) {

0 commit comments

Comments
 (0)