From 3071ae41e6eb9dedee8c47fa0e406d7f4eb2e1cb Mon Sep 17 00:00:00 2001 From: tymur999 Date: Thu, 5 Mar 2026 15:15:47 -0600 Subject: [PATCH] tsconfig.json strictest --- src/about/AboutPage.tsx | 2 +- src/index/Canvas.tsx | 3 +-- src/index/Moon.tsx | 2 +- src/nav/Links.tsx | 4 ++-- src/nav/Nav.tsx | 2 +- src/router/RouterContext.tsx | 2 +- tsconfig.json | 30 ++++++++++++++++++++---------- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/about/AboutPage.tsx b/src/about/AboutPage.tsx index d1dadc8..a099a10 100644 --- a/src/about/AboutPage.tsx +++ b/src/about/AboutPage.tsx @@ -2,7 +2,7 @@ import "./about.scss"; import openingImage from "../img/IMG_20240725_175449_803.jpg"; import rainbow from "../img/IMG-0186.jpg"; import japanese from "../img/IMG_20230531_000224_01.jpg"; -import {PropsWithChildren} from "react"; +import type {PropsWithChildren} from "react"; export default function AboutPage() { return
diff --git a/src/index/Canvas.tsx b/src/index/Canvas.tsx index acc43c3..f09b4b6 100644 --- a/src/index/Canvas.tsx +++ b/src/index/Canvas.tsx @@ -1,8 +1,7 @@ import {motion} from "framer-motion"; import "./canvas.scss"; import {Canvas as ThreeCanvas, useFrame} from "@react-three/fiber"; -import React, {useMemo, useRef, useState} from "react"; -import {Mesh, Vector3} from "three"; +import {Vector3} from "three"; import {Moon} from "./Moon"; import {Stars} from "./Stars"; diff --git a/src/index/Moon.tsx b/src/index/Moon.tsx index 0972f1e..17f6955 100644 --- a/src/index/Moon.tsx +++ b/src/index/Moon.tsx @@ -1,4 +1,4 @@ -import {useMemo, useRef, useState} from "react"; +import {useRef, useState} from "react"; import {Mesh} from "three"; import {useFrame} from "@react-three/fiber"; diff --git a/src/nav/Links.tsx b/src/nav/Links.tsx index 7126528..d585b7c 100644 --- a/src/nav/Links.tsx +++ b/src/nav/Links.tsx @@ -1,9 +1,9 @@ -import React, {useState} from "react"; +import {useState} from "react"; import {Link} from "../router/Link"; import {motion} from "framer-motion"; export function Links() { - const [links, setLinks] = useState(["About", "Articles"]); + const [links] = useState(["About", "Articles"]); return
{ links.map(() => /* add spacers for flexbox */
)} diff --git a/src/nav/Nav.tsx b/src/nav/Nav.tsx index 1bd230e..82ddc80 100644 --- a/src/nav/Nav.tsx +++ b/src/nav/Nav.tsx @@ -1,4 +1,4 @@ -import React, {useState} from "react"; +import {useState} from "react"; import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; import {faBars} from "@fortawesome/free-solid-svg-icons/faBars"; import {Menu} from "./Menu"; diff --git a/src/router/RouterContext.tsx b/src/router/RouterContext.tsx index 0c03ea9..7e32741 100644 --- a/src/router/RouterContext.tsx +++ b/src/router/RouterContext.tsx @@ -1,4 +1,4 @@ -import {createContext, PropsWithChildren, useContext, useEffect, useState, useSyncExternalStore} from "react"; +import {createContext, PropsWithChildren, useContext, useEffect, useState, } from "react"; import {DEFAULT, Path, Router} from "./router"; const RouterContext = createContext(DEFAULT); diff --git a/tsconfig.json b/tsconfig.json index 6fbb737..ba4e60d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,28 +1,38 @@ { "compilerOptions": { - "target": "es5", + "target": "ES2022", "lib": [ - "dom", - "dom.iterable", - "esnext" + "DOM", + "DOM.Iterable", + "ES2022" ], "types": [ "webpack/module", "./src/index.d.ts" ], - "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "strict": true, "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", + "module": "ESNext", + "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + + "strict": true, + "allowJs": false, + "noFallthroughCasesInSwitch": true, + "allowUnreachableCode": false, + "exactOptionalPropertyTypes": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": true, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "allowUnusedLabels": false, }, "include": [ "src"