Skip to content

Commit

Permalink
feat(refactor): Remove semi (#2356)
Browse files Browse the repository at this point in the history
  • Loading branch information
rossbulat authored Dec 4, 2024
1 parent 85a12d5 commit 4c10b19
Show file tree
Hide file tree
Showing 849 changed files with 15,976 additions and 16,065 deletions.
4 changes: 2 additions & 2 deletions env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
// SPDX-License-Identifier: GPL-3.0-only

declare module '*.module.scss' {
const classes: Record<string, string>;
export default classes;
const classes: Record<string, string>
export default classes
}
29 changes: 18 additions & 11 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import pluginJs from '@eslint/js';
import importPlugin from 'eslint-plugin-import';
import preferArrowFunctions from 'eslint-plugin-prefer-arrow-functions';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import unusedImports from 'eslint-plugin-unused-imports';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import pluginJs from '@eslint/js'
import importPlugin from 'eslint-plugin-import'
import preferArrowFunctions from 'eslint-plugin-prefer-arrow-functions'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import unusedImports from 'eslint-plugin-unused-imports'
import globals from 'globals'
import tseslint from 'typescript-eslint'

/** @type {import('eslint').Linter.Config[]} */
export default [
Expand Down Expand Up @@ -83,6 +83,13 @@ export default [
},
},
rules: {
// Prettier
'prettier/prettier': [
'error',
{
semi: false,
},
],
// Stylistic
curly: 'error',
'arrow-body-style': ['error', 'as-needed'],
Expand All @@ -104,7 +111,7 @@ export default [
caughtErrors: 'none',
},
],
semi: [2, 'always'],
semi: ['error', 'never'],
'import/extensions': [
'error',
'ignorePackages',
Expand Down Expand Up @@ -144,4 +151,4 @@ export default [
'@typescript-eslint/no-shadow': 'error',
},
},
];
]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"arrowParens": "always",
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"semi": false,
"singleQuote": true,
"endOfLine": "auto",
"plugins": [
Expand Down
4 changes: 2 additions & 2 deletions packages/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
/>

<script type="module">
import { Buffer } from 'buffer';
window.Buffer = Buffer;
import { Buffer } from 'buffer'
window.Buffer = Buffer
</script>

<script src="/lottie/player.js"></script>
Expand Down
14 changes: 7 additions & 7 deletions packages/app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import { ActiveAccountsProvider } from 'contexts/ActiveAccounts';
import { NetworkProvider } from 'contexts/Network';
import { ThemesProvider } from 'contexts/Themes';
import { i18next } from 'locales';
import { Providers } from 'Providers';
import { I18nextProvider } from 'react-i18next';
import { ActiveAccountsProvider } from 'contexts/ActiveAccounts'
import { NetworkProvider } from 'contexts/Network'
import { ThemesProvider } from 'contexts/Themes'
import { i18next } from 'locales'
import { Providers } from 'Providers'
import { I18nextProvider } from 'react-i18next'

export const App = () => (
<I18nextProvider i18n={i18next}>
Expand All @@ -18,4 +18,4 @@ export const App = () => (
</NetworkProvider>
</ThemesProvider>
</I18nextProvider>
);
)
86 changes: 43 additions & 43 deletions packages/app/src/Providers.tsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import { withProviders } from '@w3ux/factories';
import { withProviders } from '@w3ux/factories'
import {
ExtensionAccountsProvider,
ExtensionsProvider,
LedgerAccountsProvider,
VaultAccountsProvider,
WCAccountsProvider,
} from '@w3ux/react-connect-kit';
import { DappName } from 'consts';
import { useActiveAccounts } from 'contexts/ActiveAccounts';
import { APIProvider } from 'contexts/Api';
import { BalancesProvider } from 'contexts/Balances';
import { BondedProvider } from 'contexts/Bonded';
import { CommunityProvider } from 'contexts/Community';
import { ExternalAccountsProvider } from 'contexts/Connect/ExternalAccounts';
import { ImportedAccountsProvider } from 'contexts/Connect/ImportedAccounts';
import { OtherAccountsProvider } from 'contexts/Connect/OtherAccounts';
import { FastUnstakeProvider } from 'contexts/FastUnstake';
import { FiltersProvider } from 'contexts/Filters';
import { HelpProvider } from 'contexts/Help';
import { LedgerHardwareProvider } from 'contexts/LedgerHardware';
import { MenuProvider } from 'contexts/Menu';
import { MigrateProvider } from 'contexts/Migrate';
import { useNetwork } from 'contexts/Network';
import { PayoutsProvider } from 'contexts/Payouts';
import { PluginsProvider } from 'contexts/Plugins';
import { ActivePoolProvider } from 'contexts/Pools/ActivePool';
import { BondedPoolsProvider } from 'contexts/Pools/BondedPools';
import { FavoritePoolsProvider } from 'contexts/Pools/FavoritePools';
import { JoinPoolsProvider } from 'contexts/Pools/JoinPools';
import { PoolMembersProvider } from 'contexts/Pools/PoolMembers';
import { PoolPerformanceProvider } from 'contexts/Pools/PoolPerformance';
import { PromptProvider } from 'contexts/Prompt';
import { ProxiesProvider } from 'contexts/Proxies';
import { SetupProvider } from 'contexts/Setup';
import { StakingProvider } from 'contexts/Staking';
import { TooltipProvider } from 'contexts/Tooltip';
import { TransferOptionsProvider } from 'contexts/TransferOptions';
import { TxMetaProvider } from 'contexts/TxMeta';
import { UIProvider } from 'contexts/UI';
import { FavoriteValidatorsProvider } from 'contexts/Validators/FavoriteValidators';
import { ValidatorsProvider } from 'contexts/Validators/ValidatorEntries';
import { WalletConnectProvider } from 'contexts/WalletConnect';
import { OverlayProvider } from 'kits/Overlay/Provider';
import { ThemedRouter } from 'Themes';
} from '@w3ux/react-connect-kit'
import { DappName } from 'consts'
import { useActiveAccounts } from 'contexts/ActiveAccounts'
import { APIProvider } from 'contexts/Api'
import { BalancesProvider } from 'contexts/Balances'
import { BondedProvider } from 'contexts/Bonded'
import { CommunityProvider } from 'contexts/Community'
import { ExternalAccountsProvider } from 'contexts/Connect/ExternalAccounts'
import { ImportedAccountsProvider } from 'contexts/Connect/ImportedAccounts'
import { OtherAccountsProvider } from 'contexts/Connect/OtherAccounts'
import { FastUnstakeProvider } from 'contexts/FastUnstake'
import { FiltersProvider } from 'contexts/Filters'
import { HelpProvider } from 'contexts/Help'
import { LedgerHardwareProvider } from 'contexts/LedgerHardware'
import { MenuProvider } from 'contexts/Menu'
import { MigrateProvider } from 'contexts/Migrate'
import { useNetwork } from 'contexts/Network'
import { PayoutsProvider } from 'contexts/Payouts'
import { PluginsProvider } from 'contexts/Plugins'
import { ActivePoolProvider } from 'contexts/Pools/ActivePool'
import { BondedPoolsProvider } from 'contexts/Pools/BondedPools'
import { FavoritePoolsProvider } from 'contexts/Pools/FavoritePools'
import { JoinPoolsProvider } from 'contexts/Pools/JoinPools'
import { PoolMembersProvider } from 'contexts/Pools/PoolMembers'
import { PoolPerformanceProvider } from 'contexts/Pools/PoolPerformance'
import { PromptProvider } from 'contexts/Prompt'
import { ProxiesProvider } from 'contexts/Proxies'
import { SetupProvider } from 'contexts/Setup'
import { StakingProvider } from 'contexts/Staking'
import { TooltipProvider } from 'contexts/Tooltip'
import { TransferOptionsProvider } from 'contexts/TransferOptions'
import { TxMetaProvider } from 'contexts/TxMeta'
import { UIProvider } from 'contexts/UI'
import { FavoriteValidatorsProvider } from 'contexts/Validators/FavoriteValidators'
import { ValidatorsProvider } from 'contexts/Validators/ValidatorEntries'
import { WalletConnectProvider } from 'contexts/WalletConnect'
import { OverlayProvider } from 'kits/Overlay/Provider'
import { ThemedRouter } from 'Themes'

