From f1bb1db354ae3c2bef1232626cb54ef8bab78831 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 9 Mar 2020 15:28:31 +0100 Subject: [PATCH] DEV: enforces ember-template-lint: no-unbound (#9147) From ember-template-lint documentation (https://github.com/ember-template-lint/ember-template-lint/blob/master/docs/rule/no-unbound.md): ``` {{unbound}} is a legacy hold over from the days in which Ember's template engine was less performant. Its use today is vestigial, and it no longer offers performance benefits. It is also a poor practice to use it for rendering only the initial value of a property that may later change. ``` Co-Authored-By: Jarek Radosz --- .template-lintrc.js | 1 + .../admin/templates/components/site-setting.hbs | 2 +- .../admin/templates/components/site-settings/bool.hbs | 2 +- .../templates/components/site-settings/category-list.hbs | 2 +- .../admin/templates/components/site-settings/category.hbs | 2 +- .../admin/templates/components/site-settings/color.hbs | 2 +- .../templates/components/site-settings/compact-list.hbs | 2 +- .../admin/templates/components/site-settings/enum.hbs | 2 +- .../templates/components/site-settings/group-list.hbs | 2 +- .../templates/components/site-settings/host-list.hbs | 2 +- .../admin/templates/components/site-settings/list.hbs | 2 +- .../templates/components/site-settings/secret-list.hbs | 2 +- .../admin/templates/components/site-settings/string.hbs | 2 +- .../admin/templates/components/site-settings/tag-list.hbs | 2 +- .../admin/templates/components/site-settings/upload.hbs | 2 +- .../components/site-settings/uploaded-image-list.hbs | 2 +- .../admin/templates/components/site-settings/url-list.hbs | 2 +- .../templates/components/site-settings/value-list.hbs | 2 +- app/assets/javascripts/admin/templates/email-bounced.hbs | 2 +- app/assets/javascripts/admin/templates/email-received.hbs | 4 ++-- app/assets/javascripts/admin/templates/email-rejected.hbs | 6 +++--- app/assets/javascripts/admin/templates/email-sent.hbs | 2 +- app/assets/javascripts/admin/templates/email-skipped.hbs | 2 +- app/assets/javascripts/admin/templates/emojis.hbs | 2 +- app/assets/javascripts/admin/templates/permalinks.hbs | 8 ++++---- .../javascripts/admin/templates/search-logs-term.hbs | 8 ++++---- app/assets/javascripts/admin/templates/user-badges.hbs | 2 +- app/assets/javascripts/admin/templates/user-index.hbs | 4 ++-- .../javascripts/admin/templates/users-list-show.hbs | 6 +++--- .../javascripts/discourse/templates/badges/show.hbs | 2 +- .../templates/components/categories-boxes-topic.hbs | 2 +- .../templates/components/categories-boxes-with-topics.hbs | 2 +- .../discourse/templates/components/categories-boxes.hbs | 2 +- .../discourse/templates/components/category-unread.hbs | 4 ++-- .../discourse/templates/components/choose-message.hbs | 2 +- .../discourse/templates/components/choose-topic.hbs | 2 +- .../discourse/templates/components/featured-topic.hbs | 8 ++++---- .../discourse/templates/components/flag-action-type.hbs | 4 ++-- .../discourse/templates/components/group-post.hbs | 2 +- .../discourse/templates/components/ip-lookup.hbs | 2 +- .../discourse/templates/components/share-source.hbs | 2 +- .../discourse/templates/components/user-info.hbs | 8 ++++---- .../discourse/templates/components/user-summary-topic.hbs | 2 +- app/assets/javascripts/discourse/templates/composer.hbs | 2 +- .../javascripts/discourse/templates/full-page-search.hbs | 8 ++++---- .../templates/mobile/components/basic-topic-list.hbs | 2 +- .../discourse/templates/modal/bulk-notification-level.hbs | 4 ++-- .../javascripts/discourse/templates/outlet-list.hbs | 2 +- .../discourse/templates/preferences/categories.hbs | 6 +++--- app/assets/javascripts/discourse/templates/topic.hbs | 6 +++--- .../javascripts/discourse/templates/user-invited-show.hbs | 6 +++--- .../javascripts/discourse/templates/user/summary.hbs | 6 +++--- .../components/discourse-local-dates-create-form.hbs | 4 ++-- 53 files changed, 86 insertions(+), 85 deletions(-) diff --git a/.template-lintrc.js b/.template-lintrc.js index f96f46f4198..6783c6d94e3 100644 --- a/.template-lintrc.js +++ b/.template-lintrc.js @@ -10,6 +10,7 @@ module.exports = { "link-rel-noopener": true, "no-unnecessary-concat": true, "no-unused-block-params": true, + "no-unbound": true, "simple-unless": true } }; diff --git a/app/assets/javascripts/admin/templates/components/site-setting.hbs b/app/assets/javascripts/admin/templates/components/site-setting.hbs index 649df86a4fc..23eee45b6de 100644 --- a/app/assets/javascripts/admin/templates/components/site-setting.hbs +++ b/app/assets/javascripts/admin/templates/components/site-setting.hbs @@ -1,5 +1,5 @@
-

{{unbound settingName}}

+

{{settingName}}

{{#if defaultIsAvailable}} {{setting.setDefaultValuesLabel}} {{/if}} diff --git a/app/assets/javascripts/admin/templates/components/site-settings/bool.hbs b/app/assets/javascripts/admin/templates/components/site-settings/bool.hbs index 5892174168f..1c6c2101ae8 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/bool.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/bool.hbs @@ -1,5 +1,5 @@ diff --git a/app/assets/javascripts/admin/templates/components/site-settings/category-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/category-list.hbs index 14d7210604c..6d8871b306c 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/category-list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/category-list.hbs @@ -3,5 +3,5 @@ onChange=(action "onChangeSelectedCategories") }} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
{{setting-validation-message message=validationMessage}} diff --git a/app/assets/javascripts/admin/templates/components/site-settings/category.hbs b/app/assets/javascripts/admin/templates/components/site-settings/category.hbs index d6b6bee5658..4f23fcc0211 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/category.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/category.hbs @@ -4,4 +4,4 @@ onChange=(action (mut value)) }} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/color.hbs b/app/assets/javascripts/admin/templates/components/site-settings/color.hbs index 33c66076a24..baf81ab3894 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/color.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/color.hbs @@ -6,4 +6,4 @@ onChangeColor=(action "onChangeColor") }} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/compact-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/compact-list.hbs index 86fce97f15e..621baec0b16 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/compact-list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/compact-list.hbs @@ -8,4 +8,4 @@ }} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/enum.hbs b/app/assets/javascripts/admin/templates/components/site-settings/enum.hbs index 86faf57d755..dc33e28df5a 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/enum.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/enum.hbs @@ -15,5 +15,5 @@ {{setting-validation-message message=validationMessage}}
- {{{unbound setting.description}}} + {{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/group-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/group-list.hbs index 768311c3f96..8f4263a72eb 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/group-list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/group-list.hbs @@ -7,4 +7,4 @@ onChange=(action "onChangeGroupListSetting") }} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/host-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/host-list.hbs index 5107f5b4af5..5277c26c69d 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/host-list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/host-list.hbs @@ -1,3 +1,3 @@ {{value-list values=value addKey="admin.site_settings.add_host"}} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/list.hbs index 0abde37586f..268723c92d4 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/list.hbs @@ -1,3 +1,3 @@ {{value-list values=value inputDelimiter="|" choices=setting.choices}} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/secret-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/secret-list.hbs index e77ddbb5203..a4ff6f1bd4a 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/secret-list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/secret-list.hbs @@ -1,3 +1,3 @@ {{secret-value-list setting=setting values=value isSecret=isSecret}} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/string.hbs b/app/assets/javascripts/admin/templates/components/site-settings/string.hbs index a2c53a1ee6f..d71278f7236 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/string.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/string.hbs @@ -7,4 +7,4 @@ {{/if}} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/tag-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/tag-list.hbs index 84c6623cfbb..271e4d03264 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/tag-list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/tag-list.hbs @@ -1,3 +1,3 @@ {{tag-chooser tags=selectedTags}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
{{setting-validation-message message=validationMessage}} diff --git a/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs b/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs index 51711eee272..86940d8633b 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs @@ -1,2 +1,2 @@ {{site-settings-image-uploader imageUrl=value placeholderUrl=setting.placeholder type="site_setting"}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/uploaded-image-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/uploaded-image-list.hbs index 86750e634d9..82dc38d6533 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/uploaded-image-list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/uploaded-image-list.hbs @@ -1,2 +1,2 @@ {{d-button label="admin.site_settings.uploaded_image_list.label" action=(action "showUploadModal") actionParam=(hash value=value setting=setting)}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/url-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/url-list.hbs index 41213777e36..67db58f8ea6 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/url-list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/url-list.hbs @@ -1,3 +1,3 @@ {{value-list values=value addKey="admin.site_settings.add_url"}} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/components/site-settings/value-list.hbs b/app/assets/javascripts/admin/templates/components/site-settings/value-list.hbs index caaf3739d74..3003b375ee2 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/value-list.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/value-list.hbs @@ -1,3 +1,3 @@ {{value-list values=value}} {{setting-validation-message message=validationMessage}} -
{{{unbound setting.description}}}
+
{{{setting.description}}}
diff --git a/app/assets/javascripts/admin/templates/email-bounced.hbs b/app/assets/javascripts/admin/templates/email-bounced.hbs index 0387050d8fc..9868012f2c9 100644 --- a/app/assets/javascripts/admin/templates/email-bounced.hbs +++ b/app/assets/javascripts/admin/templates/email-bounced.hbs @@ -27,7 +27,7 @@ — {{/if}} - {{l.to_address}} + {{l.to_address}} {{#if l.has_bounce_key}} {{l.email_type}} {{else}} diff --git a/app/assets/javascripts/admin/templates/email-received.hbs b/app/assets/javascripts/admin/templates/email-received.hbs index 5fc983557e7..aff40a6601f 100644 --- a/app/assets/javascripts/admin/templates/email-received.hbs +++ b/app/assets/javascripts/admin/templates/email-received.hbs @@ -34,10 +34,10 @@ {{#each email.to_addresses as |to|}} -

{{unbound to}}

+

{{to}}

{{/each}} {{#each email.cc_addresses as |cc|}} -

{{unbound cc}}

+

{{cc}}

{{/each}} diff --git a/app/assets/javascripts/admin/templates/email-rejected.hbs b/app/assets/javascripts/admin/templates/email-rejected.hbs index e3595a58bd2..9cc97106603 100644 --- a/app/assets/javascripts/admin/templates/email-rejected.hbs +++ b/app/assets/javascripts/admin/templates/email-rejected.hbs @@ -31,7 +31,7 @@ {{/link-to}} {{else}} {{#if email.from_address}} - {{email.from_address}} + {{email.from_address}} {{else}} — {{/if}} @@ -40,10 +40,10 @@ {{#each email.to_addresses as |to|}} -

{{unbound to}}

+

{{to}}

{{/each}} {{#each email.cc_addresses as |cc|}} -

{{unbound cc}}

+

{{cc}}

{{/each}} {{email.subject}} diff --git a/app/assets/javascripts/admin/templates/email-sent.hbs b/app/assets/javascripts/admin/templates/email-sent.hbs index c1ad376b6c7..633b81cb3da 100644 --- a/app/assets/javascripts/admin/templates/email-sent.hbs +++ b/app/assets/javascripts/admin/templates/email-sent.hbs @@ -31,7 +31,7 @@ {{#if l.bounced}}{{d-icon "redo" title="admin.email.bounced"}}{{/if}} - {{l.to_address}} + {{l.to_address}} {{l.email_type}} diff --git a/app/assets/javascripts/admin/templates/email-skipped.hbs b/app/assets/javascripts/admin/templates/email-skipped.hbs index 76ddb1197e3..da27e86914c 100644 --- a/app/assets/javascripts/admin/templates/email-skipped.hbs +++ b/app/assets/javascripts/admin/templates/email-skipped.hbs @@ -29,7 +29,7 @@ — {{/if}} - {{l.to_address}} + {{l.to_address}} {{l.email_type}} {{#if l.post_url}} diff --git a/app/assets/javascripts/admin/templates/emojis.hbs b/app/assets/javascripts/admin/templates/emojis.hbs index d08f2ed547a..5f9de8104ca 100644 --- a/app/assets/javascripts/admin/templates/emojis.hbs +++ b/app/assets/javascripts/admin/templates/emojis.hbs @@ -18,7 +18,7 @@ {{#each sortedEmojis as |e|}} - + :{{e.name}}: {{d-button diff --git a/app/assets/javascripts/admin/templates/permalinks.hbs b/app/assets/javascripts/admin/templates/permalinks.hbs index ac933f09c33..7c7ac2df6b0 100644 --- a/app/assets/javascripts/admin/templates/permalinks.hbs +++ b/app/assets/javascripts/admin/templates/permalinks.hbs @@ -27,22 +27,22 @@ {{pl.url}} {{#if pl.topic_id}} - {{pl.topic_title}} + {{pl.topic_title}} {{/if}} {{#if pl.post_id}} - #{{pl.post_number}} {{pl.post_topic_title}} + #{{pl.post_number}} {{pl.post_topic_title}} {{/if}} {{#if pl.category_id}} - {{pl.category_name}} + {{pl.category_name}} {{/if}} {{#if pl.external_url}} - {{pl.external_url}} + {{pl.external_url}} {{/if}} diff --git a/app/assets/javascripts/admin/templates/search-logs-term.hbs b/app/assets/javascripts/admin/templates/search-logs-term.hbs index 339cf2d169d..78bd54afb93 100644 --- a/app/assets/javascripts/admin/templates/search-logs-term.hbs +++ b/app/assets/javascripts/admin/templates/search-logs-term.hbs @@ -23,15 +23,15 @@ {{#each model.search_result.posts as |result|}}
- - {{topic-status topic=result.topic disableActions=true}}{{#highlight-text highlight=term}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}} + + {{topic-status topic=result.topic disableActions=true}}{{#highlight-text highlight=term}}{{{result.topic.fancyTitle}}}{{/highlight-text}}
@@ -55,7 +55,7 @@ {{#if result.blurb}} {{#highlight-text highlight=term}} - {{{unbound result.blurb}}} + {{{result.blurb}}} {{/highlight-text}} {{/if}}
diff --git a/app/assets/javascripts/admin/templates/user-badges.hbs b/app/assets/javascripts/admin/templates/user-badges.hbs index c93e7fb4624..39d227bcf84 100644 --- a/app/assets/javascripts/admin/templates/user-badges.hbs +++ b/app/assets/javascripts/admin/templates/user-badges.hbs @@ -55,7 +55,7 @@ {{#if userBadge.postUrl}} - {{userBadge.topic_title}} + {{userBadge.topic_title}} {{/if}} {{age-with-tooltip userBadge.granted_at}} diff --git a/app/assets/javascripts/admin/templates/user-index.hbs b/app/assets/javascripts/admin/templates/user-index.hbs index 5707142ff39..207120eea8b 100644 --- a/app/assets/javascripts/admin/templates/user-index.hbs +++ b/app/assets/javascripts/admin/templates/user-index.hbs @@ -59,7 +59,7 @@
{{i18n "admin.users.not_verified"}}
{{/unless}} {{#if model.email}} - {{model.email}} + {{model.email}} {{else}} {{d-button class="btn-default" @@ -79,7 +79,7 @@ {{#if model.secondary_emails}} {{else}} diff --git a/app/assets/javascripts/admin/templates/users-list-show.hbs b/app/assets/javascripts/admin/templates/users-list-show.hbs index 127b7446c04..7d096573b00 100644 --- a/app/assets/javascripts/admin/templates/users-list-show.hbs +++ b/app/assets/javascripts/admin/templates/users-list-show.hbs @@ -40,16 +40,16 @@ {{#each model as |user|}} - + {{avatar user imageSize="small"}} - {{#link-to 'adminUser' user}}{{unbound user.username}}{{/link-to}} + {{#link-to 'adminUser' user}}{{user.username}}{{/link-to}} {{#if user.staged}} {{d-icon "far-envelope" title="user.staged" }} {{/if}} - {{~unbound user.email~}} + {{~user.email~}}
{{i18n 'admin.users.last_emailed'}}
diff --git a/app/assets/javascripts/discourse/templates/badges/show.hbs b/app/assets/javascripts/discourse/templates/badges/show.hbs index 12ba951aacc..09ded422b37 100644 --- a/app/assets/javascripts/discourse/templates/badges/show.hbs +++ b/app/assets/javascripts/discourse/templates/badges/show.hbs @@ -42,7 +42,7 @@ {{#user-info user=ub.user size="medium" class="badge-info" date=ub.granted_at}}
{{i18n 'badges.granted_on' date=(inline-date ub.granted_at)}}
{{#if ub.post_number}} - {{{ub.topic.fancyTitle}}} + {{{ub.topic.fancyTitle}}} {{/if}} {{/user-info}} {{/each}} diff --git a/app/assets/javascripts/discourse/templates/components/categories-boxes-topic.hbs b/app/assets/javascripts/discourse/templates/components/categories-boxes-topic.hbs index 1e6fd8be893..b95a06db7ac 100644 --- a/app/assets/javascripts/discourse/templates/components/categories-boxes-topic.hbs +++ b/app/assets/javascripts/discourse/templates/components/categories-boxes-topic.hbs @@ -1,5 +1,5 @@ {{d-icon topicStatusIcon}} - + {{text-overflow class="overflow" text=topic.fancyTitle}} diff --git a/app/assets/javascripts/discourse/templates/components/categories-boxes-with-topics.hbs b/app/assets/javascripts/discourse/templates/components/categories-boxes-with-topics.hbs index 6df50c4eef4..4ce13a15840 100644 --- a/app/assets/javascripts/discourse/templates/components/categories-boxes-with-topics.hbs +++ b/app/assets/javascripts/discourse/templates/components/categories-boxes-with-topics.hbs @@ -1,5 +1,5 @@ {{#each categories as |c|}} -
+
diff --git a/app/assets/javascripts/discourse/templates/components/categories-boxes.hbs b/app/assets/javascripts/discourse/templates/components/categories-boxes.hbs index 888eefce978..5dc594c6910 100644 --- a/app/assets/javascripts/discourse/templates/components/categories-boxes.hbs +++ b/app/assets/javascripts/discourse/templates/components/categories-boxes.hbs @@ -1,5 +1,5 @@ {{#each categories as |c|}} -