Skip to content

Commit cefef89

Browse files
committed
update readme
1 parent f65812a commit cefef89

2 files changed

Lines changed: 309 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The codemod accepts the following options:
2525
## Transforms
2626

2727
<!--TRANSFORMS_START-->
28+
* [no-implicit-this](transforms/no-implicit-this/README.md)
2829
<!--TRANSFORMS_END-->
2930

3031
## Contributing

transforms/no-implicit-this/README.md

Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,315 @@ ember-no-implicit-this-codemod no-implicit-this path/of/files/ or/some**/*glob.j
1515
## Input / Output
1616

1717
<!--FIXTURES_TOC_START-->
18+
* [angle-brackets-with-block-params](#angle-brackets-with-block-params)
19+
* [angle-brackets-with-hash-params](#angle-brackets-with-hash-params)
20+
* [angle-brackets-without-params](#angle-brackets-without-params)
21+
* [built-in-helpers](#built-in-helpers)
22+
* [comments](#comments)
23+
* [dont-assume-this](#dont-assume-this)
24+
* [handlebars-with-block-params](#handlebars-with-block-params)
25+
* [handlebars-with-hash-params](#handlebars-with-hash-params)
26+
* [handlebars-with-positional-params](#handlebars-with-positional-params)
27+
* [handlebars-without-params](#handlebars-without-params)
1828
<!--FIXTURES_TOC_END-->
1929

2030
<!--FIXTURES_CONTENT_START-->
31+
---
32+
<a id="angle-brackets-with-block-params">**angle-brackets-with-block-params**</a>
33+
34+
**Input** (<small>[angle-brackets-with-block-params.input.hbs](transforms/no-implicit-this/__testfixtures__/angle-brackets-with-block-params.input.hbs)</small>):
35+
```hbs
36+
<SomeComponent as |foo hash components|>
37+
{{foo}}
38+
{{hash.property}}
39+
40+
<components.foo as |property|>
41+
{{property}}
42+
</components.foo>
43+
44+
<components.bar />
45+
46+
</SomeComponent>
47+
48+
```
49+
50+
**Output** (<small>[angle-brackets-with-block-params.output.hbs](transforms/no-implicit-this/__testfixtures__/angle-brackets-with-block-params.output.hbs)</small>):
51+
```hbs
52+
<SomeComponent as |foo hash components|>
53+
{{foo}}
54+
{{hash.property}}
55+
56+
<components.foo as |property|>
57+
{{property}}
58+
</components.foo>
59+
60+
<components.bar />
61+
62+
</SomeComponent>
63+
64+
```
65+
---
66+
<a id="angle-brackets-with-hash-params">**angle-brackets-with-hash-params**</a>
67+
68+
**Input** (<small>[angle-brackets-with-hash-params.input.hbs](transforms/no-implicit-this/__testfixtures__/angle-brackets-with-hash-params.input.hbs)</small>):
69+
```hbs
70+
<a href='invalid-url' disabled></a>
71+
<input value="something">
72+
73+
<SomeComponent @arg="value" />
74+
<SomeComponent @arg=1 />
75+
<SomeComponent @arg=foo />
76+
<SomeComponent @arg={{foo}} @bar={{property}} />
77+
<SomeComponent @arg={{foo}} @bar={{fn myAction}} />
78+
79+
```
80+
81+
**Output** (<small>[angle-brackets-with-hash-params.output.hbs](transforms/no-implicit-this/__testfixtures__/angle-brackets-with-hash-params.output.hbs)</small>):
82+
```hbs
83+
<a href='invalid-url' disabled></a>
84+
<input value="something">
85+
86+
<SomeComponent @arg="value" />
87+
<SomeComponent @arg=1 />
88+
<SomeComponent @arg=foo />
89+
<SomeComponent @arg={{this.foo}} @bar={{this.property}} />
90+
<SomeComponent @arg={{this.foo}} @bar={{fn this.myAction}} />
91+
92+
```
93+
---
94+
<a id="angle-brackets-without-params">**angle-brackets-without-params**</a>
95+
96+
**Input** (<small>[angle-brackets-without-params.input.hbs](transforms/no-implicit-this/__testfixtures__/angle-brackets-without-params.input.hbs)</small>):
97+
```hbs
98+
<a></a>
99+
<br>
100+
<br />
101+
<foo />
102+
<foo></foo>
103+
<Foo />
104+
<Foo></Foo>
105+
106+
```
107+
108+
**Output** (<small>[angle-brackets-without-params.output.hbs](transforms/no-implicit-this/__testfixtures__/angle-brackets-without-params.output.hbs)</small>):
109+
```hbs
110+
<a></a>
111+
<br>
112+
<br />
113+
<foo />
114+
<foo></foo>
115+
<Foo />
116+
<Foo></Foo>
117+
118+
```
119+
---
120+
<a id="built-in-helpers">**built-in-helpers**</a>
121+
122+
**Input** (<small>[built-in-helpers.input.hbs](transforms/no-implicit-this/__testfixtures__/built-in-helpers.input.hbs)</small>):
123+
```hbs
124+
{{debugger}}
125+
{{has-block}}
126+
{{hasBlock}}
127+
{{input}}
128+
{{outlet}}
129+
{{textarea}}
130+
{{yield}}
131+
132+
{{#let (concat "a" "b") as |ab|}}
133+
{{ab}}
134+
{{/let}}
135+
136+
{{#each records as |record|}}
137+
{{record.property}}
138+
{{/each}}
139+
140+
141+
<button {{on 'click' myAction}}>Action</button>
142+
<button {{on 'click' (fn myAction foo)}}>Action</button>
143+
144+
{{link-to 'name' 'route'}}
145+
146+
```
147+
148+
**Output** (<small>[built-in-helpers.output.hbs](transforms/no-implicit-this/__testfixtures__/built-in-helpers.output.hbs)</small>):
149+
```hbs
150+
{{debugger}}
151+
{{has-block}}
152+
{{hasBlock}}
153+
{{input}}
154+
{{outlet}}
155+
{{textarea}}
156+
{{yield}}
157+
158+
{{#let (concat "a" "b") as |ab|}}
159+
{{ab}}
160+
{{/let}}
161+
162+
{{#each this.records as |record|}}
163+
{{record.property}}
164+
{{/each}}
165+
166+
167+
<button {{on 'click' this.myAction}}>Action</button>
168+
<button {{on 'click' (fn this.myAction this.foo)}}>Action</button>
169+
170+
{{link-to 'name' 'route'}}
171+
172+
```
173+
---
174+
<a id="comments">**comments**</a>
175+
176+
**Input** (<small>[comments.input.hbs](transforms/no-implicit-this/__testfixtures__/comments.input.hbs)</small>):
177+
```hbs
178+
<!-- foo -->
179+
<div {{!-- foo --}}></div>
180+
<div>{{!-- foo bar --}}<b></b></div>
181+
{{!-- {{foo-bar}} --}}
182+
183+
```
184+
185+
**Output** (<small>[comments.output.hbs](transforms/no-implicit-this/__testfixtures__/comments.output.hbs)</small>):
186+
```hbs
187+
<!-- foo -->
188+
<div {{!-- foo --}}></div>
189+
<div>{{!-- foo bar --}}<b></b></div>
190+
{{!-- {{foo-bar}} --}}
191+
192+
```
193+
---
194+
<a id="dont-assume-this">**dont-assume-this**</a>
195+
196+
**Input** (<small>[dont-assume-this.input.hbs](transforms/no-implicit-this/__testfixtures__/dont-assume-this.input.hbs)</small>):
197+
```hbs
198+
{{foo}}
199+
{{bar}}
200+
```
201+
202+
**Output** (<small>[dont-assume-this.output.hbs](transforms/no-implicit-this/__testfixtures__/dont-assume-this.output.hbs)</small>):
203+
```hbs
204+
{{this.foo}}
205+
{{bar}}
206+
```
207+
---
208+
<a id="handlebars-with-block-params">**handlebars-with-block-params**</a>
209+
210+
**Input** (<small>[handlebars-with-block-params.input.hbs](transforms/no-implicit-this/__testfixtures__/handlebars-with-block-params.input.hbs)</small>):
211+
```hbs
212+
{{#my-component as |foo myAction hash components|}}
213+
{{foo}} {{myAction}}
214+
{{hash.property}} {{hash.foo}}
215+
216+
{{components.foo}}
217+
218+
{{#components.my-component}}
219+
220+
{{/components.my-component}}
221+
222+
{{#components.block as |block|}}
223+
{{block}}
224+
{{/components.block}}
225+
{{/my-component}}
226+
227+
228+
```
229+
230+
**Output** (<small>[handlebars-with-block-params.output.hbs](transforms/no-implicit-this/__testfixtures__/handlebars-with-block-params.output.hbs)</small>):
231+
```hbs
232+
{{#my-component as |foo myAction hash components|}}
233+
{{foo}} {{myAction}}
234+
{{hash.property}} {{hash.foo}}
235+
236+
{{components.foo}}
237+
238+
{{#components.my-component}}
239+
240+
{{/components.my-component}}
241+
242+
{{#components.block as |block|}}
243+
{{block}}
244+
{{/components.block}}
245+
{{/my-component}}
246+
247+
248+
```
249+
---
250+
<a id="handlebars-with-hash-params">**handlebars-with-hash-params**</a>
251+
252+
**Input** (<small>[handlebars-with-hash-params.input.hbs](transforms/no-implicit-this/__testfixtures__/handlebars-with-hash-params.input.hbs)</small>):
253+
```hbs
254+
{{my-component arg="string"}}
255+
{{my-component arg=2}}
256+
{{my-component arg=foo}}
257+
{{my-component arg=property}}
258+
{{my-component arg=(my-helper property)}}
259+
{{my-component arg=(my-helper (fn myAction property) foo)}}
260+
{{my-component arg=property arg2=foo}}
261+
{{my-component arg=property arg2=(fn myAction foo)}}
262+
263+
264+
```
265+
266+
**Output** (<small>[handlebars-with-hash-params.output.hbs](transforms/no-implicit-this/__testfixtures__/handlebars-with-hash-params.output.hbs)</small>):
267+
```hbs
268+
{{my-component arg="string"}}
269+
{{my-component arg=2}}
270+
{{my-component arg=this.foo}}
271+
{{my-component arg=this.property}}
272+
{{my-component arg=(my-helper this.property)}}
273+
{{my-component arg=(my-helper (fn this.myAction this.property) this.foo)}}
274+
{{my-component arg=this.property arg2=this.foo}}
275+
{{my-component arg=this.property arg2=(fn this.myAction this.foo)}}
276+
277+
278+
```
279+
---
280+
<a id="handlebars-with-positional-params">**handlebars-with-positional-params**</a>
281+
282+
**Input** (<small>[handlebars-with-positional-params.input.hbs](transforms/no-implicit-this/__testfixtures__/handlebars-with-positional-params.input.hbs)</small>):
283+
```hbs
284+
{{my-component "string"}}
285+
{{my-component 1}}
286+
{{my-component foo}}
287+
{{my-component property}}
288+
{{my-component (my-helper property)}}
289+
{{my-component (my-helper "string")}}
290+
{{my-component (my-helper 1)}}
291+
292+
293+
```
294+
295+
**Output** (<small>[handlebars-with-positional-params.output.hbs](transforms/no-implicit-this/__testfixtures__/handlebars-with-positional-params.output.hbs)</small>):
296+
```hbs
297+
{{my-component "string"}}
298+
{{my-component 1}}
299+
{{my-component this.foo}}
300+
{{my-component this.property}}
301+
{{my-component (my-helper this.property)}}
302+
{{my-component (my-helper "string")}}
303+
{{my-component (my-helper 1)}}
304+
305+
306+
```
307+
---
308+
<a id="handlebars-without-params">**handlebars-without-params**</a>
309+
310+
**Input** (<small>[handlebars-without-params.input.hbs](transforms/no-implicit-this/__testfixtures__/handlebars-without-params.input.hbs)</small>):
311+
```hbs
312+
{{my-component}}
313+
{{a-helper}}
314+
{{foo}}
315+
{{property}}
316+
{{namespace/foo}}
317+
318+
```
319+
320+
**Output** (<small>[handlebars-without-params.output.hbs](transforms/no-implicit-this/__testfixtures__/handlebars-without-params.output.hbs)</small>):
321+
```hbs
322+
{{my-component}}
323+
{{a-helper}}
324+
{{this.foo}}
325+
{{this.property}}
326+
{{namespace/foo}}
327+
328+
```
21329
<!--FIXTURES_CONTENT_END-->

0 commit comments

Comments
 (0)