Repository: ember-cli/ember-cli
Pull request #10256 (2023-04-15 09:22:14)

[ENHANCEMENT] Align `hbs` templates generated by `app` blueprint with Prettier defaults
This aligns the HBS templates generated by `ember new` with Prettier's defaults for Handlebars.

Today when adopting Prettier for Handlebars in a newly generated Ember application, Prettier rewrites the comments in `app/templates/application.hbs`:

```patch
diff --git a/app/templates/application.hbs b/app/templates/application.hbs
index 4152aaf..0b86c10 100644
--- a/app/templates/application.hbs
+++ b/app/templates/application.hbs
@@ -1,7 +1,7 @@
 {{page-title "Croodle"}}
 
-{{!-- The following component displays Ember's default welcome message. --}}
+{{! The following component displays Ember's default welcome message. }}
 <WelcomePage />
-{{!-- Feel free to remove this! --}}
+{{! Feel free to remove this! }}
 
 {{outlet}}
\ No newline at end of file
```

We could avoid this unneeded churn by following Prettier code formatting in blueprints directly.


Patch:
diff --git a/blueprints/app/files/app/templates/application.hbs b/blueprints/app/files/app/templates/application.hbs
index 78970cd25..6ff52759d 100644
--- a/blueprints/app/files/app/templates/application.hbs
+++ b/blueprints/app/files/app/templates/application.hbs
@@ -1,8 +1,8 @@
 {{page-title "<%= namespace %>"}}
 
-<% if (welcome) { %>{{!-- The following component displays Ember's default welcome message. --}}
+<% if (welcome) { %>{{! The following component displays Ember's default welcome message. }}
 <WelcomePage />
-{{!-- Feel free to remove this! --}}
+{{! Feel free to remove this! }}
 <% } else { %><h2 id="title">Welcome to Ember</h2>
 <% } %>
 {{outlet}}
\ No newline at end of file


Test patch:
diff --git a/tests/fixtures/addon/yarn/tests/dummy/app/templates/application.hbs b/tests/fixtures/addon/yarn/tests/dummy/app/templates/application.hbs
index ef465c353..8e7f167a0 100644
--- a/tests/fixtures/addon/yarn/tests/dummy/app/templates/application.hbs
+++ b/tests/fixtures/addon/yarn/tests/dummy/app/templates/application.hbs
@@ -1,7 +1,7 @@
 {{page-title "Dummy"}}
 
-{{!-- The following component displays Ember's default welcome message. --}}
+{{! The following component displays Ember's default welcome message. }}
 <WelcomePage />
-{{!-- Feel free to remove this! --}}
+{{! Feel free to remove this! }}
 
 {{outlet}}
\ No newline at end of file
diff --git a/tests/fixtures/app/defaults/app/templates/application.hbs b/tests/fixtures/app/defaults/app/templates/application.hbs
index c50aa5fb7..0d0ebcc93 100644
--- a/tests/fixtures/app/defaults/app/templates/application.hbs
+++ b/tests/fixtures/app/defaults/app/templates/application.hbs
@@ -1,7 +1,7 @@
 {{page-title "Foo"}}
 
-{{!-- The following component displays Ember's default welcome message. --}}
+{{! The following component displays Ember's default welcome message. }}
 <WelcomePage />
-{{!-- Feel free to remove this! --}}
+{{! Feel free to remove this! }}
 
 {{outlet}}
\ No newline at end of file
diff --git a/tests/fixtures/app/nested-project/actual-project/app/templates/application.hbs b/tests/fixtures/app/nested-project/actual-project/app/templates/application.hbs
index 41f167ffc..47296e2d6 100644
--- a/tests/fixtures/app/nested-project/actual-project/app/templates/application.hbs
+++ b/tests/fixtures/app/nested-project/actual-project/app/templates/application.hbs
@@ -1,7 +1,7 @@
 {{page-title "Actual Project"}}
 
-{{!-- The following component displays Ember's default welcome message. --}}
+{{! The following component displays Ember's default welcome message. }}
 <WelcomePage />
-{{!-- Feel free to remove this! --}}
+{{! Feel free to remove this! }}
 
 {{outlet}}
diff --git a/tests/fixtures/app/with-blueprint-override-lint-fail/app/templates/application.hbs b/tests/fixtures/app/with-blueprint-override-lint-fail/app/templates/application.hbs
index c50aa5fb7..0d0ebcc93 100644
--- a/tests/fixtures/app/with-blueprint-override-lint-fail/app/templates/application.hbs
+++ b/tests/fixtures/app/with-blueprint-override-lint-fail/app/templates/application.hbs
@@ -1,7 +1,7 @@
 {{page-title "Foo"}}
 
-{{!-- The following component displays Ember's default welcome message. --}}
+{{! The following component displays Ember's default welcome message. }}
 <WelcomePage />
-{{!-- Feel free to remove this! --}}
+{{! Feel free to remove this! }}
 
 {{outlet}}
\ No newline at end of file
diff --git a/tests/fixtures/app/yarn-travis/app/templates/application.hbs b/tests/fixtures/app/yarn-travis/app/templates/application.hbs
index c50aa5fb7..0d0ebcc93 100644
--- a/tests/fixtures/app/yarn-travis/app/templates/application.hbs
+++ b/tests/fixtures/app/yarn-travis/app/templates/application.hbs
@@ -1,7 +1,7 @@
 {{page-title "Foo"}}
 
-{{!-- The following component displays Ember's default welcome message. --}}
+{{! The following component displays Ember's default welcome message. }}
 <WelcomePage />
-{{!-- Feel free to remove this! --}}
+{{! Feel free to remove this! }}
 
 {{outlet}}
\ No newline at end of file
diff --git a/tests/fixtures/app/yarn/app/templates/application.hbs b/tests/fixtures/app/yarn/app/templates/application.hbs
index c50aa5fb7..0d0ebcc93 100644
--- a/tests/fixtures/app/yarn/app/templates/application.hbs
+++ b/tests/fixtures/app/yarn/app/templates/application.hbs
@@ -1,7 +1,7 @@
 {{page-title "Foo"}}
 
-{{!-- The following component displays Ember's default welcome message. --}}
+{{! The following component displays Ember's default welcome message. }}
 <WelcomePage />
-{{!-- Feel free to remove this! --}}
+{{! Feel free to remove this! }}
 
 {{outlet}}
\ No newline at end of file