Skip to content

A local-first personal finance app

Enable 'curly' rule (#1015)

Jed Fox54fa4bccf611
diff --git a/.eslintrc.js b/.eslintrc.js
index e0269b1ce2..608656cefb 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -17,6 +17,8 @@ module.exports = {
'prettier/prettier': 'error',
'no-unused-vars': 'off',
+ curly: ['error', 'multi-line', 'consistent'],
+
'no-restricted-globals': ['error'].concat(
require('confusing-browser-globals').filter(g => g !== 'self'),
),
diff --git a/packages/loot-core/src/server/budget/goaltemplates.ts b/packages/loot-core/src/server/budget/goaltemplates.ts
index f1772935ce..cdabaf4506 100644
--- a/packages/loot-core/src/server/budget/goaltemplates.ts
+++ b/packages/loot-core/src/server/budget/goaltemplates.ts
@@ -56,15 +56,17 @@ async function processTemplate(month, force) {
monthUtils.sheetForMonth(month),
`budget-${category.id}`,
);
- if (budgeted)
+ if (budgeted) {
originalCategoryBalance.push({ cat: category, amount: budgeted });
+ }
let template = category_templates[category.id];
if (template) {
- for (let l = 0; l < template.length; l++)
+ for (let l = 0; l < template.length; l++) {
lowestPriority =
template[l].priority > lowestPriority
? template[l].priority
: lowestPriority;
+ }
await setBudget({
category: category.id,
month,
@@ -92,16 +94,18 @@ async function processTemplate(month, force) {
priorityCheck = lowPriority;
skipSchedule = priorityCheck !== priority ? true : false;
isScheduleOrBy = true;
- if (!skipSchedule && errorNotice)
+ if (!skipSchedule && errorNotice) {
errors.push(
category.name +
': Schedules and By templates should all have the same priority. Using priority ' +
priorityCheck,
);
+ }
}
if (!skipSchedule) {
- if (!isScheduleOrBy)
+ if (!isScheduleOrBy) {
template = template.filter(t => t.priority === priority);
+ }
if (template.length > 0) {
errors = errors.concat(
template
diff --git a/upcoming-release-notes/1015.md b/upcoming-release-notes/1015.md
new file mode 100644
index 0000000000..cd12bab0da
--- /dev/null
+++ b/upcoming-release-notes/1015.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [j-f1]
+---
+
+Enable ESLint’s `curly` rule