[skip ci] add react linting

This commit is contained in:
Vendicated 2023-10-31 23:43:28 +01:00
parent 522fdcd15d
commit 18fdc33ee7
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
37 changed files with 884 additions and 97 deletions

View file

@ -46,7 +46,7 @@ export const Code = ({
.split("\n")
.map((line, i) => <span key={i} dangerouslySetInnerHTML={{ __html: line }} />);
} catch {
lines = content.split("\n").map(line => <span>{line}</span>);
lines = content.split("\n").map((line, i) => <span key={i}>{line}</span>);
}
} else {
const renderTokens =
@ -55,11 +55,11 @@ export const Code = ({
.split("\n")
.map(line => [{ color: theme.plainColor, content: line } as IThemedToken]);
lines = renderTokens.map(line => {
lines = renderTokens.map((line, i) => {
// [Cynthia] this makes it so when you highlight the codeblock
// empty lines are also selected and copied when you Ctrl+C.
if (line.length === 0) {
return <span>{"\n"}</span>;
return <span key={i}>{"\n"}</span>;
}
return (

View file

@ -18,7 +18,7 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { useAwaiter, useIntersection } from "@utils/react";
import { hljs, React } from "@webpack/common";
import { hljs } from "@webpack/common";
import { resolveLang } from "../api/languages";
import { shiki } from "../api/shiki";