Skip to content

Commit 595ada1

Browse files
committed
refactor: linting
1 parent 76705f5 commit 595ada1

12 files changed

Lines changed: 270 additions & 242 deletions

File tree

eslint.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ export default tseslint.config(
4545
"@typescript-eslint/array-type": ["error", { default: "generic" }],
4646
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
4747
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
48+
"@typescript-eslint/no-unnecessary-condition": "off",
4849
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
49-
"@typescript-eslint/switch-exhaustiveness-check": "error",
50+
"@typescript-eslint/switch-exhaustiveness-check": "off",
5051
"unicorn/better-regex": "error",
5152
"unicorn/consistent-function-scoping": "error",
5253
"unicorn/expiring-todo-comments": "error",

examples/borrow.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ async function main() {
5858
const isStableRate = false;
5959

6060
let maxStableRate;
61-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
6261
if (isStableRate) {
6362
const poolInfo = await FolksPool.read.poolInfo(tokenId);
6463
const interestRate = poolInfo.stableBorrowData.interestRate[0];

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,20 @@
4949
"@commitlint/cz-commitlint": "^19.8.1",
5050
"@eslint/js": "^9.39.4",
5151
"@types/node": "^20.19.37",
52-
"@typescript-eslint/parser": "^7.18.0",
52+
"@typescript-eslint/eslint-plugin": "^8.57.1",
53+
"@typescript-eslint/parser": "^8.57.1",
5354
"commitizen": "^4.3.1",
5455
"eslint": "^9.39.4",
5556
"eslint-config-prettier": "^9.1.2",
5657
"eslint-import-resolver-typescript": "^3.10.1",
5758
"eslint-plugin-import-x": "^0.5.3",
58-
"eslint-plugin-unicorn": "^53.0.0",
59+
"eslint-plugin-unicorn": "^63.0.0",
5960
"globals": "^15.15.0",
6061
"husky": "^9.1.7",
6162
"lint-staged": "^15.5.2",
6263
"prettier": "^3.8.1",
6364
"typescript": "^5.9.3",
64-
"typescript-eslint": "^7.18.0"
65+
"typescript-eslint": "^8.57.1"
6566
},
6667
"config": {
6768
"commitizen": {

pnpm-lock.yaml

Lines changed: 238 additions & 215 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/chains/evm/common/utils/contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function sendERC20Approve(
5858

5959
// approve if not enough
6060
if (allowance < amount)
61-
return await erc20.write.approve([spender, BigInt(amount)], {
61+
return await erc20.write.approve([spender, amount], {
6262
account: getEvmSignerAccount(signer),
6363
chain: signer.chain,
6464
});

src/chains/evm/hub/modules/folks-hub-account.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function getAccountInfo(
2323
const accountManager = getAccountManagerContract(provider, hubChain.accountManagerAddress);
2424

2525
// get chain ids to check
26-
folksChainIds = folksChainIds ? folksChainIds : getFolksChainIdsByNetwork(network);
26+
folksChainIds = folksChainIds ?? getFolksChainIdsByNetwork(network);
2727

2828
// define return variable
2929
const accountInfo: AccountInfo = {
@@ -74,7 +74,7 @@ export async function getAccountIdByAddress(
7474
const accountManager = getAccountManagerContract(provider, hubChain.accountManagerAddress);
7575

7676
// get chain ids to check
77-
folksChainIds = folksChainIds ? folksChainIds : getFolksChainIdsByNetwork(network);
77+
folksChainIds = folksChainIds ?? getFolksChainIdsByNetwork(network);
7878

7979
const accountIds = await multicall(provider, {
8080
contracts: folksChainIds.map((folksChainId) => ({

src/chains/evm/hub/modules/folks-hub-loan.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,20 +296,20 @@ export async function getLoanTypeInfo(
296296
isDeprecated,
297297
reward: {
298298
minimumAmount,
299-
collateralSpeed: [BigInt(collateralSpeed), 18],
300-
borrowSpeed: [BigInt(borrowSpeed), 18],
299+
collateralSpeed: [collateralSpeed, 18],
300+
borrowSpeed: [borrowSpeed, 18],
301301
collateralRewardIndex: calcRewardIndex(
302302
collateralUsed,
303303
minimumAmount,
304-
[BigInt(oldCollateralRewardIndex), 18],
305-
[BigInt(collateralSpeed), 18],
304+
[oldCollateralRewardIndex, 18],
305+
[collateralSpeed, 18],
306306
lastUpdateTimestamp,
307307
),
308308
borrowRewardIndex: calcRewardIndex(
309309
borrowUsed,
310310
minimumAmount,
311-
[BigInt(oldBorrowRewardIndex), 18],
312-
[BigInt(borrowSpeed), 18],
311+
[oldBorrowRewardIndex, 18],
312+
[borrowSpeed, 18],
313313
lastUpdateTimestamp,
314314
),
315315
},
@@ -319,7 +319,7 @@ export async function getLoanTypeInfo(
319319
return {
320320
loanTypeId,
321321
deprecated,
322-
loanTargetHealth: [BigInt(loanTargetHealth), 4],
322+
loanTargetHealth: [loanTargetHealth, 4],
323323
pools,
324324
};
325325
}

src/chains/evm/hub/modules/folks-hub-pool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ export async function getPoolInfo(
199199
averageInterestYield: compoundEverySecond([stableBorrowAverageInterestRate, 18]),
200200
},
201201
capsData: {
202-
deposit: BigInt(depositCap),
203-
borrow: BigInt(borrowCap),
204-
stableBorrowPercentage: [BigInt(stableBorrowPercentageCap), 18],
202+
deposit: depositCap,
203+
borrow: borrowCap,
204+
stableBorrowPercentage: [stableBorrowPercentageCap, 18],
205205
},
206206
configData: {
207207
deprecated,

src/chains/evm/spoke/modules/folks-evm-loan.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ export const read = {
733733
return {
734734
periodLength: BigInt(periodLength),
735735
periodOffset: BigInt(periodOffset),
736-
periodLimit: BigInt(periodLimit),
736+
periodLimit,
737737
currentCapacity,
738738
nextPeriodReset,
739739
};

src/xchain/modules/folks-gmp.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,11 @@ export const util = {
343343

344344
// check adapter id is supported
345345
const spokeTokenData = sendFolksTokenId ? getSpokeTokenData(spokeChain, sendFolksTokenId) : undefined;
346-
spokeTokenData && sendFolksTokenId && isCrossChainToken(sendFolksTokenId)
347-
? assertAdapterSupportsCrossChainToken(fromFolksChainId, spokeTokenData.token as CrossChainTokenType, adapterId)
348-
: assertAdapterSupportsDataMessage(fromFolksChainId, adapterId);
346+
if (spokeTokenData && sendFolksTokenId && isCrossChainToken(sendFolksTokenId)) {
347+
assertAdapterSupportsCrossChainToken(fromFolksChainId, spokeTokenData.token as CrossChainTokenType, adapterId);
348+
} else {
349+
assertAdapterSupportsDataMessage(fromFolksChainId, adapterId);
350+
}
349351

350352
return FolksEvmGmp.getSendMessageFee(
351353
FolksCore.getProvider<ChainType.EVM>(fromFolksChainId),
@@ -375,9 +377,11 @@ export const util = {
375377
if (!isRewards) {
376378
if (receiveFolksTokenId === undefined) throw Error("Unspecified receiveFolksTokenId");
377379
hubTokenData = getHubTokenData(receiveFolksTokenId, network);
378-
isCrossChainToken(receiveFolksTokenId)
379-
? assertAdapterSupportsCrossChainToken(toFolksChainId, hubTokenData.token as CrossChainTokenType, adapterId)
380-
: assertAdapterSupportsDataMessage(toFolksChainId, adapterId);
380+
if (isCrossChainToken(receiveFolksTokenId)) {
381+
assertAdapterSupportsCrossChainToken(toFolksChainId, hubTokenData.token as CrossChainTokenType, adapterId);
382+
} else {
383+
assertAdapterSupportsDataMessage(toFolksChainId, adapterId);
384+
}
381385
} else {
382386
assertAdapterSupportsDataMessage(toFolksChainId, adapterId);
383387
}

0 commit comments

Comments
 (0)