Skip to content

Commit 643986b

Browse files
disable prettier for JSX block with ts-ignore comments
1 parent 8d21ffe commit 643986b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/components/MDX/Sandpack/NavigationBar.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
115115

116116
return (
117117
<div className="bg-wash dark:bg-card-dark flex justify-between items-center relative z-10 border-b border-border dark:border-border-dark rounded-t-lg text-lg">
118+
{/* If Prettier reformats this block, the two @ts-ignore directives will no longer be adjacent to the problematic lines, causing TypeScript errors */}
119+
{/* prettier-ignore */}
118120
<div className="flex-1 grow min-w-0 px-4 lg:px-6">
119121
{/* @ts-ignore: the Listbox type from '@headlessui/react' is incompatible with JSX in React 19 */}
120122
<Listbox value={activeFile} onChange={setActiveFile}>
@@ -163,14 +165,10 @@ export function NavigationBar({providedFiles}: {providedFiles: Array<string>}) {
163165
</Listbox.Button>
164166
</div>
165167
</div>
166-
{/* prettier-ignore: If Prettier reformats this block, the @ts-ignore directive will no longer be adjacent to the problematic line, causing TypeScript errors */}
167168
{/* @ts-ignore: the Listbox type from '@headlessui/react' is incompatible with JSX in React 19 */}
168-
{isMultiFile && showDropdown && (
169-
<Listbox.Options className="absolute mt-0.5 bg-card dark:bg-card-dark px-2 inset-x-0 mx-0 rounded-b-lg border-1 border-border dark:border-border-dark rounded-sm shadow-md">
170-
{/* prettier-ignore: If Prettier reformats this block, the @ts-ignore directive will no longer be adjacent to the problematic line, causing TypeScript errors */}
169+
{isMultiFile && showDropdown && (<Listbox.Options className="absolute mt-0.5 bg-card dark:bg-card-dark px-2 inset-x-0 mx-0 rounded-b-lg border-1 border-border dark:border-border-dark rounded-sm shadow-md">
171170
{/* @ts-ignore: the Listbox type from '@headlessui/react' is incompatible with JSX in React 19 */}
172-
{visibleFiles.map((filePath: string) => (
173-
<Listbox.Option key={filePath} value={filePath} as={Fragment}>
171+
{visibleFiles.map((filePath: string) => (<Listbox.Option key={filePath} value={filePath} as={Fragment}>
174172
{({active}) => (
175173
<li
176174
className={cn(

0 commit comments

Comments
 (0)