[PR #1197] [CLOSED] Prefer using let over const in most cases #110401

Closed
opened 2026-06-05 13:54:12 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/1197
Author: @j-f1
Created: 6/26/2023
Status: ❌ Closed

Base: master ← Head: jed/const


📝 Commits (9)

  • 94f95d1 Swap from eslint-plugin-rulesdir to an actual ESLint plugin package
  • 3530cd8 mandate let
  • a85acdc Run auto-fix
  • bb5ed27 Better declaration type checks
  • c80ed9a Re-apply with new heuristics
  • c832a98 Manually fix const reassignment errors
  • 0683130 Fix scoping error
  • e876420 fix eslintrc & test
  • af9034d Fix unique symbol constants

📊 Changes

663 files changed (+2036 additions, -1866 deletions)

View changed files

📝 .eslintrc.js (+25 -30)
📝 package.json (+0 -1)
📝 packages/api/index.js (+1 -1)
📝 packages/crdt/src/crdt/merkle.test.ts (+1 -1)
📝 packages/crdt/src/crdt/merkle.ts (+3 -3)
📝 packages/crdt/src/crdt/timestamp.ts (+2 -2)
📝 packages/crdt/src/main.ts (+1 -1)
📝 packages/desktop-client/e2e/accounts.test.js (+3 -3)
📝 packages/desktop-client/e2e/budget.test.js (+3 -3)
📝 packages/desktop-client/e2e/onboarding.test.js (+5 -5)
📝 packages/desktop-client/e2e/page-models/account-page.js (+2 -2)
📝 packages/desktop-client/e2e/page-models/budget-page.js (+1 -1)
📝 packages/desktop-client/e2e/page-models/configuration-page.js (+2 -2)
📝 packages/desktop-client/e2e/page-models/navigation.js (+2 -2)
📝 packages/desktop-client/e2e/page-models/rules-page.js (+4 -4)
📝 packages/desktop-client/e2e/page-models/schedules-page.js (+3 -3)
📝 packages/desktop-client/e2e/reports.test.js (+1 -1)
📝 packages/desktop-client/e2e/rules.test.js (+1 -1)
📝 packages/desktop-client/e2e/schedules.test.js (+2 -2)
📝 packages/desktop-client/e2e/settings.test.js (+2 -2)

...and 80 more files

📄 Description

Heuristics:

  • Use let in almost all cases, except:
  • when you call require, useState, or useReducer, use const
  • when you destructure props, this.props, or this.state, use const
  • I considered requiring const usage with UPPER_SNAKE_CASE variables, but that doesn’t work because they’re modified in several cases.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/1197 **Author:** [@j-f1](https://github.com/j-f1) **Created:** 6/26/2023 **Status:** ❌ Closed **Base:** `master` ← **Head:** `jed/const` --- ### 📝 Commits (9) - [`94f95d1`](https://github.com/actualbudget/actual/commit/94f95d1e7dcc27a00d7cf2071638bdaaca443a71) Swap from eslint-plugin-rulesdir to an actual ESLint plugin package - [`3530cd8`](https://github.com/actualbudget/actual/commit/3530cd8ef991f0c0c5516335a45ab29b4a8f3bf0) mandate let - [`a85acdc`](https://github.com/actualbudget/actual/commit/a85acdcb35b7f1bae8f2d3451ee0515da6f0566e) Run auto-fix - [`bb5ed27`](https://github.com/actualbudget/actual/commit/bb5ed274eda7a536164d711af53652ed5c36000c) Better declaration type checks - [`c80ed9a`](https://github.com/actualbudget/actual/commit/c80ed9a812e527c6895675df959c12858f7f4739) Re-apply with new heuristics - [`c832a98`](https://github.com/actualbudget/actual/commit/c832a984a9b093f30b26224a4cdf3947d39975ba) Manually fix const reassignment errors - [`0683130`](https://github.com/actualbudget/actual/commit/0683130d267ca389c8892b74a0d7fcd8061ae89e) Fix scoping error - [`e876420`](https://github.com/actualbudget/actual/commit/e8764202ce0cda331f29a01fd7c5c51ef5875998) fix eslintrc & test - [`af9034d`](https://github.com/actualbudget/actual/commit/af9034d39d04b49cde67f9fb4cd2b7ed1e965588) Fix `unique symbol` constants ### 📊 Changes **663 files changed** (+2036 additions, -1866 deletions) <details> <summary>View changed files</summary> 📝 `.eslintrc.js` (+25 -30) 📝 `package.json` (+0 -1) 📝 `packages/api/index.js` (+1 -1) 📝 `packages/crdt/src/crdt/merkle.test.ts` (+1 -1) 📝 `packages/crdt/src/crdt/merkle.ts` (+3 -3) 📝 `packages/crdt/src/crdt/timestamp.ts` (+2 -2) 📝 `packages/crdt/src/main.ts` (+1 -1) 📝 `packages/desktop-client/e2e/accounts.test.js` (+3 -3) 📝 `packages/desktop-client/e2e/budget.test.js` (+3 -3) 📝 `packages/desktop-client/e2e/onboarding.test.js` (+5 -5) 📝 `packages/desktop-client/e2e/page-models/account-page.js` (+2 -2) 📝 `packages/desktop-client/e2e/page-models/budget-page.js` (+1 -1) 📝 `packages/desktop-client/e2e/page-models/configuration-page.js` (+2 -2) 📝 `packages/desktop-client/e2e/page-models/navigation.js` (+2 -2) 📝 `packages/desktop-client/e2e/page-models/rules-page.js` (+4 -4) 📝 `packages/desktop-client/e2e/page-models/schedules-page.js` (+3 -3) 📝 `packages/desktop-client/e2e/reports.test.js` (+1 -1) 📝 `packages/desktop-client/e2e/rules.test.js` (+1 -1) 📝 `packages/desktop-client/e2e/schedules.test.js` (+2 -2) 📝 `packages/desktop-client/e2e/settings.test.js` (+2 -2) _...and 80 more files_ </details> ### 📄 Description Heuristics: - Use `let` in almost all cases, except: - when you call `require`, `useState`, or `useReducer`, use const - when you destructure `props`, `this.props`, or `this.state`, use const - I considered requiring `const` usage with `UPPER_SNAKE_CASE` variables, but that doesn’t work because they’re modified in several cases. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-05 13:54:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#110401