export const Providers = () => {
const {
network,
networkData: { ss58 },
} = useNetwork();
const { activeAccount, setActiveAccount } = useActiveAccounts();
} = useNetwork()
const { activeAccount, setActiveAccount } = useActiveAccounts()

return withProviders(
// !! Provider order matters.
Expand Down Expand Up @@ -103,5 +103,5 @@ export const Providers = () => {
CommunityProvider,
],
ThemedRouter
);
};
)
}
90 changes: 45 additions & 45 deletions packages/app/src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import { extractUrlValue } from '@w3ux/utils';
import { PagesConfig } from 'config/pages';
import { useActiveAccounts } from 'contexts/ActiveAccounts';
import { useImportedAccounts } from 'contexts/Connect/ImportedAccounts';
import { useOtherAccounts } from 'contexts/Connect/OtherAccounts';
import { useNetwork } from 'contexts/Network';
import { useUi } from 'contexts/UI';
import { Notifications } from 'controllers/Notifications';
import { ErrorFallbackApp, ErrorFallbackRoutes } from 'library/ErrorBoundary';
import { Headers } from 'library/Headers';
import { Help } from 'library/Help';
import { Menu } from 'library/Menu';
import { NetworkBar } from 'library/NetworkBar';
import { NotificationPrompts } from 'library/NotificationPrompts';
import { Offline } from 'library/Offline';
import { PageWithTitle } from 'library/PageWithTitle';
import { Prompt } from 'library/Prompt';
import { SideMenu } from 'library/SideMenu';
import { Tooltip } from 'library/Tooltip';
import { Overlays } from 'overlay';
import { useEffect, useRef } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { useTranslation } from 'react-i18next';
import { extractUrlValue } from '@w3ux/utils'
import { PagesConfig } from 'config/pages'
import { useActiveAccounts } from 'contexts/ActiveAccounts'
import { useImportedAccounts } from 'contexts/Connect/ImportedAccounts'
import { useOtherAccounts } from 'contexts/Connect/OtherAccounts'
import { useNetwork } from 'contexts/Network'
import { useUi } from 'contexts/UI'
import { Notifications } from 'controllers/Notifications'
import { ErrorFallbackApp, ErrorFallbackRoutes } from 'library/ErrorBoundary'
import { Headers } from 'library/Headers'
import { Help } from 'library/Help'
import { Menu } from 'library/Menu'
import { NetworkBar } from 'library/NetworkBar'
import { NotificationPrompts } from 'library/NotificationPrompts'
import { Offline } from 'library/Offline'
import { PageWithTitle } from 'library/PageWithTitle'
import { Prompt } from 'library/Prompt'
import { SideMenu } from 'library/SideMenu'
import { Tooltip } from 'library/Tooltip'
import { Overlays } from 'overlay'
import { useEffect, useRef } from 'react'
import { ErrorBoundary } from 'react-error-boundary'
import { useTranslation } from 'react-i18next'
import {
HashRouter,
Navigate,
Route,
Routes,
useLocation,
} from 'react-router-dom';
import { Body, Main } from 'ui-structure';
} from 'react-router-dom'
import { Body, Main } from 'ui-structure'

