diff --git a/.eslintrc.js b/.eslintrc.js index 0c2caca16c..c89dc2f4f6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -165,6 +165,7 @@ module.exports = { 'prefer-const': 'warn', 'prefer-spread': 'off', '@typescript-eslint/no-empty-function': 'off', + 'import/no-default-export': 'off', }, overrides: [ { @@ -238,6 +239,53 @@ module.exports = { 'no-restricted-imports': ['off', { patterns: restrictedImportColors }], }, }, + { + files: [ + './packages/api/*', + './packages/api/app/**/*', + './packages/crdt/**/*', + './packages/desktop-client/src/*', + './packages/desktop-client/src/components/*', + // './packages/desktop-client/src/components/accounts/**/*', + // './packages/desktop-client/src/components/autocomplete/**/*', + // './packages/desktop-client/src/components/budget/**/*', + // './packages/desktop-client/src/components/common/**/*', + // './packages/desktop-client/src/components/filters/**/*', + // './packages/desktop-client/src/components/gocardless/**/*', + // './packages/desktop-client/src/components/manager/**/*', + // './packages/desktop-client/src/components/mobile/**/*', + // './packages/desktop-client/src/components/modals/**/*', + // './packages/desktop-client/src/components/payees/**/*', + // './packages/desktop-client/src/components/reports/**/*', + // './packages/desktop-client/src/components/responsive/**/*', + // './packages/desktop-client/src/components/rules/**/*', + // './packages/desktop-client/src/components/schedules/**/*', + // './packages/desktop-client/src/components/select/**/*', + // './packages/desktop-client/src/components/settings/**/*', + // './packages/desktop-client/src/components/sidebar/**/*', + // './packages/desktop-client/src/components/spreadsheet/**/*', + // './packages/desktop-client/src/components/transactions/**/*', + // './packages/desktop-client/src/components/util/**/*', + // './packages/desktop-client/src/hooks/**/*', + // './packages/desktop-client/src/icons/**/*', + // './packages/desktop-client/src/style/**/*', + // './packages/desktop-client/src/types/**/*', + // './packages/desktop-client/src/util/**/*', + // './packages/desktop-electron/**/*', + // './packages/eslint-plugin-actual/**/*', + // './packages/loot-core/*', + // './packages/loot-core/src/client/**/*', + // './packages/loot-core/src/mocks/**/*', + // './packages/loot-core/src/platform/**/*', + // './packages/loot-core/src/server/**/*', + // './packages/loot-core/src/shared/**/*', + // './packages/loot-core/src/types/**/*', + // './packages/loot-core/webpack/**/*', + ], + rules: { + 'import/no-default-export': 'warn', + }, + }, ], settings: { 'import/resolver': { diff --git a/packages/api/app/query.js b/packages/api/app/query.js index dddb807de3..f9f8079951 100644 --- a/packages/api/app/query.js +++ b/packages/api/app/query.js @@ -99,6 +99,6 @@ class Query { } } -export default function q(table) { +export function q(table) { return new Query({ table }); } diff --git a/packages/api/methods.js b/packages/api/methods.js index 7d6ef8a29f..9af541f267 100644 --- a/packages/api/methods.js +++ b/packages/api/methods.js @@ -1,6 +1,6 @@ import * as injected from './injected'; -export { default as q } from './app/query'; +export { q } from './app/query'; function send(name, args) { return injected.send(name, args); diff --git a/packages/desktop-client/src/components/AnimatedRefresh.tsx b/packages/desktop-client/src/components/AnimatedRefresh.tsx index c6e613c956..1f6ba9e736 100644 --- a/packages/desktop-client/src/components/AnimatedRefresh.tsx +++ b/packages/desktop-client/src/components/AnimatedRefresh.tsx @@ -19,7 +19,7 @@ type AnimatedRefreshProps = { height?: number; }; -export default function AnimatedRefresh({ +export function AnimatedRefresh({ animating, iconStyle, width, diff --git a/packages/desktop-client/src/components/App.tsx b/packages/desktop-client/src/components/App.tsx index bf5334c42d..9bae285f7d 100644 --- a/packages/desktop-client/src/components/App.tsx +++ b/packages/desktop-client/src/components/App.tsx @@ -14,20 +14,20 @@ import { import { type GlobalPrefs } from 'loot-core/src/types/prefs'; import { useActions } from '../hooks/useActions'; -import installPolyfills from '../polyfills'; +import { installPolyfills } from '../polyfills'; import { ResponsiveProvider } from '../ResponsiveProvider'; import { styles, hasHiddenScrollbars, ThemeStyle } from '../style'; -import AppBackground from './AppBackground'; +import { AppBackground } from './AppBackground'; import View from './common/View'; -import DevelopmentTopBar from './DevelopmentTopBar'; -import FatalError from './FatalError'; -import FinancesApp from './FinancesApp'; +import { DevelopmentTopBar } from './DevelopmentTopBar'; +import { FatalError } from './FatalError'; +import { FinancesApp } from './FinancesApp'; import ManagementApp from './manager/ManagementApp'; -import MobileWebMessage from './MobileWebMessage'; -import UpdateNotification from './UpdateNotification'; +import { MobileWebMessage } from './MobileWebMessage'; +import { UpdateNotification } from './UpdateNotification'; -type AppProps = { +type AppInnerProps = { budgetId: string; cloudFileId: string; loadingText: string; @@ -40,14 +40,14 @@ type AppProps = { loadGlobalPrefs: () => Promise; }; -function App({ +function AppInner({ budgetId, cloudFileId, loadingText, loadBudget, closeBudget, loadGlobalPrefs, -}: AppProps) { +}: AppInnerProps) { const [initializing, setInitializing] = useState(true); const { showBoundary: showErrorBoundary } = useErrorBoundary(); @@ -121,7 +121,7 @@ function ErrorFallback({ error }: FallbackProps) { ); } -function AppWrapper() { +export function App() { const budgetId = useSelector( state => state.prefs.local && state.prefs.local.id, ); @@ -178,7 +178,7 @@ function AppWrapper() { {process.env.REACT_APP_REVIEW_ID && !Platform.isPlaywright && ( )} - ); } - -export default AppWrapper; diff --git a/packages/desktop-client/src/components/AppBackground.tsx b/packages/desktop-client/src/components/AppBackground.tsx index b23e84af6a..258ded5153 100644 --- a/packages/desktop-client/src/components/AppBackground.tsx +++ b/packages/desktop-client/src/components/AppBackground.tsx @@ -5,7 +5,7 @@ import { css } from 'glamor'; import AnimatedLoading from '../icons/AnimatedLoading'; import { theme } from '../style'; -import Background from './Background'; +import { Background } from './Background'; import Block from './common/Block'; import View from './common/View'; @@ -14,7 +14,10 @@ type AppBackgroundProps = { loadingText?: string; }; -function AppBackground({ initializing, loadingText }: AppBackgroundProps) { +export function AppBackground({ + initializing, + loadingText, +}: AppBackgroundProps) { return ( <> @@ -41,5 +44,3 @@ function AppBackground({ initializing, loadingText }: AppBackgroundProps) { ); } - -export default AppBackground; diff --git a/packages/desktop-client/src/components/Background.tsx b/packages/desktop-client/src/components/Background.tsx index 3f2c687b50..3aa8f367b3 100644 --- a/packages/desktop-client/src/components/Background.tsx +++ b/packages/desktop-client/src/components/Background.tsx @@ -4,7 +4,7 @@ import { theme } from '../style'; import { LoadComponent } from './util/LoadComponent'; -export default function Background() { +export function Background() { return (
state.account.accountsSyncing); const name = accountsSyncing diff --git a/packages/desktop-client/src/components/DevelopmentTopBar.tsx b/packages/desktop-client/src/components/DevelopmentTopBar.tsx index a98533e64c..f163863fa7 100644 --- a/packages/desktop-client/src/components/DevelopmentTopBar.tsx +++ b/packages/desktop-client/src/components/DevelopmentTopBar.tsx @@ -3,7 +3,7 @@ import { theme } from '../style'; import ExternalLink from './common/ExternalLink'; import View from './common/View'; -export default function DevelopmentTopBar() { +export function DevelopmentTopBar() { return ( ); } - -export default FatalError; diff --git a/packages/desktop-client/src/components/FinancesApp.tsx b/packages/desktop-client/src/components/FinancesApp.tsx index 1d79cce61a..c14a616368 100644 --- a/packages/desktop-client/src/components/FinancesApp.tsx +++ b/packages/desktop-client/src/components/FinancesApp.tsx @@ -25,21 +25,21 @@ import { theme } from '../style'; import { ExposeNavigate } from '../util/router-tools'; import { getIsOutdated, getLatestVersion } from '../util/versions'; -import BankSyncStatus from './BankSyncStatus'; +import { BankSyncStatus } from './BankSyncStatus'; import { BudgetMonthCountProvider } from './budget/BudgetMonthCountContext'; import View from './common/View'; -import GlobalKeys from './GlobalKeys'; +import { GlobalKeys } from './GlobalKeys'; import { ManageRulesPage } from './ManageRulesPage'; import MobileNavTabs from './mobile/MobileNavTabs'; -import Modals from './Modals'; -import Notifications from './Notifications'; +import { Modals } from './Modals'; +import { Notifications } from './Notifications'; import { ManagePayeesPage } from './payees/ManagePayeesPage'; import Reports from './reports'; import { NarrowAlternate, WideComponent } from './responsive'; -import ScrollProvider from './ScrollProvider'; +import { ScrollProvider } from './ScrollProvider'; import Settings from './settings'; import FloatableSidebar, { SidebarProvider } from './sidebar'; -import Titlebar, { TitlebarProvider } from './Titlebar'; +import { Titlebar, TitlebarProvider } from './Titlebar'; import { TransactionEdit } from './transactions/MobileTransaction'; function NarrowNotSupported({ @@ -92,7 +92,7 @@ function RouterBehaviors({ getAccounts }) { return null; } -function FinancesApp() { +function FinancesAppWithoutContext() { const actions = useActions(); useEffect(() => { // The default key handler scope @@ -256,8 +256,8 @@ function FinancesApp() { ); } -export default function FinancesAppWithContext() { - const app = useMemo(() => , []); +export function FinancesApp() { + const app = useMemo(() => , []); return ( diff --git a/packages/desktop-client/src/components/FixedSizeList.tsx b/packages/desktop-client/src/components/FixedSizeList.tsx index f94bc890db..d7dd84d8e2 100644 --- a/packages/desktop-client/src/components/FixedSizeList.tsx +++ b/packages/desktop-client/src/components/FixedSizeList.tsx @@ -73,7 +73,7 @@ type FixedSizeListState = { scrollUpdateWasRequested: boolean; }; -export default class FixedSizeList extends PureComponent< +export class FixedSizeList extends PureComponent< FixedSizeListProps, FixedSizeListState > { diff --git a/packages/desktop-client/src/components/GlobalKeys.ts b/packages/desktop-client/src/components/GlobalKeys.ts index edcfe148aa..11b72693a7 100644 --- a/packages/desktop-client/src/components/GlobalKeys.ts +++ b/packages/desktop-client/src/components/GlobalKeys.ts @@ -4,7 +4,7 @@ import * as Platform from 'loot-core/src/client/platform'; import useNavigate from '../hooks/useNavigate'; -export default function GlobalKeys() { +export function GlobalKeys() { const navigate = useNavigate(); useEffect(() => { const handleKeys = e => { diff --git a/packages/desktop-client/src/components/LoggedInUser.tsx b/packages/desktop-client/src/components/LoggedInUser.tsx index 91418dc071..02db70b5d3 100644 --- a/packages/desktop-client/src/components/LoggedInUser.tsx +++ b/packages/desktop-client/src/components/LoggedInUser.tsx @@ -16,7 +16,7 @@ type LoggedInUserProps = { style?: CSSProperties; color?: string; }; -export default function LoggedInUser({ +export function LoggedInUser({ hideIfNoServer, style, color, diff --git a/packages/desktop-client/src/components/ManageRules.tsx b/packages/desktop-client/src/components/ManageRules.tsx index e9fe97548d..5d921053e3 100644 --- a/packages/desktop-client/src/components/ManageRules.tsx +++ b/packages/desktop-client/src/components/ManageRules.tsx @@ -327,7 +327,7 @@ type ManageRulesProps = { setLoading?: Dispatch>; }; -export default function ManageRules({ +export function ManageRules({ isModal, payeeId, setLoading = () => {}, diff --git a/packages/desktop-client/src/components/ManageRulesPage.tsx b/packages/desktop-client/src/components/ManageRulesPage.tsx index e64f57e878..ad57e2bd2d 100644 --- a/packages/desktop-client/src/components/ManageRulesPage.tsx +++ b/packages/desktop-client/src/components/ManageRulesPage.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import ManageRules from './ManageRules'; +import { ManageRules } from './ManageRules'; import { Page } from './Page'; export function ManageRulesPage() { diff --git a/packages/desktop-client/src/components/MobileBackButton.tsx b/packages/desktop-client/src/components/MobileBackButton.tsx index 6ea749fdbb..061e8f03df 100644 --- a/packages/desktop-client/src/components/MobileBackButton.tsx +++ b/packages/desktop-client/src/components/MobileBackButton.tsx @@ -11,7 +11,7 @@ type MobileBackButtonProps = { style?: CSSProperties; }; -export default function MobileBackButton({ style }: MobileBackButtonProps) { +export function MobileBackButton({ style }: MobileBackButtonProps) { const navigate = useNavigate(); return (