Skip to content

Commit 91c8611

Browse files
committed
Merge branch 'frontend-lint-with-stylistic'
2 parents f272008 + b60ccf5 commit 91c8611

File tree

208 files changed

+540
-529
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+540
-529
lines changed

frontends/web/eslint.config.mjs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export default tseslint.config(
2626
'brace-style': ['error', '1tbs'],
2727
'comma-spacing': ['error', { 'before': false, 'after': true }],
2828
'curly': 'error',
29-
'indent': ['error', 2, { 'SwitchCase': 0 }],
3029
'jsx-a11y/anchor-is-valid': 0,
3130
'jsx-a11y/alt-text' : 0,
3231
'jsx-quotes': ['error', 'prefer-double'],
@@ -36,7 +35,6 @@ export default tseslint.config(
3635
'no-trailing-spaces': 'error',
3736
'object-curly-spacing': ['error', 'always'],
3837
'quotes': ['error', 'single'],
39-
'semi': 'error',
4038
'space-before-blocks': ['error', 'always'],
4139
'space-in-parens': ['error', 'never'],
4240
'no-extra-semi': 'error',
@@ -63,6 +61,19 @@ export default tseslint.config(
6361
'logical': 'parens-new-line'
6462
}],
6563
'@stylistic/type-generic-spacing': ['error'],
64+
'@stylistic/indent': ['error', 2, { "SwitchCase": 0 }],
65+
'@stylistic/semi': ["error", "always"],
66+
'@stylistic/member-delimiter-style': ['error', {
67+
"multiline": {
68+
"delimiter": "semi",
69+
"requireLast": true
70+
},
71+
"singleline": {
72+
"delimiter": "semi",
73+
"requireLast": false
74+
},
75+
"multilineDetection": "brackets"
76+
}],
6677
},
6778
},
6879
{

frontends/web/src/api/account.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type AccountCode = string;
2727

2828
export type Fiat = 'AUD' | 'BRL' | 'BTC' | 'CAD' | 'CHF' | 'CNY' | 'CZK' | 'EUR' | 'GBP' | 'HKD' | 'ILS' | 'JPY' | 'KRW' | 'NOK' | 'NZD' | 'PLN' | 'RUB' | 'sat' | 'SEK' | 'SGD' | 'USD';
2929

30-
export type ConversionUnit = Fiat | 'sat'
30+
export type ConversionUnit = Fiat | 'sat';
3131

3232
export type CoinUnit = 'BTC' | 'sat' | 'LTC' | 'ETH' | 'TBTC' | 'tsat' | 'TLTC' | 'SEPETH';
3333

@@ -40,7 +40,7 @@ export type CoinCode = NativeCoinCode | ERC20CoinCode;
4040
export type FiatWithDisplayName = {
4141
currency: Fiat;
4242
displayName: string;
43-
}
43+
};
4444

