From 94913bd3b550161a0f4d3a39e558a2bfeb7af44b Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 24 Apr 2026 07:08:20 +0700 Subject: [PATCH] chore(lint): no-explicit-any in components/plan-card.tsx --- packages/app/src/components/plan-card.tsx | 86 ++++++++++++++--------- 1 file changed, 54 insertions(+), 32 deletions(-) diff --git a/packages/app/src/components/plan-card.tsx b/packages/app/src/components/plan-card.tsx index 05da8b59f..f21aa5bb4 100644 --- a/packages/app/src/components/plan-card.tsx +++ b/packages/app/src/components/plan-card.tsx @@ -1,10 +1,12 @@ import { useMemo, type ReactNode } from "react"; -import { Text, View } from "react-native"; -import Markdown from "react-native-markdown-display"; +import { Text, View, type StyleProp, type TextStyle, type ViewStyle } from "react-native"; +import Markdown, { type ASTNode } from "react-native-markdown-display"; import { StyleSheet, useUnistyles } from "react-native-unistyles"; import { createMarkdownStyles } from "@/styles/markdown-styles"; import { getMarkdownListMarker } from "@/utils/markdown-list"; +type MarkdownRuleStyles = Record; + function MarkdownInlineText({ textKey, inheritedStyle, @@ -12,8 +14,8 @@ function MarkdownInlineText({ children, }: { textKey: string; - inheritedStyle: any; - ruleStyle: any; + inheritedStyle: StyleProp; + ruleStyle: StyleProp; children: ReactNode; }) { const style = useMemo(() => [inheritedStyle, ruleStyle], [inheritedStyle, ruleStyle]); @@ -28,7 +30,7 @@ function MarkdownListItemContent({ contentStyle, children, }: { - contentStyle: any; + contentStyle: StyleProp; children: ReactNode; }) { const style = useMemo(() => [contentStyle, LIST_ITEM_CONTENT_INNER], [contentStyle]); @@ -42,12 +44,12 @@ function MarkdownParagraph({ children, }: { textKey: string; - paragraphStyle: any; + paragraphStyle: StyleProp; isLastChild: boolean; children: ReactNode; }) { - const style = useMemo( - () => [paragraphStyle, isLastChild ? PARAGRAPH_LAST_CHILD : false], + const style = useMemo>( + () => [paragraphStyle, isLastChild ? PARAGRAPH_LAST_CHILD : null], [paragraphStyle, isLastChild], ); return ( @@ -60,11 +62,11 @@ function MarkdownParagraph({ function createPlanMarkdownRules() { return { text: ( - node: any, + node: ASTNode, _children: ReactNode[], - _parent: any, - styles: any, - inheritedStyles: any = {}, + _parent: ASTNode[], + styles: MarkdownRuleStyles, + inheritedStyles: TextStyle = {}, ) => ( ), textgroup: ( - node: any, + node: ASTNode, children: ReactNode[], - _parent: any, - styles: any, - inheritedStyles: any = {}, + _parent: ASTNode[], + styles: MarkdownRuleStyles, + inheritedStyles: TextStyle = {}, ) => ( ), code_block: ( - node: any, + node: ASTNode, _children: ReactNode[], - _parent: any, - styles: any, - inheritedStyles: any = {}, + _parent: ASTNode[], + styles: MarkdownRuleStyles, + inheritedStyles: TextStyle = {}, ) => ( ), fence: ( - node: any, + node: ASTNode, _children: ReactNode[], - _parent: any, - styles: any, - inheritedStyles: any = {}, + _parent: ASTNode[], + styles: MarkdownRuleStyles, + inheritedStyles: TextStyle = {}, ) => ( ), code_inline: ( - node: any, + node: ASTNode, _children: ReactNode[], - _parent: any, - styles: any, - inheritedStyles: any = {}, + _parent: ASTNode[], + styles: MarkdownRuleStyles, + inheritedStyles: TextStyle = {}, ) => ( ), - bullet_list: (node: any, children: ReactNode[], _parent: any, styles: any) => ( + bullet_list: ( + node: ASTNode, + children: ReactNode[], + _parent: ASTNode[], + styles: MarkdownRuleStyles, + ) => ( {children} ), - ordered_list: (node: any, children: ReactNode[], _parent: any, styles: any) => ( + ordered_list: ( + node: ASTNode, + children: ReactNode[], + _parent: ASTNode[], + styles: MarkdownRuleStyles, + ) => ( {children} ), - list_item: (node: any, children: ReactNode[], parent: any, styles: any) => { + list_item: ( + node: ASTNode, + children: ReactNode[], + parent: ASTNode[], + styles: MarkdownRuleStyles, + ) => { const { isOrdered, marker } = getMarkdownListMarker(node, parent); const iconStyle = isOrdered ? styles.ordered_list_icon : styles.bullet_list_icon; const contentStyle = isOrdered ? styles.ordered_list_content : styles.bullet_list_content; @@ -156,7 +173,12 @@ function createPlanMarkdownRules() { ); }, - paragraph: (node: any, children: ReactNode[], parent: any, styles: any) => { + paragraph: ( + node: ASTNode, + children: ReactNode[], + parent: ASTNode[], + styles: MarkdownRuleStyles, + ) => { const isLastChild = parent[0]?.children?.at(-1)?.key === node.key; return (