Parcourir la source

fix: add eslint-ignore comments to suppress warnings in xc-admin-frontend

Co-Authored-By: Connor Prussin <connor@dourolabs.xyz>
Devin AI il y a 8 mois
Parent
commit
83af1b9764

+ 2 - 1
contract_manager/src/contracts/sui.ts

@@ -527,7 +527,8 @@ export class SuiWormholeContract extends WormholeContract {
     return { id: result.digest, info: result };
   }
 
-  private async getStateFields(): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
+  private async getStateFields(): Promise<any> {
+    // eslint-disable-line @typescript-eslint/no-explicit-any
     const provider = this.chain.getProvider();
     const result = await provider.getObject({
       id: this.stateId,

+ 1 - 1
governance/xc_admin/packages/xc_admin_frontend/components/ClusterSwitch.tsx

@@ -10,7 +10,7 @@ const ClusterSwitch = ({ light }: { light?: boolean | null }) => {
 
   const { cluster, setCluster } = useContext(ClusterContext)
   const handleChange = useCallback(
-    (event: any) => {
+    (event: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
       if (event.target.value) {
         router.query.cluster = event.target.value
         setCluster(event.target.value)

+ 10 - 3
governance/xc_admin/packages/xc_admin_frontend/components/PermissionDepermissionKey.tsx

@@ -57,7 +57,7 @@ const PermissionDepermissionKey = ({
 
   // get current input value
 
-  const handleChange = (event: any) => {
+  const handleChange = (event: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
     setSelectedAssetType(event.target.value)
     setIsModalOpen(true)
   }
@@ -135,7 +135,7 @@ const PermissionDepermissionKey = ({
         toast.success(`Proposal sent! 🚀 Proposal Pubkey: ${proposalPubkey}`)
         setIsSubmitButtonLoading(false)
         closeModal()
-      } catch (error: any) {
+      } catch (error: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
         if (error.response) {
           toast.error(capitalizeFirstLetter(error.response.data))
         } else {
@@ -168,7 +168,14 @@ const PermissionDepermissionKey = ({
       })
       setPriceAccounts(res)
     }
-  }, [rawConfig, dataIsLoading, selectedAssetType, isPermission, publisherKey])
+  }, [
+    rawConfig,
+    dataIsLoading,
+    selectedAssetType,
+    isPermission,
+    publisherKey,
+    cluster,
+  ])
 
   return (
     <>

+ 1 - 1
governance/xc_admin/packages/xc_admin_frontend/components/common/Modal.tsx

@@ -6,7 +6,7 @@ const Modal: React.FC<{
   isModalOpen: boolean
   setIsModalOpen: Dispatch<SetStateAction<boolean>>
   closeModal: () => void
-  content: any
+  content: any // eslint-disable-line @typescript-eslint/no-explicit-any
 }> = ({ isModalOpen, setIsModalOpen, closeModal, content }) => {
   return (
     <Transition appear show={isModalOpen} as={Fragment}>

+ 66 - 56
governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx

@@ -54,8 +54,8 @@ const checkSizeOfProductInstruction = (
 }
 
 const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
-  const [data, setData] = useState<any>({})
-  const [dataChanges, setDataChanges] = useState<Record<string, any>>()
+  const [data, setData] = useState<any>({}) // eslint-disable-line @typescript-eslint/no-explicit-any
+  const [dataChanges, setDataChanges] = useState<Record<string, any>>() // eslint-disable-line @typescript-eslint/no-explicit-any
   const [existingSymbols, setExistingSymbols] = useState<Set<string>>(new Set())
   const [isModalOpen, setIsModalOpen] = useState(false)
   const [isSendProposalButtonLoading, setIsSendProposalButtonLoading] =
@@ -78,12 +78,12 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
     setIsModalOpen(false)
   }
 
-  const sortData = (data: any) => {
-    const sortedData: any = {}
+  const sortData = (data: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
+    const sortedData: any = {} // eslint-disable-line @typescript-eslint/no-explicit-any
     Object.keys(data)
       .sort()
       .forEach((key) => {
-        const sortedInnerData: any = {}
+        const sortedInnerData: any = {} // eslint-disable-line @typescript-eslint/no-explicit-any
         Object.keys(data[key])
           .sort()
           .forEach((innerKey) => {
@@ -92,13 +92,16 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
             } else if (innerKey === 'priceAccounts') {
               // sort price accounts by address
               sortedInnerData[innerKey] = data[key][innerKey].sort(
-                (priceAccount1: any, priceAccount2: any) =>
-                  priceAccount1.address.localeCompare(priceAccount2.address)
+                (
+                  priceAccount1: any, // eslint-disable-line @typescript-eslint/no-explicit-any
+                  priceAccount2: any // eslint-disable-line @typescript-eslint/no-explicit-any
+                ) => priceAccount1.address.localeCompare(priceAccount2.address)
               )
               // sort price accounts keys
               sortedInnerData[innerKey] = sortedInnerData[innerKey].map(
-                (priceAccount: any) => {
-                  const sortedPriceAccount: any = {}
+                (priceAccount: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
+
+                  const sortedPriceAccount: any = {} // eslint-disable-line @typescript-eslint/no-explicit-any
                   Object.keys(priceAccount)
                     .sort()
                     .forEach((priceAccountKey) => {
@@ -128,7 +131,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
 
   useEffect(() => {
     if (!dataIsLoading && rawConfig && rawConfig.mappingAccounts.length > 0) {
-      const symbolToData: any = {}
+      const symbolToData: any = {} // eslint-disable-line @typescript-eslint/no-explicit-any
       rawConfig.mappingAccounts
         .sort(
           (mapping1, mapping2) =>
@@ -164,8 +167,9 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
     }
   }, [rawConfig, dataIsLoading, sortDataMemo, cluster])
 
-  const sortObjectByKeys = (obj: any) => {
-    const sortedObj: any = {}
+  const sortObjectByKeys = (obj: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
+    // eslint-disable-line @typescript-eslint/no-explicit-any
+    const sortedObj: any = {} // eslint-disable-line @typescript-eslint/no-explicit-any
     Object.keys(obj)
       .sort()
       .forEach((key) => {
@@ -200,7 +204,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
           const fileData = e.target.result
           if (!isValidJson(fileData as string)) return
           const fileDataParsed = sortData(JSON.parse(fileData as string))
-          const changes: Record<string, any> = {}
+          const changes: Record<string, any> = {} // eslint-disable-line @typescript-eslint/no-explicit-any
           Object.keys(fileDataParsed).forEach((symbol) => {
             // remove duplicate publishers
             fileDataParsed[symbol].priceAccounts[0].publishers = [
@@ -249,7 +253,8 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
   const isValidJson = (json: string) => {
     try {
       JSON.parse(json)
-    } catch (e: any) {
+    } catch (e: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
+      // eslint-disable-line @typescript-eslint/no-explicit-any
       toast.error(capitalizeFirstLetter(e.message))
       return false
     }
@@ -636,7 +641,8 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
     })
   }
 
-  const MetadataChangesRows = ({ changes }: { changes: any }) => {
+  const MetadataChangesRows = ({ changes }: { changes: any }) => { // eslint-disable-line @typescript-eslint/no-explicit-any
+    // eslint-disable-line @typescript-eslint/no-explicit-any
     const addPriceFeed = changes.prev === undefined && changes.new !== undefined
     return (
       <>
@@ -668,62 +674,66 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
     )
   }
 
-  const PriceAccountsChangesRows = ({ changes }: { changes: any }) => {
+  const PriceAccountsChangesRows = ({ changes }: { changes: any }) => { // eslint-disable-line @typescript-eslint/no-explicit-any
     const addPriceFeed = changes.prev === undefined && changes.new !== undefined
     return (
       <>
-        {changes.new.map((priceAccount: any, index: number) =>
-          Object.keys(priceAccount).map((priceAccountKey) =>
-            priceAccountKey === 'publishers' ? (
-              addPriceFeed ? (
-                <PublisherKeysChangesRows
-                  key={priceAccountKey}
-                  changes={{
-                    new: priceAccount[priceAccountKey],
-                  }}
-                />
-              ) : (
-                JSON.stringify(changes.prev[index][priceAccountKey]) !==
-                  JSON.stringify(priceAccount[priceAccountKey]) && (
+        {changes.new.map(
+          (
+            priceAccount: any, // eslint-disable-line @typescript-eslint/no-explicit-any
+            index: number
+          ) =>
+            Object.keys(priceAccount).map((priceAccountKey) =>
+              priceAccountKey === 'publishers' ? (
+                addPriceFeed ? (
                   <PublisherKeysChangesRows
                     key={priceAccountKey}
                     changes={{
-                      prev: changes.prev[index][priceAccountKey],
                       new: priceAccount[priceAccountKey],
                     }}
                   />
+                ) : (
+                  JSON.stringify(changes.prev[index][priceAccountKey]) !==
+                    JSON.stringify(priceAccount[priceAccountKey]) && (
+                    <PublisherKeysChangesRows
+                      key={priceAccountKey}
+                      changes={{
+                        prev: changes.prev[index][priceAccountKey],
+                        new: priceAccount[priceAccountKey],
+                      }}
+                    />
+                  )
+                )
+              ) : (
+                (addPriceFeed ||
+                  changes.prev[index][priceAccountKey] !==
+                    priceAccount[priceAccountKey]) && (
+                  <tr key={priceAccountKey}>
+                    <td className="base16 py-4 pl-6 pr-2 lg:pl-6">
+                      {priceAccountKey
+                        .split('_')
+                        .map((word) => capitalizeFirstLetter(word))
+                        .join(' ')}
+                    </td>
+                    <td className="base16 py-4 pl-1 pr-2 lg:pl-6">
+                      {!addPriceFeed ? (
+                        <>
+                          <s>{changes.prev[index][priceAccountKey]}</s>
+                          <br />
+                        </>
+                      ) : null}
+                      {priceAccount[priceAccountKey]}
+                    </td>
+                  </tr>
                 )
-              )
-            ) : (
-              (addPriceFeed ||
-                changes.prev[index][priceAccountKey] !==
-                  priceAccount[priceAccountKey]) && (
-                <tr key={priceAccountKey}>
-                  <td className="base16 py-4 pl-6 pr-2 lg:pl-6">
-                    {priceAccountKey
-                      .split('_')
-                      .map((word) => capitalizeFirstLetter(word))
-                      .join(' ')}
-                  </td>
-                  <td className="base16 py-4 pl-1 pr-2 lg:pl-6">
-                    {!addPriceFeed ? (
-                      <>
-                        <s>{changes.prev[index][priceAccountKey]}</s>
-                        <br />
-                      </>
-                    ) : null}
-                    {priceAccount[priceAccountKey]}
-                  </td>
-                </tr>
               )
             )
-          )
         )}
       </>
     )
   }
 
-  const PublisherKeysChangesRows = ({ changes }: { changes: any }) => {
+  const PublisherKeysChangesRows = ({ changes }: { changes: any }) => { // eslint-disable-line @typescript-eslint/no-explicit-any
     const addPriceFeed = changes.prev === undefined && changes.new !== undefined
     const publisherKeysToAdd = addPriceFeed
       ? changes.new
@@ -765,7 +775,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
     )
   }
 
-  const NewPriceFeedsRows = ({ priceFeedData }: { priceFeedData: any }) => {
+  const NewPriceFeedsRows = ({ priceFeedData }: { priceFeedData: any }) => { // eslint-disable-line @typescript-eslint/no-explicit-any
     return (
       <>
         <MetadataChangesRows
@@ -795,7 +805,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
     )
   }
 
-  const ModalContent = ({ changes }: { changes: any }) => {
+  const ModalContent = ({ changes }: { changes: any }) => { // eslint-disable-line @typescript-eslint/no-explicit-any
     return (
       <>
         {Object.keys(changes).length > 0 ? (

+ 1 - 1
governance/xc_admin/packages/xc_admin_frontend/components/tabs/Proposals/Proposal.tsx

@@ -300,7 +300,7 @@ export const Proposal = ({
 
         if (refreshData) await refreshData().fetchData()
         toast.success(msg)
-      } catch (e: any) {
+      } catch (e: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
         toast.error(capitalizeFirstLetter(e.message))
       } finally {
         setIsTransactionLoading(false)

+ 3 - 3
governance/xc_admin/packages/xc_admin_frontend/components/tabs/UpdatePermissions.tsx

@@ -216,7 +216,7 @@ const UpdatePermissions = () => {
   }
 
   const handleEditPubkey = (
-    e: any,
+    e: any, // eslint-disable-line @typescript-eslint/no-explicit-any
     account: PermissionAccount,
     prevPubkey: string
   ) => {
@@ -280,7 +280,7 @@ const UpdatePermissions = () => {
                 `Proposal sent! 🚀 Proposal Pubkey: ${proposalPubkey}`
               )
               setIsSendProposalButtonLoading(false)
-            } catch (e: any) {
+            } catch (e: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
               toast.error(capitalizeFirstLetter(e.message))
               setIsSendProposalButtonLoading(false)
             }
@@ -289,7 +289,7 @@ const UpdatePermissions = () => {
     }
   }
 
-  const ModalContent = ({ changes }: { changes: any }) => {
+  const ModalContent = ({ changes }: { changes: any }) => { // eslint-disable-line @typescript-eslint/no-explicit-any
     return (
       <>
         {Object.keys(changes).length > 0 ? (