Repository: ember-cli/ember-cli
Pull request #9975 (2022-07-28 17:48:59)

Fix `prefer-const` lint violations in `app` and `addon` blueprints
Many users use the [prefer-const](https://eslint.org/docs/latest/rules/prefer-const) ESLint lint rule. We can make a minor/trivial/harmless tweak to the blueprint so that there won't be any violations from this lint rule. There's no reason anyone should be reassigning the value of `ENV` or `app` anyway.


Patch:
diff --git a/blueprints/addon/files/ember-cli-build.js b/blueprints/addon/files/ember-cli-build.js
index e211c6334..366cbe507 100644
--- a/blueprints/addon/files/ember-cli-build.js
+++ b/blueprints/addon/files/ember-cli-build.js
@@ -3,7 +3,7 @@
 const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
 
 module.exports = function (defaults) {
-  let app = new EmberAddon(defaults, {
+  const app = new EmberAddon(defaults, {
     // Add options here
   });
 
diff --git a/blueprints/app/files/config/environment.js b/blueprints/app/files/config/environment.js
index 9f711bd1b..1a13433b9 100644
--- a/blueprints/app/files/config/environment.js
+++ b/blueprints/app/files/config/environment.js
@@ -1,7 +1,7 @@
 'use strict';
 
 module.exports = function (environment) {
-  let ENV = {
+  const ENV = {
     modulePrefix: '<%= modulePrefix %>',
     environment,
     rootURL: '/',
diff --git a/blueprints/app/files/ember-cli-build.js b/blueprints/app/files/ember-cli-build.js
index 2e9b03363..b0ae6cbd6 100644
--- a/blueprints/app/files/ember-cli-build.js
+++ b/blueprints/app/files/ember-cli-build.js
@@ -3,7 +3,7 @@
 const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
-  let app = new EmberApp(defaults, {
+  const app = new EmberApp(defaults, {
     // Add options here
   });
 


Test patch:
diff --git a/tests/fixtures/app/defaults/ember-cli-build.js b/tests/fixtures/app/defaults/ember-cli-build.js
index 48e94e9e4..45d36bf2f 100644
--- a/tests/fixtures/app/defaults/ember-cli-build.js
+++ b/tests/fixtures/app/defaults/ember-cli-build.js
@@ -3,7 +3,7 @@
 const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
-  let app = new EmberApp(defaults, {
+  const app = new EmberApp(defaults, {
     // Add options here
   });
 
diff --git a/tests/fixtures/app/embroider/ember-cli-build.js b/tests/fixtures/app/embroider/ember-cli-build.js
index 1d9b7e50e..8f3082eba 100644
--- a/tests/fixtures/app/embroider/ember-cli-build.js
+++ b/tests/fixtures/app/embroider/ember-cli-build.js
@@ -3,7 +3,7 @@
 const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
-  let app = new EmberApp(defaults, {
+  const app = new EmberApp(defaults, {
     // Add options here
   });
 
diff --git a/tests/fixtures/app/nested-project/actual-project/ember-cli-build.js b/tests/fixtures/app/nested-project/actual-project/ember-cli-build.js
index 48e94e9e4..45d36bf2f 100644
--- a/tests/fixtures/app/nested-project/actual-project/ember-cli-build.js
+++ b/tests/fixtures/app/nested-project/actual-project/ember-cli-build.js
@@ -3,7 +3,7 @@
 const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
-  let app = new EmberApp(defaults, {
+  const app = new EmberApp(defaults, {
     // Add options here
   });
 
diff --git a/tests/fixtures/app/with-blueprint-override-lint-fail/ember-cli-build.js b/tests/fixtures/app/with-blueprint-override-lint-fail/ember-cli-build.js
index 48e94e9e4..45d36bf2f 100644
--- a/tests/fixtures/app/with-blueprint-override-lint-fail/ember-cli-build.js
+++ b/tests/fixtures/app/with-blueprint-override-lint-fail/ember-cli-build.js
@@ -3,7 +3,7 @@
 const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
-  let app = new EmberApp(defaults, {
+  const app = new EmberApp(defaults, {
     // Add options here
   });
 
diff --git a/tests/fixtures/brocfile-tests/additional-trees/ember-cli-build.js b/tests/fixtures/brocfile-tests/additional-trees/ember-cli-build.js
index 19c8b9658..bc33c3c34 100644
--- a/tests/fixtures/brocfile-tests/additional-trees/ember-cli-build.js
+++ b/tests/fixtures/brocfile-tests/additional-trees/ember-cli-build.js
@@ -3,7 +3,7 @@ const Funnel = require('broccoli-funnel');
 const { isExperimentEnabled } = require('ember-cli/lib/experiments');
 
 module.exports = function (defaults) {
-  let app = new EmberApp(defaults, {});
+  const app = new EmberApp(defaults, {});
 
   let funnel = new Funnel('vendor', {
     srcDir: '/',