Skip to content

Commit

Permalink
render-item: fixup no-curly-component-invocation (#1987)
Browse files Browse the repository at this point in the history
There are two ways to invoke a component in a template: curly component
syntax ({{my-component}}), and angle bracket syntax (<MyComponent />).
The difference between them is syntactical. We should favour angle
bracket syntax as it improves readability of templates, i.e.
disambiguates components from helpers, and is also the future direction
Ember is going with the Octane Edition.

As such, let's fix up the render-item template so that it follows this
syntax and then remove the manual disabling of this linting rule so that
the linter will warn us against adding more issues of this type in the
future.
  • Loading branch information
geneukum committed Apr 27, 2022
1 parent 8246e13 commit e71da4c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions app/components/render-item.hbs
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
{{!-- template-lint-disable no-curly-component-invocation --}}

<Ui::Disclosure as |disclosure|>
<tr
style={{this.nodeStyle}}
class="list__row js-render-profile-item"
>
{{#@list.cell
<@list.cell
class="list__cell_main js-render-main-cell"
on-click=disclosure.toggle
style=this.nameStyle
}}
@on-click={{disclosure.toggle}}
style={{this.nameStyle}}
>
{{#if this.hasChildren}}
<disclosure.triangleIcon />
{{/if}}

<span title={{@model.name}}>
<span class="js-render-profile-name">{{@model.name}}</span>
</span>
{{/@list.cell}}
</@list.cell>

{{#@list.cell class="list__cell_value_numeric"}}
<@list.cell class="list__cell_value_numeric">
<span class="pill js-render-profile-duration">
{{ms-to-time @model.duration}}
</span>
{{/@list.cell}}
</@list.cell>

{{#@list.cell class="list__cell_value_numeric js-render-profile-timestamp"}}
<@list.cell class="list__cell_value_numeric js-render-profile-timestamp">
{{this.readableTime}}
{{/@list.cell}}
</@list.cell>
</tr>

{{#if disclosure.isExpanded}}
Expand Down

0 comments on commit e71da4c

Please sign in to comment.