Skip to content

Commit 96437e5

Browse files
committed
lint: apply fixes and resolve ESLint issues
- Wrap long template/script lines to satisfy max-len - Expose RouteName to template to avoid unused-var warning - Remove unused variable in demo index - Re-run lint:fix to ensure clean state
1 parent 0f39770 commit 96437e5

File tree

8 files changed

+27
-17
lines changed

8 files changed

+27
-17
lines changed

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import { nextTick } from '@/lib/nextTick';
5050
import Sidebar from './components/layouts/Sidebar.vue';
5151
import SwapNotification from './components/swap/SwapNotification.vue';
5252
import UpdateNotification from './components/UpdateNotification.vue';
53-
import router, { provideRouter } from './router';
53+
import router, { provideRouter, RouteName } from './router';
5454
import { useAccountStore } from './stores/Account';
5555
import { useSettingsStore } from './stores/Settings';
5656
import { useWindowSize } from './composables/useWindowSize';
@@ -110,7 +110,7 @@ export default defineComponent({
110110
await router.push({ name: router.currentRoute.name!, query: { sidebar: 'true' } });
111111
} else if (currentXPosition <= transactionsBarrier && (initialXPosition) > transactionsBarrier) {
112112
// Go to transactions
113-
if (router.currentRoute.name === 'root') {
113+
if (router.currentRoute.name === RouteName.Root) {
114114
await router.push('/transactions');
115115
}
116116
} else if (

src/components/AccountMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<script lang="ts">
2929
import { defineComponent, computed } from '@vue/composition-api';
3030
import { Identicon, MenuDotsIcon } from '@nimiq/vue-components';
31-
import { useRouter } from '@/router';
31+
import { useRouter, RouteName } from '@/router';
3232
3333
import LoginFileIcon from './icons/LoginFileIcon.vue';
3434
import LedgerIcon from './icons/LedgerIcon.vue';
@@ -56,7 +56,7 @@ export default defineComponent({
5656
&& addressState.addressInfos[activeAccountInfo.value.addresses[0]]);
5757
5858
function goToAccount(testForMenuOpening = true) {
59-
if (testForMenuOpening && router.currentRoute.name === 'root') {
59+
if (testForMenuOpening && router.currentRoute.name === RouteName.Root) {
6060
openMenu();
6161
return;
6262
}

src/components/AddressList.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import { useAccountStore } from '../stores/Account';
5555
import { useBtcAddressStore } from '../stores/BtcAddress';
5656
import { usePolygonAddressStore } from '../stores/PolygonAddress';
5757
import { CryptoCurrency } from '../lib/Constants';
58-
import router from '../router';
58+
import router, { RouteName } from '../router';
5959
import { useSettingsStore } from '../stores/Settings';
6060
import { useAccountSettingsStore } from '../stores/AccountSettings';
6161
import { useStakingStore } from '../stores/Staking';
@@ -142,7 +142,12 @@ export default defineComponent({
142142
watch(activeAddress, () => activeAddress.value && adjustBackgroundOffsetAndScale(activeAddress.value));
143143
/* Update the .active-box after the decimals setting is changed */
144144
router.afterEach((to, from) => {
145-
if (from.name === 'settings' && from.query.sidebar && to.name === 'root' && activeAddress.value) {
145+
if (
146+
from.name === RouteName.Settings
147+
&& from.query.sidebar
148+
&& to.name === RouteName.Root
149+
&& activeAddress.value
150+
) {
146151
nextTick(() =>
147152
activeAddress.value && adjustBackgroundOffsetAndScale(activeAddress.value),
148153
);

src/components/layouts/AccountOverview.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
</div>
3030

3131
<div class="mobile-menu-bar flex-row">
32-
<button class="reset menu-button" @click="$router.push({name: 'root', query: {sidebar: 'true'}})">
32+
<button
33+
class="reset menu-button"
34+
@click="$router.replace({ name: RouteName.Root, query: { sidebar: 'true' } })"
35+
>
3336
<MenuIcon/>
3437
<AttentionDot v-if="updateAvailable"/>
3538
</button>

src/components/layouts/Network.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<template>
22
<div class="network nq-blue-bg" :class="{'no-footer': !$config.enableBitcoin && !$config.polygon.enabled }">
33
<div class="menu-bar full-width flex-row">
4-
<button class="reset menu-button"
5-
@click="$router.push({ name: 'network', query: { sidebar: !router.currentRoute.query.sidebar } })">
4+
<button
5+
class="reset menu-button"
6+
@click="$router.push({
7+
name: RouteName.Network,
8+
query: { sidebar: !router.currentRoute.query.sidebar },
9+
})"
10+
>
611
<MenuIcon/>
712
<AttentionDot v-if="updateAvailable"/>
813
</button>
@@ -104,7 +109,7 @@ import MenuIcon from '../icons/MenuIcon.vue';
104109
import NetworkInfoModal from '../modals/NetworkInfoModal.vue';
105110
import AttentionDot from '../AttentionDot.vue';
106111
import FiatConvertedAmount from '../FiatConvertedAmount.vue';
107-
import router from '../../router';
112+
import router, { RouteName } from '../../router';
108113
109114
const LOCALSTORAGE_KEY = 'network-info-dismissed';
110115
@@ -197,6 +202,7 @@ export default defineComponent({
197202
btcFee,
198203
polygonFee,
199204
router,
205+
RouteName,
200206
stablecoin,
201207
};
202208
},

src/components/layouts/Settings.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="settings flex-row">
33
<div class="mobile-menu-bar flex-row">
4-
<button class="reset menu-button" @click="$router.push({name: 'settings', query: {sidebar: true}})">
4+
<button class="reset menu-button" @click="$router.push({name: RouteName.Settings, query: {sidebar: true}})">
55
<MenuIcon/>
66
</button>
77

src/lib/demo/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ let demoRouter: VueRouter;
5252
// Simple state tracking for current modal
5353
let currentModal: DemoFlowType = 'idle';
5454

55-
5655
// Demo modal imports for dynamic loading
5756
const DemoFallbackModal = () =>
5857
import(
@@ -105,7 +104,6 @@ export function dangerouslyInitializeDemo(router: VueRouter): void {
105104

106105
// Send initial ready message to parent frame
107106
sendInitialReadyMessage();
108-
109107
}
110108

111109
/**
@@ -138,7 +136,6 @@ function sendInitialReadyMessage(): void {
138136
* Adds routes pointing to our demo modals.
139137
*/
140138
function addDemoModalRoutes(): void {
141-
142139
// Import layout components for explicit inclusion
143140
const AccountOverview = () => import(/* webpackChunkName: "account-overview" */ '@/components/layouts/AccountOverview.vue');
144141
const AddressOverview = () => import(/* webpackChunkName: "address-overview" */ '@/components/layouts/AddressOverview.vue');
@@ -187,9 +184,8 @@ function attachIframeListeners(): void {
187184
});
188185

189186
// Monitor route changes to send modal open/close messages
190-
demoRouter.afterEach((to, from) => {
187+
demoRouter.afterEach((to) => {
191188
const newModal = getModalTypeFromPath(to.path);
192-
const oldModal = getModalTypeFromPath(from.path);
193189

194190
// Only send message if modal state actually changed
195191
if (newModal === currentModal) return;

src/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ function createActivationNavigationGuard(
579579
} else if (isUnsupportedAccount) {
580580
// unsupported account; go to main view
581581
next({
582-
name: 'root',
582+
name: RouteName.Root,
583583
replace: true,
584584
});
585585
} else {

0 commit comments

Comments
 (0)