Stricter compiling

This commit is contained in:
Dustin Brett 2024-11-14 13:44:52 -08:00
parent 81d4cde594
commit 16c65fc110
4 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import { sanitize } from "dompurify";
import DOMPurify from "dompurify";
import { useMemo } from "react";
import {
convertImageLinksToHtml,
@ -21,7 +21,7 @@ const SanitizedContent: FC<{ content: string; decrypted: boolean }> = ({
<div
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: sanitize(decryptedContent || content, {
__html: DOMPurify.sanitize(decryptedContent || content, {
ALLOWED_ATTR: ["src"],
ALLOWED_TAGS: ["br", "img"],
}),

View File

@ -17,7 +17,7 @@ export class ErrorBoundary extends Component<
this.state = { hasError: false };
}
public shouldComponentUpdate(): boolean {
public override shouldComponentUpdate(): boolean {
return false;
}
@ -25,7 +25,7 @@ export class ErrorBoundary extends Component<
return { hasError: true };
}
public render(): React.ReactNode {
public override render(): React.ReactNode {
const {
props: { children, FallbackRender },
state: { hasError },

View File

@ -33,13 +33,13 @@ const withStyledComponents = async (
};
class Document extends NextDocument {
public static async getInitialProps(
public static override async getInitialProps(
ctx: DocumentContext
): Promise<DocumentInitialProps> {
return withStyledComponents(ctx);
}
public render(): React.JSX.Element {
public override render(): React.JSX.Element {
return (
<Html lang={DEFAULT_LOCALE}>
<Head />

View File

@ -1,6 +1,7 @@
{
"compilerOptions": {
"allowJs": true,
"allowUnreachableCode": false,
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
@ -11,6 +12,7 @@
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"plugins": [{ "name": "next" }],
"resolveJsonModule": true,