Преглед изворни кода

chore: disable eslint rules in a few specific places

The main disable here is disabling unicorn/prefer-math-min-max where it would
downcast bigints to numbers.
Connor Prussin пре 8 месеци
родитељ
комит
c0f6400b59

+ 1 - 1
apps/staking/src/components/Dashboard/index.tsx

@@ -246,7 +246,7 @@ const useIntegrityStakingSum = (
     [publishers, field],
   );
 
-// eslint-disable-next-line unicorn/no-array-reduce
+// eslint-disable-next-line unicorn/no-array-reduce, unicorn/prefer-math-min-max
 const bigIntMin = (...args: bigint[]) => args.reduce((m, e) => (e < m ? e : m));
 
 type TabId = Exclude<ComponentProps<typeof Tabs>["selectedKey"], undefined>;

+ 1 - 0
governance/pyth_staking_sdk/src/pyth-staking-client.ts

@@ -809,6 +809,7 @@ export class PythStakingClient {
     for (const instruction of instructions.advanceDelegationRecordInstructions) {
       const tx = new Transaction().add(instruction);
       tx.feePayer = simulationPayer ?? this.wallet.publicKey;
+      // eslint-disable-next-line @typescript-eslint/no-deprecated
       const res = await this.connection.simulateTransaction(tx);
       const val = res.value.returnData?.data[0];
       if (val === undefined) {

+ 6 - 0
governance/pyth_staking_sdk/src/utils/apy.ts

@@ -17,6 +17,9 @@ export const calculateApy = (
   } & ({ isSelf: true } | { isSelf: false; poolUtilization: bigint }),
 ) => {
   const { selfStake, poolCapacity, yieldRate, isSelf } = options;
+  // This eslint rule incorrectly tries to use Math.min() here instead, which
+  // casts down to number
+  // eslint-disable-next-line unicorn/prefer-math-min-max
   const eligibleSelfStake = selfStake > poolCapacity ? poolCapacity : selfStake;
 
   if (poolCapacity === 0n) {
@@ -40,6 +43,9 @@ export const calculateApy = (
   const delegatorPoolUtilization = poolUtilization - selfStake;
   const delegatorPoolCapacity = poolCapacity - eligibleSelfStake;
   const eligibleStake =
+    // This eslint rule incorrectly tries to use Math.min() here instead, which
+    // casts down to number
+    // eslint-disable-next-line unicorn/prefer-math-min-max
     delegatorPoolUtilization > delegatorPoolCapacity
       ? delegatorPoolCapacity
       : delegatorPoolUtilization;