Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

Revert "chore: enforce no explicit any rule" (#5868)

authored by yoginth.com and committed by

GitHub 4899c5e8 cb03306d

+48 -79
+5 -8
apps/api/src/routes/og/ogUtils.ts
··· 1 1 import apolloClient from "@hey/indexer/apollo/client"; 2 2 import type { Context } from "hono"; 3 3 import type { HtmlEscapedString } from "hono/utils/html"; 4 - 5 - type DocumentNode = unknown; 6 - 7 4 import defaultMetadata from "../../utils/defaultMetadata"; 8 5 import { getRedis, setRedis } from "../../utils/redis"; 9 6 10 7 export interface OgHelperOptions<T> { 11 8 ctx: Context; 12 9 cacheKey: string; 13 - query: DocumentNode; 14 - variables: Record<string, unknown>; 15 - extractData: (data: unknown) => T | null; 16 - buildJsonLd: (data: T) => Record<string, unknown>; 10 + query: any; 11 + variables: Record<string, any>; 12 + extractData: (data: any) => T | null; 13 + buildJsonLd: (data: T) => Record<string, any>; 17 14 buildHtml: ( 18 15 data: T, 19 16 escapedJsonLd: string ··· 37 34 38 35 const { data } = await apolloClient.query({ 39 36 fetchPolicy: "no-cache", 40 - query: query as DocumentNode, 37 + query, 41 38 variables 42 39 }); 43 40
+5 -6
apps/api/src/utils/lensPg.ts
··· 13 13 pg: IMain<unknown, pg.IClient>; 14 14 } 15 15 16 - type DatabaseParams = null | Record<string, unknown> | unknown[]; 16 + type DatabaseParams = null | Record<string, any>; 17 17 type DatabaseQuery = string; 18 18 19 19 class Database { ··· 42 42 connectionParameters: IConnectionParameters 43 43 ): InitializeDbResult { 44 44 const pgp = pgPromise({ 45 - error: (error: unknown) => { 46 - const errorMessage = 47 - error instanceof Error ? error.message : String(error); 45 + error: (error: any) => { 46 + const errorMessage = error.message || error; 48 47 console.error(`LENS POSTGRES ERROR WITH TRACE: ${errorMessage}`); 49 48 } 50 49 }); ··· 58 57 public multi( 59 58 query: DatabaseQuery, 60 59 params: DatabaseParams = null 61 - ): Promise<unknown[][]> { 60 + ): Promise<any[][]> { 62 61 return this._readDb.multi(query, params); 63 62 } 64 63 65 64 public query( 66 65 query: DatabaseQuery, 67 66 params: DatabaseParams = null 68 - ): Promise<unknown[]> { 67 + ): Promise<any[]> { 69 68 return this._readDb.query(query, params); 70 69 } 71 70 }
+1 -1
apps/api/src/utils/redis.ts
··· 52 52 53 53 export const setRedis = async ( 54 54 key: string, 55 - value: boolean | number | Record<string, unknown> | string, 55 + value: boolean | number | Record<string, any> | string, 56 56 expiry = generateSmallExpiry() 57 57 ) => { 58 58 if (!redisClient) {
+2 -6
apps/web/src/components/Account/FollowersYouKnowOverview.tsx
··· 1 1 import { TRANSFORMS } from "@hey/data/constants"; 2 2 import getAccount from "@hey/helpers/getAccount"; 3 3 import getAvatar from "@hey/helpers/getAvatar"; 4 - import { 5 - type AccountFragment, 6 - type Follower, 7 - useFollowersYouKnowQuery 8 - } from "@hey/indexer"; 4 + import { type Follower, useFollowersYouKnowQuery } from "@hey/indexer"; 9 5 import { type ReactNode, useEffect, useMemo, useState } from "react"; 10 6 import { useLocation } from "react-router"; 11 7 import FollowersYouKnow from "@/components/Shared/Modal/FollowersYouKnow"; ··· 43 39 44 40 const accountNames = useMemo(() => { 45 41 const names = accounts.map( 46 - (account) => getAccount(account.follower as AccountFragment).name 42 + (account) => getAccount(account.follower as any).name 47 43 ); 48 44 const count = names.length - 3; 49 45
+1 -1
apps/web/src/components/Composer/ChooseThumbnail.tsx
··· 49 49 getFileFromDataURL( 50 50 thumbnails[index].blobUrl, 51 51 "thumbnail.jpeg", 52 - async (file: File | null) => { 52 + async (file: any) => { 53 53 if (!file) { 54 54 return toast.error("Please upload a custom thumbnail"); 55 55 }
+1 -5
apps/web/src/components/Composer/LicensePicker.tsx
··· 13 13 label: getAssetLicense(type)?.label as string, 14 14 selected: license === type, 15 15 value: type 16 - })) as Array<{ 17 - label: string; 18 - selected: boolean; 19 - value: MetadataLicenseType; 20 - }>; 16 + })) as any; 21 17 22 18 const options = [ 23 19 {
+1 -2
apps/web/src/components/Composer/NewPublication.tsx
··· 1 1 import { ERRORS } from "@hey/data/errors"; 2 2 import getAccount from "@hey/helpers/getAccount"; 3 3 import type { PostFragment } from "@hey/indexer"; 4 - import type { ApolloClientError } from "@hey/types/errors"; 5 4 import type { IGif } from "@hey/types/giphy"; 6 5 import type { NewAttachment } from "@hey/types/misc"; 7 6 import { useEffect, useState } from "react"; ··· 126 125 reset(); 127 126 }; 128 127 129 - const onError = (error?: ApolloClientError) => { 128 + const onError = (error?: any) => { 130 129 setIsSubmitting(false); 131 130 errorToast(error); 132 131 };
+1 -1
apps/web/src/components/Post/Actions/Like.tsx
··· 30 30 post.stats.reactions 31 31 ); 32 32 33 - const updateCache = (cache: ApolloCache<unknown>) => { 33 + const updateCache = (cache: ApolloCache<any>) => { 34 34 if (!post.operations) { 35 35 return; 36 36 }
+1 -1
apps/web/src/components/Post/Actions/Menu/Bookmark.tsx
··· 22 22 const { pathname } = useLocation(); 23 23 const hasBookmarked = post.operations?.hasBookmarked; 24 24 25 - const updateCache = (cache: ApolloCache<unknown>, hasBookmarked: boolean) => { 25 + const updateCache = (cache: ApolloCache<any>, hasBookmarked: boolean) => { 26 26 if (!post.operations) { 27 27 return; 28 28 }
+1 -2
apps/web/src/components/Post/Actions/Menu/Edit.tsx
··· 3 3 import generateUUID from "@hey/helpers/generateUUID"; 4 4 import getPostData from "@hey/helpers/getPostData"; 5 5 import type { PostFragment } from "@hey/indexer"; 6 - import type { NewAttachment } from "@hey/types/misc"; 7 6 8 7 import cn from "@/helpers/cn"; 9 8 import stopEventPropagation from "@/helpers/stopEventPropagation"; ··· 25 24 setPostContent(data?.content || ""); 26 25 setEditingPost(post); 27 26 28 - const attachments: NewAttachment[] = []; 27 + const attachments = [] as any[]; 29 28 if (data?.asset) { 30 29 attachments.push({ 31 30 id: generateUUID(),
+1 -1
apps/web/src/components/Post/Actions/Menu/HideComment.tsx
··· 22 22 const { currentAccount } = useAccountStore(); 23 23 const { showHiddenComments } = useHiddenCommentFeedStore(); 24 24 25 - const updateCache = (cache: ApolloCache<unknown>) => { 25 + const updateCache = (cache: ApolloCache<any>) => { 26 26 cache.evict({ id: cache.identify(post) }); 27 27 }; 28 28
+1 -1
apps/web/src/components/Post/Actions/Menu/NotInterested.tsx
··· 24 24 post: post.id 25 25 }; 26 26 27 - const updateCache = (cache: ApolloCache<unknown>, notInterested: boolean) => { 27 + const updateCache = (cache: ApolloCache<any>, notInterested: boolean) => { 28 28 if (!post.operations) { 29 29 return; 30 30 }
+1 -2
apps/web/src/components/Post/Actions/Share/UndoRepost.tsx
··· 4 4 import { ERRORS } from "@hey/data/errors"; 5 5 import { isRepost } from "@hey/helpers/postHelpers"; 6 6 import { type AnyPostFragment, useDeletePostMutation } from "@hey/indexer"; 7 - import type { ApolloClientError } from "@hey/types/errors"; 8 7 import type { Dispatch, SetStateAction } from "react"; 9 8 import { toast } from "sonner"; 10 9 import cn from "@/helpers/cn"; ··· 47 46 toast.success("Undone repost"); 48 47 }; 49 48 50 - const onError = (error?: ApolloClientError) => { 49 + const onError = (error?: any) => { 51 50 setIsSubmitting(false); 52 51 errorToast(error); 53 52 };
+2 -5
apps/web/src/components/Post/OpenAction/CollectAction/CollectActionButton.tsx
··· 1 1 import { useApolloClient } from "@apollo/client"; 2 2 import { HEY_TREASURY } from "@hey/data/constants"; 3 - import type { SimpleCollectActionFragment } from "@hey/indexer"; 4 3 import { 5 4 type PostActionFragment, 6 5 type PostFragment, ··· 31 30 postAction, 32 31 post 33 32 }: CollectActionButtonProps) => { 34 - const collectAction = getCollectActionData( 35 - postAction as SimpleCollectActionFragment 36 - ); 33 + const collectAction = getCollectActionData(postAction as any); 37 34 const { currentAccount } = useAccountStore(); 38 35 const [isSubmitting, setIsSubmitting] = useState(false); 39 36 const [hasSimpleCollected, setHasSimpleCollected] = useState( ··· 45 42 const endTimestamp = collectAction?.endsAt; 46 43 const collectLimit = collectAction?.collectLimit; 47 44 const amount = collectAction?.price as number; 48 - const assetAddress = collectAction?.assetAddress; 45 + const assetAddress = collectAction?.assetAddress as any; 49 46 const assetSymbol = collectAction?.assetSymbol as string; 50 47 const isAllCollected = collectLimit ? collects >= collectLimit : false; 51 48 const isSaleEnded = endTimestamp
+3 -5
apps/web/src/components/Settings/Funds/TokenOperation.tsx
··· 7 7 import useWaitForTransactionToComplete from "@/hooks/useWaitForTransactionToComplete"; 8 8 9 9 interface TokenOperationProps { 10 - useMutationHook: ( 11 - options: unknown 12 - ) => [(variables: unknown) => Promise<unknown>]; 13 - buildRequest: (value: string) => unknown; 10 + useMutationHook: any; 11 + buildRequest: (value: string) => any; 14 12 resultKey: string; 15 13 buttonLabel: string; 16 14 title: string; ··· 49 47 }; 50 48 51 49 const [mutate] = useMutationHook({ 52 - onCompleted: async (data: unknown) => { 50 + onCompleted: async (data: any) => { 53 51 const result = data?.[resultKey]; 54 52 if (result?.__typename === "InsufficientFunds") { 55 53 return onError({ message: "Insufficient funds" });
+1 -1
apps/web/src/components/Settings/Personalize/Form.tsx
··· 134 134 ) 135 135 .map(({ key, type, value }) => ({ 136 136 key, 137 - type, 137 + type: MetadataAttributeType[type] as any, 138 138 value 139 139 })) || []; 140 140
+1 -2
apps/web/src/components/Shared/Account/SwitchAccounts.tsx
··· 5 5 useAccountsAvailableQuery, 6 6 useSwitchAccountMutation 7 7 } from "@hey/indexer"; 8 - import type { ApolloClientError } from "@hey/types/errors"; 9 8 import { useState } from "react"; 10 9 import { useAccount } from "wagmi"; 11 10 import Loader from "@/components/Shared/Loader"; ··· 24 23 ); 25 24 const { address } = useAccount(); 26 25 27 - const onError = (error?: ApolloClientError) => { 26 + const onError = (error?: any) => { 28 27 setIsSubmitting(false); 29 28 setLoggingInAccountId(null); 30 29 errorToast(error);
+1 -2
apps/web/src/components/Shared/Auth/Login.tsx
··· 8 8 useAuthenticateMutation, 9 9 useChallengeMutation 10 10 } from "@hey/indexer"; 11 - import type { ApolloClientError } from "@hey/types/errors"; 12 11 import { AnimatePresence, motion } from "motion/react"; 13 12 import type { Dispatch, SetStateAction } from "react"; 14 13 import { useState } from "react"; ··· 34 33 ); 35 34 const [isExpanded, setIsExpanded] = useState(true); 36 35 37 - const onError = (error?: ApolloClientError) => { 36 + const onError = (error?: any) => { 38 37 setIsSubmitting(false); 39 38 setLoggingInAccountId(null); 40 39 errorToast(error);
+1 -2
apps/web/src/components/Shared/Auth/Signup/ChooseUsername.tsx
··· 13 13 useChallengeMutation, 14 14 useCreateAccountWithUsernameMutation 15 15 } from "@hey/indexer"; 16 - import type { ApolloClientError } from "@hey/types/errors"; 17 16 import { account as accountMetadata } from "@lens-protocol/metadata"; 18 17 import { useState } from "react"; 19 18 import { toast } from "sonner"; ··· 57 56 const handleWrongNetwork = useHandleWrongNetwork(); 58 57 const form = useZodForm({ mode: "onChange", schema: ValidationSchema }); 59 58 60 - const onError = (error?: ApolloClientError) => { 59 + const onError = (error?: any) => { 61 60 setIsSubmitting(false); 62 61 errorToast(error); 63 62 };
+2 -2
apps/web/src/components/Shared/Auth/WalletSelector.tsx
··· 18 18 ]; 19 19 20 20 const filteredConnectors = connectors 21 - .filter((connector) => allowedConnectors.includes(connector.id)) 21 + .filter((connector: any) => allowedConnectors.includes(connector.id)) 22 22 .sort( 23 23 (a: Connector, b: Connector) => 24 24 allowedConnectors.indexOf(a.id) - allowedConnectors.indexOf(b.id) ··· 43 43 </div> 44 44 ) : ( 45 45 <div className="inline-block w-full space-y-3 overflow-hidden text-left align-middle"> 46 - {filteredConnectors.map((connector) => { 46 + {filteredConnectors.map((connector: any) => { 47 47 return ( 48 48 <button 49 49 className={cn(
+1 -3
apps/web/src/components/Shared/Markup/index.tsx
··· 28 28 } 29 29 30 30 const components = { 31 - a: (props: { title?: string }) => ( 32 - <MarkupLink mentions={mentions} title={props.title} /> 33 - ) 31 + a: (props: any) => <MarkupLink mentions={mentions} title={props.title} /> 34 32 }; 35 33 36 34 return (
+3 -1
apps/web/src/components/Shared/Post/Attachments.tsx
··· 103 103 {displayDecision === "displayVideoAsset" && ( 104 104 <Video 105 105 poster={asset?.cover as string} 106 - src={getSrc(asset?.uri) || [{ src: asset?.uri, type: "video" }]} 106 + src={ 107 + getSrc(asset?.uri) || [{ src: asset?.uri, type: "video" } as any] 108 + } 107 109 /> 108 110 )} 109 111 {displayDecision === "displayAudioAsset" && (
+1 -1
apps/web/src/components/Shared/UI/ErrorMessage.tsx
··· 4 4 5 5 interface ErrorMessageProps { 6 6 className?: string; 7 - error?: unknown; 7 + error?: any; 8 8 title?: string; 9 9 } 10 10
+2 -2
apps/web/src/components/Shared/UI/Form.tsx
··· 16 16 schema: T; 17 17 } 18 18 19 - export const useZodForm = <T extends ZodSchema<unknown>>({ 19 + export const useZodForm = <T extends ZodSchema<any>>({ 20 20 schema, 21 21 ...formConfig 22 22 }: UseZodFormProps<T>) => { 23 23 return useForm({ 24 24 ...formConfig, 25 - resolver: zodResolver(schema) 25 + resolver: zodResolver(schema as any) 26 26 }); 27 27 }; 28 28
+1 -1
apps/web/src/components/Shared/UI/Select.tsx
··· 15 15 className?: string; 16 16 defaultValue?: string; 17 17 iconClassName?: string; 18 - onChange: (value: unknown) => unknown; 18 + onChange: (value: any) => any; 19 19 options?: { 20 20 disabled?: boolean; 21 21 helper?: string;
+1 -1
apps/web/src/hooks/usePostMetadata.tsx
··· 14 14 import { usePostAudioStore } from "../store/non-persisted/post/usePostAudioStore"; 15 15 16 16 interface UsePostMetadataProps { 17 - baseMetadata: Record<string, unknown>; 17 + baseMetadata: any; 18 18 } 19 19 20 20 const usePostMetadata = () => {
+3 -11
apps/web/src/hooks/useTransactionLifecycle.tsx
··· 1 1 import { ERRORS } from "@hey/data/errors"; 2 2 import getTransactionData from "@hey/helpers/getTransactionData"; 3 - import type { 4 - SelfFundedTransactionRequest, 5 - SponsoredTransactionRequest, 6 - TransactionWillFail 7 - } from "@hey/indexer"; 8 3 import type { ApolloClientError } from "@hey/types/errors"; 9 4 import { sendEip712Transaction, sendTransaction } from "viem/zksync"; 10 5 import { useWalletClient } from "wagmi"; ··· 15 10 const handleWrongNetwork = useHandleWrongNetwork(); 16 11 17 12 const handleSponsoredTransaction = async ( 18 - transactionData: SponsoredTransactionRequest, 13 + transactionData: any, 19 14 onCompleted: (hash: string) => void 20 15 ) => { 21 16 await handleWrongNetwork(); ··· 29 24 }; 30 25 31 26 const handleSelfFundedTransaction = async ( 32 - transactionData: SelfFundedTransactionRequest, 27 + transactionData: any, 33 28 onCompleted: (hash: string) => void 34 29 ) => { 35 30 await handleWrongNetwork(); ··· 47 42 onCompleted, 48 43 onError 49 44 }: { 50 - transactionData: 51 - | SponsoredTransactionRequest 52 - | SelfFundedTransactionRequest 53 - | TransactionWillFail; 45 + transactionData: any; 54 46 onCompleted: (hash: string) => void; 55 47 onError: (error: ApolloClientError) => void; 56 48 }) => {
+1 -1
biome.json
··· 83 83 "suspicious": { 84 84 "noArrayIndexKey": "off", 85 85 "noAssignInExpressions": "off", 86 - "noExplicitAny": "error" 86 + "noExplicitAny": "off" 87 87 } 88 88 } 89 89 }
+2 -2
packages/helpers/getTransactionData.ts
··· 11 11 raw: Eip1559TransactionRequest | Eip712TransactionRequest, 12 12 options: GetTransactionDataOptions = {} 13 13 ) => { 14 - const data: Record<string, unknown> = { 14 + const data = { 15 15 data: raw.data, 16 16 gas: BigInt(raw.gasLimit), 17 17 maxFeePerGas: BigInt(raw.maxFeePerGas), ··· 19 19 nonce: raw.nonce, 20 20 to: raw.to, 21 21 value: BigInt(raw.value) 22 - }; 22 + } as any; 23 23 24 24 if (options.sponsored && "customData" in raw) { 25 25 data.paymaster = raw.customData.paymasterParams?.paymaster;