[PR #221] [CLOSED] Enforce a sort order for imports #10118

Closed
opened 2026-04-10 20:24:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/221
Author: @TomAFrench
Created: 8/30/2022
Status: Closed

Base: masterHead: sort-import


📝 Commits (6)

  • 5190931 style: enforce ordering of imports
  • 1130286 style: sort imports in loot-core
  • 80db6f0 style: sort imports in desktop-client
  • ceddb11 Merge branch 'master' into sort-import
  • 2c8516d Merge branch 'master' into sort-import
  • 9af45bc style: sort imports in loot-design

📊 Changes

325 files changed (+1555 additions, -869 deletions)

View changed files

📝 .eslintrc.js (+31 -2)
📝 packages/desktop-client/package.json (+1 -1)
📝 packages/desktop-client/src/components/AnimatedRefresh.js (+2 -0)
📝 packages/desktop-client/src/components/App.js (+6 -3)
📝 packages/desktop-client/src/components/AppBackground.js (+5 -2)
📝 packages/desktop-client/src/components/Background.js (+1 -0)
📝 packages/desktop-client/src/components/BankSyncStatus.js (+2 -0)
📝 packages/desktop-client/src/components/Debugger.js (+4 -2)
📝 packages/desktop-client/src/components/FatalError.js (+1 -0)
📝 packages/desktop-client/src/components/FinancesApp.js (+20 -18)
📝 packages/desktop-client/src/components/FloatableSidebar.js (+2 -0)
📝 packages/desktop-client/src/components/GlobalKeys.js (+1 -0)
📝 packages/desktop-client/src/components/LoggedInUser.js (+1 -0)
📝 packages/desktop-client/src/components/MobileWebMessage.js (+1 -0)
📝 packages/desktop-client/src/components/Modals.js (+14 -12)
📝 packages/desktop-client/src/components/Notifications.js (+4 -2)
📝 packages/desktop-client/src/components/Page.js (+1 -0)
📝 packages/desktop-client/src/components/Settings.js (+7 -5)
📝 packages/desktop-client/src/components/SidebarWithData.js (+6 -4)
📝 packages/desktop-client/src/components/SpreadsheetInterface.js (+2 -1)

...and 80 more files

📄 Description

I personally find the imports quite hard to manage (particularly in desktop-client) as we have a jumble of external imports, imports from other workspaces in the monorepo and local imports all mixed together. This means it's quite hard to see what what's going on and what exactly the open file depends on. Now that Actual is OSS, there's more cooks in the kitchen so it will likely deteriorate further.

To fix this I've added a plugin to the linter which enforces that imports are sorted consistently and will automatically fix deviations from this.

Specifically, we now sort imports as:

  1. React related packages
  2. External packages
  3. Monorepo packages
  4. Local imports

Each group is separated with a newline and within each group the imports are sorted alphabetically.


🔄 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/221 **Author:** [@TomAFrench](https://github.com/TomAFrench) **Created:** 8/30/2022 **Status:** ❌ Closed **Base:** `master` ← **Head:** `sort-import` --- ### 📝 Commits (6) - [`5190931`](https://github.com/actualbudget/actual/commit/51909313da5850e3271f6539b86141752a2402b8) style: enforce ordering of imports - [`1130286`](https://github.com/actualbudget/actual/commit/1130286a9faff661a97cee2b209c95d7c15c6b7d) style: sort imports in loot-core - [`80db6f0`](https://github.com/actualbudget/actual/commit/80db6f06ce4410ac4d0f2b899b5eac3cd6d8fffd) style: sort imports in desktop-client - [`ceddb11`](https://github.com/actualbudget/actual/commit/ceddb1146f4cf57ea68393ed9fc89a2b97fd259f) Merge branch 'master' into sort-import - [`2c8516d`](https://github.com/actualbudget/actual/commit/2c8516d17c7a9f0fe2d1cf5be1faf02264297d7f) Merge branch 'master' into sort-import - [`9af45bc`](https://github.com/actualbudget/actual/commit/9af45bcc5f887083c58829c3512e2a9ffcae7fcf) style: sort imports in loot-design ### 📊 Changes **325 files changed** (+1555 additions, -869 deletions) <details> <summary>View changed files</summary> 📝 `.eslintrc.js` (+31 -2) 📝 `packages/desktop-client/package.json` (+1 -1) 📝 `packages/desktop-client/src/components/AnimatedRefresh.js` (+2 -0) 📝 `packages/desktop-client/src/components/App.js` (+6 -3) 📝 `packages/desktop-client/src/components/AppBackground.js` (+5 -2) 📝 `packages/desktop-client/src/components/Background.js` (+1 -0) 📝 `packages/desktop-client/src/components/BankSyncStatus.js` (+2 -0) 📝 `packages/desktop-client/src/components/Debugger.js` (+4 -2) 📝 `packages/desktop-client/src/components/FatalError.js` (+1 -0) 📝 `packages/desktop-client/src/components/FinancesApp.js` (+20 -18) 📝 `packages/desktop-client/src/components/FloatableSidebar.js` (+2 -0) 📝 `packages/desktop-client/src/components/GlobalKeys.js` (+1 -0) 📝 `packages/desktop-client/src/components/LoggedInUser.js` (+1 -0) 📝 `packages/desktop-client/src/components/MobileWebMessage.js` (+1 -0) 📝 `packages/desktop-client/src/components/Modals.js` (+14 -12) 📝 `packages/desktop-client/src/components/Notifications.js` (+4 -2) 📝 `packages/desktop-client/src/components/Page.js` (+1 -0) 📝 `packages/desktop-client/src/components/Settings.js` (+7 -5) 📝 `packages/desktop-client/src/components/SidebarWithData.js` (+6 -4) 📝 `packages/desktop-client/src/components/SpreadsheetInterface.js` (+2 -1) _...and 80 more files_ </details> ### 📄 Description I personally find the imports quite hard to manage (particularly in `desktop-client`) as we have a jumble of external imports, imports from other workspaces in the monorepo and local imports all mixed together. This means it's quite hard to see what what's going on and what exactly the open file depends on. Now that Actual is OSS, there's more cooks in the kitchen so it will likely deteriorate further. To fix this I've added a plugin to the linter which enforces that imports are sorted consistently and will automatically fix deviations from this. Specifically, we now sort imports as: 1. React related packages 2. External packages 3. Monorepo packages 4. Local imports Each group is separated with a newline and within each group the imports are sorted alphabetically. --- <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-04-10 20:24:54 -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#10118