From 7dfb5d1a8dfedcd926f54d72606cf8295f909a50 Mon Sep 17 00:00:00 2001 From: Carlos Lima Date: Tue, 29 Oct 2024 16:35:06 -0300 Subject: [PATCH 1/6] Fixing parsing Dropdown props --- playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx b/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx index 13af9cb3c5..f2a8c6122a 100644 --- a/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +++ b/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx @@ -47,7 +47,7 @@ interface DropdownComponent Container: typeof DropdownContainer; } -const Dropdown = forwardRef((props: DropdownProps, ref: any) => { +let Dropdown = (props: DropdownProps, ref: any) => { const { aria = {}, autocomplete = false, @@ -278,8 +278,9 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => { ) -}) as DropdownComponent +} +Dropdown = forwardRef(Dropdown) as DropdownComponent; Dropdown.displayName = "Dropdown"; Dropdown.Option = DropdownOption; Dropdown.Trigger = DropdownTrigger; From 203b07367ef9cc943df26dd29417b06325ea3a1b Mon Sep 17 00:00:00 2001 From: Carlos Lima Date: Thu, 31 Oct 2024 10:06:20 -0300 Subject: [PATCH 2/6] Fixing eslint errors --- .../pb_kits/playbook/pb_dropdown/_dropdown.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx b/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx index f2a8c6122a..4fb3249629 100644 --- a/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +++ b/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx @@ -47,7 +47,7 @@ interface DropdownComponent Container: typeof DropdownContainer; } -let Dropdown = (props: DropdownProps, ref: any) => { +const Dropdown: React.ForwardRefRenderFunction = (props, ref) => { const { aria = {}, autocomplete = false, @@ -260,7 +260,8 @@ let Dropdown = (props: DropdownProps, ref: any) => { {optionsWithBlankSelection && optionsWithBlankSelection?.map((option: GenericObject) => ( - ))} @@ -280,10 +281,10 @@ let Dropdown = (props: DropdownProps, ref: any) => { ) } -Dropdown = forwardRef(Dropdown) as DropdownComponent; -Dropdown.displayName = "Dropdown"; -Dropdown.Option = DropdownOption; -Dropdown.Trigger = DropdownTrigger; -Dropdown.Container = DropdownContainer; +const ForwardedDropdown = forwardRef(Dropdown) as DropdownComponent; +ForwardedDropdown.displayName = "Dropdown"; +ForwardedDropdown.Option = DropdownOption; +ForwardedDropdown.Trigger = DropdownTrigger; +ForwardedDropdown.Container = DropdownContainer; -export default Dropdown; +export default ForwardedDropdown; From dcf891bbd5ddda7fdb8a216b080de615f4f76bff Mon Sep 17 00:00:00 2001 From: Carlos Lima Date: Thu, 31 Oct 2024 11:34:05 -0300 Subject: [PATCH 3/6] Testing removing parse cache --- playbook-website/scripts/react-docgen.mjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/playbook-website/scripts/react-docgen.mjs b/playbook-website/scripts/react-docgen.mjs index 6443730214..f15c485c5f 100644 --- a/playbook-website/scripts/react-docgen.mjs +++ b/playbook-website/scripts/react-docgen.mjs @@ -62,10 +62,10 @@ function processKit({ kitPath }) { cachedKit = resolve(CACHE_DIR, `${kitFileName}.json`); // use cache if it exists - if (fs.existsSync(cachedKit)) { - const cachedKitContent = fs.readFileSync(cachedKit, 'utf8'); - return cachedKitContent; - } + // if (fs.existsSync(cachedKit)) { + // const cachedKitContent = fs.readFileSync(cachedKit, 'utf8'); + // return cachedKitContent; + // } const parser = withCustomConfig(TSCONFIG_PATH, PARSER_OPTIONS); const parsed = parser.parse(kitPath, PARSER_OPTIONS); From f826b8e8dc3d6253c5c32334757b3245e0ba6918 Mon Sep 17 00:00:00 2001 From: Carlos Lima Date: Thu, 31 Oct 2024 11:58:59 -0300 Subject: [PATCH 4/6] Testing removing parse cache --- playbook-website/scripts/react-docgen.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbook-website/scripts/react-docgen.mjs b/playbook-website/scripts/react-docgen.mjs index f15c485c5f..12de2f1d14 100644 --- a/playbook-website/scripts/react-docgen.mjs +++ b/playbook-website/scripts/react-docgen.mjs @@ -53,9 +53,9 @@ if (!kitPath) { } // cache handling -if (!fs.existsSync(CACHE_DIR)) { - fs.mkdirSync(CACHE_DIR, { recursive: true }); -} +// if (!fs.existsSync(CACHE_DIR)) { +// fs.mkdirSync(CACHE_DIR, { recursive: true }); +// } function processKit({ kitPath }) { const kitFileName = kitPath.split('/').reverse()[0].split('.')[0], From 0ea8e326dfddd916c10a78295e7d8ded2a1e14ef Mon Sep 17 00:00:00 2001 From: Carlos Lima Date: Thu, 31 Oct 2024 17:19:04 -0300 Subject: [PATCH 5/6] Fixing ts eslint errors --- playbook-website/scripts/react-docgen.mjs | 14 +++++++------- .../pb_kits/playbook/pb_dropdown/_dropdown.tsx | 17 ++++++++--------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/playbook-website/scripts/react-docgen.mjs b/playbook-website/scripts/react-docgen.mjs index 12de2f1d14..6443730214 100644 --- a/playbook-website/scripts/react-docgen.mjs +++ b/playbook-website/scripts/react-docgen.mjs @@ -53,19 +53,19 @@ if (!kitPath) { } // cache handling -// if (!fs.existsSync(CACHE_DIR)) { -// fs.mkdirSync(CACHE_DIR, { recursive: true }); -// } +if (!fs.existsSync(CACHE_DIR)) { + fs.mkdirSync(CACHE_DIR, { recursive: true }); +} function processKit({ kitPath }) { const kitFileName = kitPath.split('/').reverse()[0].split('.')[0], cachedKit = resolve(CACHE_DIR, `${kitFileName}.json`); // use cache if it exists - // if (fs.existsSync(cachedKit)) { - // const cachedKitContent = fs.readFileSync(cachedKit, 'utf8'); - // return cachedKitContent; - // } + if (fs.existsSync(cachedKit)) { + const cachedKitContent = fs.readFileSync(cachedKit, 'utf8'); + return cachedKitContent; + } const parser = withCustomConfig(TSCONFIG_PATH, PARSER_OPTIONS); const parsed = parser.parse(kitPath, PARSER_OPTIONS); diff --git a/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx b/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx index 4fb3249629..4f48887c25 100644 --- a/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +++ b/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx @@ -47,7 +47,7 @@ interface DropdownComponent Container: typeof DropdownContainer; } -const Dropdown: React.ForwardRefRenderFunction = (props, ref) => { +let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => { const { aria = {}, autocomplete = false, @@ -260,8 +260,7 @@ const Dropdown: React.ForwardRefRenderFunction = (props, {optionsWithBlankSelection && optionsWithBlankSelection?.map((option: GenericObject) => ( - // eslint-disable-next-line @typescript-eslint/no-use-before-define - ))} @@ -281,10 +280,10 @@ const Dropdown: React.ForwardRefRenderFunction = (props, ) } -const ForwardedDropdown = forwardRef(Dropdown) as DropdownComponent; -ForwardedDropdown.displayName = "Dropdown"; -ForwardedDropdown.Option = DropdownOption; -ForwardedDropdown.Trigger = DropdownTrigger; -ForwardedDropdown.Container = DropdownContainer; +Dropdown = forwardRef(Dropdown) as unknown as DropdownComponent; +(Dropdown as DropdownComponent).displayName = "Dropdown"; +(Dropdown as DropdownComponent).Option = DropdownOption; +(Dropdown as DropdownComponent).Trigger = DropdownTrigger; +(Dropdown as DropdownComponent).Container = DropdownContainer; -export default ForwardedDropdown; +export default Dropdown; From fe86adea9e84336eb3775d8aa8db950b2376cb00 Mon Sep 17 00:00:00 2001 From: Carlos Lima Date: Thu, 31 Oct 2024 17:33:55 -0300 Subject: [PATCH 6/6] Fixing DropdownOption eslint use --- playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx b/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx index 4f48887c25..b946f7f295 100644 --- a/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +++ b/playbook/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx @@ -260,7 +260,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => { {optionsWithBlankSelection && optionsWithBlankSelection?.map((option: GenericObject) => ( - ))}