Build/Refactor: lint pre-commit hook and reformat repo to spec (#314)

* build/refactor: move lint/prettier packages to project root, install husky, add pre-commit hook

* refactor: reformat files

* build: put full eslintrc back with all rules
This commit is contained in:
Dan Orlando 2023-05-18 11:09:31 -07:00 committed by GitHub
parent 8d75b25104
commit 7fdc862042
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
157 changed files with 4836 additions and 2403 deletions

View file

@ -7,15 +7,9 @@ const CodeBlock = ({ lang, codeChildren }) => {
return (
<div className="rounded-md bg-black">
<CodeBar
lang={lang}
codeRef={codeRef}
/>
<CodeBar lang={lang} codeRef={codeRef} />
<div className="overflow-y-auto p-4">
<code
ref={codeRef}
className={`hljs !whitespace-pre language-${lang}`}
>
<code ref={codeRef} className={`hljs !whitespace-pre language-${lang}`}>
{codeChildren}
</code>
</div>

View file

@ -4,7 +4,7 @@ import rehypeKatex from 'rehype-katex';
import rehypeHighlight from 'rehype-highlight';
import remarkMath from 'remark-math';
import remarkGfm from 'remark-gfm';
import rehypeRaw from 'rehype-raw'
import rehypeRaw from 'rehype-raw';
import CodeBlock from './CodeBlock';
import { langSubset } from '~/utils/languages.mjs';
@ -19,7 +19,7 @@ const Content = React.memo(({ content }) => {
subset: langSubset
}
],
[rehypeRaw],
[rehypeRaw]
];
return (
@ -29,7 +29,7 @@ const Content = React.memo(({ content }) => {
linkTarget="_new"
components={{
code,
p,
p
// em,
}}
>
@ -46,17 +46,12 @@ const code = React.memo((props) => {
if (inline) {
return <code className={className}>{children}</code>;
} else {
return (
<CodeBlock
lang={lang || 'text'}
codeChildren={children}
/>
);
return <CodeBlock lang={lang || 'text'} codeChildren={children} />;
}
});
const p = React.memo((props) => {
return <p className="whitespace-pre-wrap mb-2">{props?.children}</p>;
return <p className="mb-2 whitespace-pre-wrap">{props?.children}</p>;
});
// const blinker = ({ node }) => {

View file

@ -3,7 +3,11 @@ import React from 'react';
export default function SubRow({ children, classes = '', subclasses = '', onClick }) {
return (
<div className={`flex justify-between ${classes}`} onClick={onClick}>
<div className={`flex items-center justify-center gap-1 self-center pt-2 text-xs ${subclasses}`}>{children}</div>
<div
className={`flex items-center justify-center gap-1 self-center pt-2 text-xs ${subclasses}`}
>
{children}
</div>
</div>
);
}