4545
export type Terc20Token = {
4646
code: ERC20CoinCode;
@@ -51,7 +51,7 @@ export type Terc20Token = {
5151
export type TActiveToken = {
5252
tokenCode: ERC20CoinCode;
5353
accountCode: AccountCode;
54-
}
54+
};
5555

5656
export type TKeystore = {
5757
watchonly: boolean;
@@ -74,7 +74,7 @@ export type TAccount = {
7474
activeTokens?: TActiveToken[];
7575
blockExplorerTxPrefix: string;
7676
bitsuranceStatus?: TDetailStatus;
77-
}
77+
};
7878

7979
export const getAccounts = (): Promise<TAccount[]> => {
8080
return apiGet('accounts');
@@ -110,7 +110,7 @@ export type TAccountsBalanceSummaryResponse = {
110110
accountsBalanceSummary: TAccountsBalanceSummary;
111111
} | {
112112
success: false;
113-
}
113+
};
114114

115115
export const getAccountsBalanceSummary = (): Promise<TAccountsBalanceSummaryResponse> => {
116116
return apiGet('accounts/balance-summary');
@@ -119,7 +119,7 @@ export const getAccountsBalanceSummary = (): Promise<TAccountsBalanceSummaryResp
119119
type TEthAccountCodeAndNameByAddress = SuccessResponse & {
120120
code: AccountCode;
121121
name: string;
122-
}
122+
};
123123

124124
export const getEthAccountCodeAndNameByAddress = (address: string): Promise<TEthAccountCodeAndNameByAddress> => {
125125
return apiPost('accounts/eth-account-code', { address });
@@ -130,7 +130,7 @@ export type TStatus = {
130130
synced: boolean;
131131
fatalError: boolean;
132132
offlineError: string | null;
133-
}
133+
};
134134

135135
export const getStatus = (code: AccountCode): Promise<TStatus> => {
136136
return apiGet(`account/${code}/status`);
@@ -144,28 +144,28 @@ type TKeyInfo = {
144144
keypath: string;
145145
rootFingerprint: string;
146146
xpub: string;
147-
}
147+
};
148148

149149
export type TBitcoinSimple = {
150150
keyInfo: TKeyInfo;
151151
scriptType: ScriptType;
152-
}
152+
};
153153

154154
export type TEthereumSimple = {
155155
keyInfo: TKeyInfo;
156-
}
156+
};
157157

158158
export type TSigningConfiguration = {
159159
bitcoinSimple: TBitcoinSimple;
160160
ethereumSimple?: never;
161161
} | {
162162
bitcoinSimple?: never;
163163
ethereumSimple: TEthereumSimple;
164-
}
164+
};
165165

166166
export type TSigningConfigurationList = null | {
167167
signingConfigurations: TSigningConfiguration[];
168-
}
168+
};
169169

170170
export const getInfo = (code: AccountCode) => {
171171
return (): Promise<TSigningConfigurationList> => {
@@ -188,7 +188,7 @@ type TChartDataResponse = {
188188
data: TChartData;
189189
} | {
190190
success: false;
191-
}
191+
};
192192

193193
export type TChartData = {
194194
chartDataMissing: boolean;
@@ -199,7 +199,7 @@ export type TChartData = {
199199
formattedChartTotal: string | null;
200200
chartIsUpToDate: boolean; // only valid if chartDataMissing is false
201201
lastTimestamp: number;
202-
}
202+
};
203203

204204
export const getChartData = (): Promise<TChartDataResponse> => {
205205
return apiGet('chart-data');
@@ -228,7 +228,7 @@ type TBalanceResponse = {
228228
balance: TBalance;
229229
} | {
230230
success: false;
231-
}
231+
};
232232

233233
export const getBalance = (code: AccountCode): Promise<TBalanceResponse> => {
234234
return apiGet(`account/${code}/balance`);
@@ -257,14 +257,14 @@ export type TTransaction = {
257257
txID: string;
258258
vsize: number;
259259
weight: number;
260-
}
260+
};
261261

262-
export type TTransactions = { success: false } | { success: true; list: TTransaction[]; };
262+
export type TTransactions = { success: false } | { success: true; list: TTransaction[] };
263263

264264
type TNoteTx = {
265265
internalTxID: string;
266266
note: string;
267-
}
267+
};
268268