const RouterInner = () => {
const { t } = useTranslation();
const { network } = useNetwork();
const { pathname } = useLocation();
const { setContainerRefs } = useUi();
const { accounts } = useImportedAccounts();
const { accountsInitialised } = useOtherAccounts();
const { activeAccount, setActiveAccount } = useActiveAccounts();
const { t } = useTranslation()
const { network } = useNetwork()
const { pathname } = useLocation()
const { setContainerRefs } = useUi()
const { accounts } = useImportedAccounts()
const { accountsInitialised } = useOtherAccounts()
const { activeAccount, setActiveAccount } = useActiveAccounts()

// References to outer container.
const mainInterfaceRef = useRef<HTMLDivElement>(null);
const mainInterfaceRef = useRef<HTMLDivElement>(null)

// Scroll to top of the window on every page change or network change.
useEffect(() => {
window.scrollTo(0, 0);
}, [pathname, network]);
window.scrollTo(0, 0)
}, [pathname, network])

// Set container references to UI context and make available throughout app.
useEffect(() => {
setContainerRefs({
mainInterface: mainInterfaceRef,
});
}, []);
})
}, [])

// Open default account modal if url var present and accounts initialised.
useEffect(() => {
if (accountsInitialised) {
const aUrl = extractUrlValue('a');
const aUrl = extractUrlValue('a')
if (aUrl) {
const account = accounts.find((a) => a.address === aUrl);
const account = accounts.find((a) => a.address === aUrl)
if (account && aUrl !== activeAccount) {
setActiveAccount(account.address || null);
setActiveAccount(account.address || null)

Notifications.emit({
title: t('accountConnected', { ns: 'library' }),
subtitle: `${t('connectedTo', { ns: 'library' })} ${
account.name || aUrl
}.`,
});
})
}
}
}
}, [accountsInitialised]);
}, [accountsInitialised])

return (
<ErrorBoundary FallbackComponent={ErrorFallbackApp}>
Expand Down Expand Up @@ -110,11 +110,11 @@ const RouterInner = () => {
<NetworkBar />
<Offline />
</ErrorBoundary>
);
};
)
}

export const Router = () => (
<HashRouter basename="/">
<RouterInner />
</HashRouter>
);
)
Loading

0 comments on commit 4c10b19

Please sign in to comment.