DEV: enforces eslint’s curly rule to the codebase (#10720)

DEV: enforces eslint’s curly rule to the codebase (#10720)

eslint --fix is capable of fix it automatically for you, ensure prettier is run after eslint as eslint --fix could leave the code in an invalid prettier state.

diff --git a/app/assets/javascripts/admin/components/admin-backups-logs.js b/app/assets/javascripts/admin/components/admin-backups-logs.js
index 2531a52..1bb3693 100644
--- a/app/assets/javascripts/admin/components/admin-backups-logs.js
+++ b/app/assets/javascripts/admin/components/admin-backups-logs.js
@@ -37,7 +37,9 @@ export default Component.extend({
   @observes("logs.[]")
   _updateFormattedLogs: discourseDebounce(function () {
     const logs = this.logs;
-    if (logs.length === 0) return;
+    if (logs.length === 0) {
+      return;
+    }
 
     // do the log formatting only once for HELLish performance
     let formattedLogs = this.formattedLogs;
diff --git a/app/assets/javascripts/admin/components/admin-report-chart.js b/app/assets/javascripts/admin/components/admin-report-chart.js
index 632d76f..20a190d 100644
--- a/app/assets/javascripts/admin/components/admin-report-chart.js
+++ b/app/assets/javascripts/admin/components/admin-report-chart.js
@@ -47,7 +47,9 @@ export default Component.extend({
   },
 
   _renderChart(model, chartCanvas) {
-    if (!chartCanvas) return;
+    if (!chartCanvas) {
+      return;
+    }
 
     const context = chartCanvas.getContext("2d");
     const chartData = this._applyChartGrouping(
@@ -137,7 +139,9 @@ export default Component.extend({
               display: true,
               ticks: {
                 userCallback: (label) => {
-                  if (Math.floor(label) === label) return label;
+                  if (Math.floor(label) === label) {
+                    return label;
+                  }
                 },
                 callback: (label) => number(label),
                 sampleSize: 5,
diff --git a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js
index 4b46eec..3519e6a 100644
--- a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js
+++ b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js
@@ -48,7 +48,9 @@ export default Component.extend({
   },
 
   _renderChart(model, chartCanvas) {
-    if (!chartCanvas) return;
+    if (!chartCanvas) {
+      return;
+    }
 
     const context = chartCanvas.getContext("2d");
 
@@ -115,7 +117,9 @@ export default Component.extend({
               display: true,
               ticks: {
                 userCallback: (label) => {
-                  if (Math.floor(label) === label) return label;
+                  if (Math.floor(label) === label) {
+                    return label;
+                  }
                 },
                 callback: (label) => number(label),
                 sampleSize: 5,
diff --git a/app/assets/javascripts/admin/components/admin-report-table.js b/app/assets/javascripts/admin/components/admin-report-table.js
index d5c76b2..b44ea78 100644
--- a/app/assets/javascripts/admin/components/admin-report-table.js
+++ b/app/assets/javascripts/admin/components/admin-report-table.js
@@ -74,7 +74,9 @@ export default Component.extend({
 
   @discourseComputed("model.data", "model.computedLabels")
   totalsForSampleRow(rows, labels) {
-    if (!rows || !rows.length) return {};
+    if (!rows || !rows.length) {
+      return {};
+    }
 
     let totalsRow = {};
 
@@ -130,7 +132,9 @@ export default Component.extend({
 
   @discourseComputed("model.data", "perPage", "page")
   pages(data, perPage, page) {
-    if (!data || data.length <= perPage) return [];
+    if (!data || data.length <= perPage) {
+      return [];
+    }
 
     const pagesIndexes = [];
     for (let i = 0; i < Math.ceil(data.length / perPage); i++) {
diff --git a/app/assets/javascripts/admin/components/admin-report.js b/app/assets/javascripts/admin/components/admin-report.js
index b5e81f7..eb9b06f 100644
--- a/app/assets/javascripts/admin/components/admin-report.js
+++ b/app/assets/javascripts/admin/components/admin-report.js
@@ -171,7 +171,9 @@ export default Component.extend({
     "filters.customFilters"
   )
   reportKey(dataSourceName, startDate, endDate, customFilters) {
-    if (!dataSourceName || !startDate || !endDate) return null;
+    if (!dataSourceName || !startDate || !endDate) {
+      return null;
+    }
 
     startDate = startDate.toISOString(true).split("T")[0];
     endDate = endDate.toISOString(true).split("T")[0];
@@ -310,7 +312,9 @@ export default Component.extend({
         filteredReports.filter((r) => r.report_key.includes(this.reportKey))
       )[0];
 
-      if (!report) return;
+      if (!report) {
+        return;
+      }
     }
 
     if (report.error === "not_found") {
diff --git a/app/assets/javascripts/admin/components/admin-theme-editor.js b/app/assets/javascripts/admin/components/admin-theme-editor.js
index 4c5eca3..c453c87 100644
--- a/app/assets/javascripts/admin/components/admin-theme-editor.js
+++ b/app/assets/javascripts/admin/components/admin-theme-editor.js
@@ -29,9 +29,15 @@ export default Component.extend({
 
   @discourseComputed("currentTargetName", "fieldName")
   activeSectionMode(targetName, fieldName) {
-    if (["settings", "translations"].includes(targetName)) return "yaml";
-    if (["extra_scss"].includes(targetName)) return "scss";
-    if (["color_definitions"].includes(fieldName)) return "scss";
+    if (["settings", "translations"].includes(targetName)) {
+      return "yaml";
+    }
+    if (["extra_scss"].includes(targetName)) {
+      return "scss";
+    }
+    if (["color_definitions"].includes(fieldName)) {
+      return "scss";
+    }
     return fieldName && fieldName.indexOf("scss") > -1 ? "scss" : "html";
   },
 
@@ -88,7 +94,9 @@ export default Component.extend({
     },
 
     addField(name) {
-      if (!name) return;
+      if (!name) {
+        return;
+      }
       name = name.replace(/[^a-zA-Z0-9-_/]/g, "");
       this.theme.setField(this.currentTargetName, name, "");
       this.setProperties({ newFieldName: "", addingField: false });
diff --git a/app/assets/javascripts/admin/components/admin-web-hook-event.js b/app/assets/javascripts/admin/components/admin-web-hook-event.js
index 20f8890..75f1326 100644
--- a/app/assets/javascripts/admin/components/admin-web-hook-event.js
+++ b/app/assets/javascripts/admin/components/admin-web-hook-event.js
@@ -14,7 +14,9 @@ export default Component.extend({
 
   @discourseComputed("model.status")
   statusColorClasses(status) {
-    if (!status) return "";
+    if (!status) {
+      return "";
+    }
 
     if (status >= 200 && status <= 299) {
       return "text-successful";
diff --git a/app/assets/javascripts/admin/components/secret-value-list.js b/app/assets/javascripts/admin/components/secret-value-list.js
index b773336..9b59c26 100644
--- a/app/assets/javascripts/admin/components/secret-value-list.js
+++ b/app/assets/javascripts/admin/components/secret-value-list.js
@@ -23,17 +23,23 @@ export default Component.extend({
 
   actions: {
     changeKey(index, newValue) {
-      if (this._checkInvalidInput(newValue)) return;
+      if (this._checkInvalidInput(newValue)) {
+        return;
+      }
       this._replaceValue(index, newValue, "key");
     },
 
     changeSecret(index, newValue) {
-      if (this._checkInvalidInput(newValue)) return;
+      if (this._checkInvalidInput(newValue)) {
+        return;
+      }
       this._replaceValue(index, newValue, "secret");
     },
 
     addValue() {
-      if (this._checkInvalidInput([this.newKey, this.newSecret])) return;
+      if (this._checkInvalidInput([this.newKey, this.newSecret])) {
+        return;
+      }
       this._addValue(this.newKey, this.newSecret);
       this.setProperties({ newKey: "", newSecret: "" });
     },
diff --git a/app/assets/javascripts/admin/components/simple-list.js b/app/assets/javascripts/admin/components/simple-list.js
index 4158447..f3db4c5 100644
--- a/app/assets/javascripts/admin/components/simple-list.js
+++ b/app/assets/javascripts/admin/components/simple-list.js
@@ -32,7 +32,9 @@ export default Component.extend({
 

[... diff too long, it was truncated ...]

GitHub sha: 530d9ab0

This commit appears in #10720 which was merged by jjaffeux.