269269
export const postNotesTx = (code: AccountCode, {
270270
internalTxID,
@@ -285,7 +285,7 @@ type TExport = {
285285
success: boolean;
286286
path: string;
287287
errorMessage: string;
288-
}
288+
};
289289

290290
export const exportAccount = (code: AccountCode): Promise<TExport | null> => {
291291
return apiPost(`account/${code}/export`);
@@ -294,19 +294,19 @@ export const exportAccount = (code: AccountCode): Promise<TExport | null> => {
294294
export const verifyXPub = (
295295
code: AccountCode,
296296
signingConfigIndex: number,
297-
): Promise<{ success: true; } | { success: false; errorMessage: string; }> => {
297+
): Promise<{ success: true } | { success: false; errorMessage: string }> => {
298298
return apiPost(`account/${code}/verify-extended-public-key`, { signingConfigIndex });
299299
};
300300

301301
export type TReceiveAddress = {
302302
addressID: string;
303303
address: string;
304-
}
304+
};
305305

306306
export type TReceiveAddressList = {
307307
scriptType: ScriptType | null;
308308
addresses: NonEmptyArray<TReceiveAddress>;
309-
}
309+
};
310310

311311
export const getReceiveAddressList = (code: AccountCode) => {
312312
return (): Promise<NonEmptyArray<TReceiveAddressList> | null> => {
@@ -371,12 +371,12 @@ export type FeeTargetCode = 'custom' | 'low' | 'economy' | 'normal' | 'high' | '
371371
export type TFeeTarget = {
372372
code: FeeTargetCode;
373373
feeRateInfo: string;
374-
}
374+
};
375375

376376
export type TFeeTargetList = {
377377
feeTargets: TFeeTarget[];
378378
defaultFeeTarget: FeeTargetCode;
379-
}
379+
};
380380

381381
export const getFeeTargetList = (code: AccountCode): Promise<TFeeTargetList> => {
382382
return apiGet(`account/${code}/fee-targets`);
@@ -429,7 +429,7 @@ export type TAddAccount = {
429429
accountCode?: string;
430430
errorCode?: 'accountAlreadyExists' | 'accountLimitReached';
431431
errorMessage?: string;
432-
}
432+
};
433433

434434
export const addAccount = (coinCode: string, name: string): Promise<TAddAccount> => {
435435
return apiPost('account-add', {
@@ -438,7 +438,7 @@ export const addAccount = (coinCode: string, name: string): Promise<TAddAccount>
438438
});
439439
};
440440

441-
export type TSignMessage = { success: false, aborted?: boolean; errorMessage?: string; } | { success: true; signature: string; }
441+
export type TSignMessage = { success: false; aborted?: boolean; errorMessage?: string } | { success: true; signature: string };
442442

443443
export type TSignWalletConnectTx = {
444444
success: false;
@@ -448,7 +448,7 @@ export type TSignWalletConnectTx = {
448448
success: true;
449449
txHash: string;
450450
rawTx: string;
451-
}
451+
};
452452

453453
export const ethSignMessage = (code: AccountCode, message: string): Promise<TSignMessage> => {
454454
return apiPost(`account/${code}/eth-sign-msg`, message);
@@ -470,7 +470,7 @@ type AddressSignResponse = {
470470
success: false;
471471
errorMessage?: string;
472472
errorCode?: 'userAbort' | 'wrongKeystore';
473-
}
473+
};
474474

475475
export const signAddress = (format: ScriptType | '', msg: string, code: AccountCode): Promise<AddressSignResponse> => {
476476
return apiPost(`account/${code}/sign-address`, { format, msg, code });

frontends/web/src/api/aopp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { subscribeEndpoint } from './subscribe';
2323
type TAccount = {
2424
name: string;
2525
code: AccountCode;
26-
}
26+
};
2727

2828
type Accounts = NonEmptyArray<TAccount>;
2929

frontends/web/src/api/backend.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type TCoin = {
2424
name: string;
2525
canAddAccount: boolean;
2626
suggestedAccountName: string;
27-
}
27+
};
2828

2929
// In other places we use type { FailResponse, SuccessResponse } from './response'
3030
// which has slightly different FailResponse structure ( message?: string; code?: number)
@@ -33,7 +33,7 @@ type TSuccess = {
3333
success: boolean;
3434
errorMessage?: string;
3535
errorCode?: string;
36-
}
36+
};
3737

