Skip to content

Commit f387c2a

Browse files
committed
fix lint issues
1 parent 1d3cd13 commit f387c2a

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

src/components/MDX/CodeDiagram.tsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* Copyright (c) Facebook, Inc. and its affiliates.
33
*/
44

5-
import { Children } from 'react';
65
import * as React from 'react';
6+
import { Children } from 'react';
77
import CodeBlock from './CodeBlock';
88

99
interface CodeDiagramProps {
@@ -15,14 +15,17 @@ export function CodeDiagram({ children, flip = false }: CodeDiagramProps) {
1515
const illustration = Children.toArray(children).filter((child: any) => {
1616
return child.type === 'img';
1717
});
18-
const content = Children.toArray(children).map((child: any) => {
18+
const content = Children.toArray(children).map((child: any, i) => {
19+
let ch = null;
1920
if (child.type?.mdxName === 'pre') {
20-
return <CodeBlock {...child.props} noMargin={true} noMarkers={true} />;
21+
ch = <CodeBlock {...child.props} noMargin={true} noMarkers={true} />;
2122
} else if (child.type === 'img') {
22-
return null;
23+
ch = null;
2324
} else {
24-
return child;
25+
ch = child;
2526
}
27+
28+
return <React.Fragment key={i}>{ch}</React.Fragment>;
2629
});
2730
if (flip) {
2831
return (

src/components/MDX/MDXComponents.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function AuthorCredit({
192192
}) {
193193
return (
194194
<div className="sr-only group-hover:not-sr-only group-focus-within:not-sr-only hover:sr-only">
195-
<p className="bg-card dark:bg-card-dark text-center text-sm text-secondary dark:text-secondary-dark leading-tight dark:text-secondary-dark p-2 rounded-lg absolute left-1/2 top-0 -translate-x-1/2 -translate-y-full group-hover:flex group-hover:opacity-100 after:content-[''] after:absolute after:left-1/2 after:top-[95%] after:-translate-x-1/2 after:border-8 after:border-x-transparent after:border-b-transparent after:border-t-card after:dark:border-t-card-dark opacity-0 transition-opacity duration-300">
195+
<p className="bg-card dark:bg-card-dark text-center text-sm text-secondary dark:text-secondary-dark leading-tight p-2 rounded-lg absolute left-1/2 top-0 -translate-x-1/2 -translate-y-full group-hover:flex group-hover:opacity-100 after:content-[''] after:absolute after:left-1/2 after:top-[95%] after:-translate-x-1/2 after:border-8 after:border-x-transparent after:border-b-transparent after:border-t-card after:dark:border-t-card-dark opacity-0 transition-opacity duration-300">
196196
<cite>
197197
Illustrated by{' '}
198198
{authorLink ? (
@@ -236,6 +236,7 @@ function Illustration({
236236
return (
237237
<div className="relative group before:absolute before:-inset-y-16 before:inset-x-0 my-16 mx-0 2xl:mx-auto max-w-4xl 2xl:max-w-6xl">
238238
<figure className="my-8 flex justify-center">
239+
{/* eslint-disable-next-line @next/next/no-img-element */}
239240
<img
240241
src={src}
241242
alt={alt}
@@ -272,6 +273,7 @@ function IllustrationBlock({
272273
const images = imageInfos.map((info, index) => (
273274
<figure key={index}>
274275
<div className="bg-white rounded-lg p-4 flex-1 flex xl:p-6 justify-center items-center my-4">
276+
{/* eslint-disable-next-line @next/next/no-img-element */}
275277
<img src={info.src} alt={info.alt} height={info.height} />
276278
</div>
277279
{info.caption ? (

src/components/MDX/Sandpack/NavigationBar.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const getFileName = (filePath: string): string => {
3333
};
3434

3535
export function NavigationBar({
36-
providedFiles,
3736
}: {
3837
providedFiles: Array<string>;
3938
}) {

src/components/Sponsor.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ export function Sponsor({
2828
className,
2929
'text-base flex-row leading-tight font-bold border rounded-md py-5 px-5 inline-flex items-center my-1',
3030
)}>
31-
<img src={image} className='w-16 h-16 mr-4' />
31+
{/* eslint-disable-next-line @next/next/no-img-element */}
32+
<img src={image} alt={title} className='w-16 h-16 mr-4' />
3233
<div className={'flex-col'}>
3334
<div className={'text-lg font-bold'}>{title}</div>
34-
<div className={'text-sm'}>{children}</div>
35+
{!!children && <div className={'text-sm'}>{children}</div>}
3536
</div>
3637
</a>
3738
);

src/hooks/usePendingRoute.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import { useRouter } from 'next/router';
6-
import { useState, useRef, useEffect } from 'react';
6+
import { useEffect, useRef, useState } from 'react';
77

88
const usePendingRoute = () => {
99
const { events } = useRouter();
@@ -33,7 +33,7 @@ const usePendingRoute = () => {
3333
events.off('routeChangeComplete', handleRouteChangeComplete);
3434
clearTimeout(routeTransitionTimer);
3535
};
36-
}, []);
36+
}, [events]);
3737

3838
return pendingRoute;
3939
};

0 commit comments

Comments
 (0)