3838
export const getSupportedCoins = (): Promise<TCoin[]> => {
3939
return apiGet('supported-coins');
@@ -67,7 +67,7 @@ export const getDevServers = (): Promise<boolean> => {
6767
return apiGet('dev-servers');
6868
};
6969

70-
type TQRCode = FailResponse | (SuccessResponse & { data: string; });
70+
type TQRCode = FailResponse | (SuccessResponse & { data: string });
7171

7272
export const getQRCode = (data: string) => {
7373
return (): Promise<TQRCode> => {
@@ -147,7 +147,7 @@ export const exportLogs = (): Promise<TSuccess> => {
147147
return apiPost('export-log');
148148
};
149149

150-
export const exportNotes = (): Promise<(FailResponse & { aborted: boolean; }) | SuccessResponse> => {
150+
export const exportNotes = (): Promise<(FailResponse & { aborted: boolean }) | SuccessResponse> => {
151151
return apiPost('notes/export');
152152
};
153153

@@ -156,7 +156,7 @@ type TImportNotes = {
156156
transactionCount: number;
157157
};
158158

159-
export const importNotes = (fileContents: ArrayBuffer): Promise<FailResponse | (SuccessResponse & { data: TImportNotes; })> => {
159+
export const importNotes = (fileContents: ArrayBuffer): Promise<FailResponse | (SuccessResponse & { data: TImportNotes })> => {
160160
const hexString = Array.from(new Uint8Array(fileContents))
161161
.map(byte => byte.toString(16).padStart(2, '0'))
162162
.join('');

frontends/web/src/api/backup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type Backup = {
2727
type BackupResponse = {
2828
success: true;
2929
backups: Backup[];
30-
}
30+
};
3131

3232
export const getBackupList = (
3333
deviceID: string

frontends/web/src/api/backupBanner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type TShowBackupBannerResponse = {
2424
success: true;
2525
show: boolean;
2626
fiat: Fiat;
27-
threshold: string
27+
threshold: string;
2828
};
2929

3030
export const getShowBackupBanner = (rootFingerprint: string): Promise<TShowBackupBannerResponse> => {

frontends/web/src/api/banners.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ import { subscribeEndpoint, TUnsubscribe } from './subscribe';
2020

2121
export type TBannerInfo = {
2222
id: string;
23-
message: { [key: string]: string; };
23+
message: { [key: string]: string };
2424
link?: {
2525
href: string;
2626
text?: string;
2727
};
2828
dismissible?: boolean;
2929
type?: TMessageTypes;
30-
}
30+
};
3131

3232
export const getBanner = (msgKey: string): Promise<TBannerInfo> => {
3333
return apiGet(`banners/${msgKey}`);

frontends/web/src/api/bitbox02.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type DeviceInfo = {
3232
firmwareVersion: string;
3333
enabled: boolean;
3434
};
35-
}
35+
};
3636

3737
type DeviceInfoResponse = SuccessResponse & {
3838
deviceInfo: DeviceInfo;
@@ -82,11 +82,11 @@ type VersionInfoCommon = {
8282
canBackupWithRecoveryWords: boolean;
8383
canCreate12Words: boolean;
8484
canBIP85: boolean;
85-
}
85+
};
8686

8787
export type VersionInfo = VersionInfoCommon & (
88-
{ canUpgrade: true, newVersion: string; } |
89-
{ canUpgrade: false; })
88+
{ canUpgrade: true; newVersion: string } |
89+
{ canUpgrade: false });
9090

9191
export const getVersion = (
9292
deviceID: string
@@ -110,7 +110,7 @@ export const verifyAttestation = (
110110
export const checkBackup = (
111111
deviceID: string,
112112
silent: boolean,
113-
): Promise<FailResponse | (SuccessResponse & { backupID: string; })> => {
113+
): Promise<FailResponse | (SuccessResponse & { backupID: string })> => {
114114
return apiPost(`devices/bitbox02/${deviceID}/backups/check`, { silent });
115115
};
116116

0 commit comments

Comments
 (0)