diff --git a/package.json b/package.json index b7e917d..cd7231b 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "zod": "^3.21.4" }, "devDependencies": { + "@total-typescript/tsconfig": "^1.0.4", "@types/d3-force": "^3.0.3", "@types/dedent": "^0.7.0", "@types/marked": "^4.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 51499a2..7feb078 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -52,6 +52,9 @@ dependencies: version: 3.23.8 devDependencies: + '@total-typescript/tsconfig': + specifier: ^1.0.4 + version: 1.0.4 '@types/d3-force': specifier: ^3.0.3 version: 3.0.10 @@ -267,6 +270,10 @@ packages: tslib: 2.7.0 dev: false + /@total-typescript/tsconfig@1.0.4: + resolution: {integrity: sha512-fO4ctMPGz1kOFOQ4RCPBRBfMy3gDn+pegUfrGyUFRMv/Rd0ZM3/SHH3hFCYG4u6bPLG8OlmOGcBLDexvyr3A5w==} + dev: true + /@types/d3-color@1.4.5: resolution: {integrity: sha512-5sNP3DmtSnSozxcjqmzQKsDOuVJXZkceo1KJScDc1982kk/TS9mTPc6lpli1gTu1MIBF1YWutpHpjucNWcIj5g==} dev: false diff --git a/src/components/IssueCard.tsx b/src/components/IssueCard.tsx index 5e7a80c..471d88a 100644 --- a/src/components/IssueCard.tsx +++ b/src/components/IssueCard.tsx @@ -2,7 +2,7 @@ import styles from "./IssueCard.module.css"; import { marked } from "marked"; import React, { useContext } from "react"; -import { IssueDetail } from "../core/_types"; +import type { IssueDetail } from "../core/_types"; import RelationshipGraph from "./RelationshipGraph"; import CoreContext from "../core/CoreContext"; import ProjectName from "./ProjectName"; diff --git a/src/components/Layer.tsx b/src/components/Layer.tsx index 64d0b45..28fc910 100644 --- a/src/components/Layer.tsx +++ b/src/components/Layer.tsx @@ -1,4 +1,4 @@ -import { ReactNode, useEffect, useState } from "react"; +import { type ReactNode, useEffect, useState } from "react"; import { createPortal } from "react-dom"; type Props = { diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 2d808ba..e3fd580 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -1,7 +1,7 @@ import styles from "./Layout.module.css"; import Link from "next/link"; -import { ReactNode, useContext } from "react"; +import { type ReactNode, useContext } from "react"; import CoreContext from "../core/CoreContext"; type Props = { diff --git a/src/components/NetworkGraph.tsx b/src/components/NetworkGraph.tsx index 7d0db15..d4db571 100644 --- a/src/components/NetworkGraph.tsx +++ b/src/components/NetworkGraph.tsx @@ -1,13 +1,13 @@ import { Graph } from "@visx/network"; import { - SimulationLinkDatum, - SimulationNodeDatum, + type SimulationLinkDatum, + type SimulationNodeDatum, forceCenter, forceLink, forceManyBody, forceSimulation, } from "d3-force"; -import { Graph as G, toD3 } from "graph-fns"; +import { type Graph as G, toD3 } from "graph-fns"; type Props = { width: number; diff --git a/src/components/RelationshipGraph.tsx b/src/components/RelationshipGraph.tsx index 0ec480f..63d1ea1 100644 --- a/src/components/RelationshipGraph.tsx +++ b/src/components/RelationshipGraph.tsx @@ -1,7 +1,7 @@ import { ParentSize } from "@visx/responsive"; import { addEdge, create, isCyclic } from "graph-fns"; import { useEffect, useState } from "react"; -import { RelationSummary, State } from "../core/_types"; +import type { RelationSummary, State } from "../core/_types"; import Layer from "./Layer"; import NetworkGraph from "./NetworkGraph"; import styles from "./RelationshipGraph.module.css"; diff --git a/src/core/Core.tsx b/src/core/Core.tsx index 558d295..b98c535 100644 --- a/src/core/Core.tsx +++ b/src/core/Core.tsx @@ -1,8 +1,8 @@ import { scaleLinear } from "@visx/scale"; -import { ReactNode, useCallback, useEffect, useState } from "react"; +import { type ReactNode, useCallback, useEffect, useState } from "react"; import weightedRandomPick from "../utils/weightedRandomPick"; import CoreContext from "./CoreContext"; -import { +import type { Comparison, ComparisonProperty, IssueDetail, @@ -49,10 +49,7 @@ const Core = ({ useEffect(() => { setState(incrementPendingRequest); - Promise.all([ - getIssueSummaries(), - getComparisons("effort"), - ]) + Promise.all([getIssueSummaries(), getComparisons("effort")]) .then(([issueSummaries, effortComparisons]) => { const stats: Record> = { effort: getStats(issueSummaries, effortComparisons), diff --git a/src/core/CoreContext.ts b/src/core/CoreContext.ts index 82a0a46..412123e 100644 --- a/src/core/CoreContext.ts +++ b/src/core/CoreContext.ts @@ -1,5 +1,5 @@ import { createContext } from "react"; -import { Comparison, ComparisonProperty, State } from "./_types"; +import type { Comparison, ComparisonProperty, State } from "./_types"; import defaultState from "./defaultState"; const CoreContext = createContext<{ diff --git a/src/core/IssueComparison.tsx b/src/core/IssueComparison.tsx index c6d1c2f..039bdad 100644 --- a/src/core/IssueComparison.tsx +++ b/src/core/IssueComparison.tsx @@ -1,10 +1,10 @@ import styles from "./IssueComparison.module.css"; import { useRouter } from "next/router"; -import { ReactNode, useContext, useState } from "react"; +import { type ReactNode, useContext, useState } from "react"; import IssueCard from "../components/IssueCard"; import CoreContext from "./CoreContext"; -import { Comparison } from "./_types"; +import type { Comparison } from "./_types"; type Props = { firstButtonLabel: string; diff --git a/src/core/defaultState.ts b/src/core/defaultState.ts index 9314bcc..ef57369 100644 --- a/src/core/defaultState.ts +++ b/src/core/defaultState.ts @@ -1,5 +1,5 @@ import { scaleLinear } from "@visx/scale"; -import { State } from "./_types"; +import type { State } from "./_types"; const defaultState: State = { comparisons: { effort: [] }, diff --git a/src/core/getComparisons.ts b/src/core/getComparisons.ts index e285f0e..ed2ff36 100644 --- a/src/core/getComparisons.ts +++ b/src/core/getComparisons.ts @@ -1,6 +1,6 @@ import { formatISO, fromUnixTime } from "date-fns"; import { z } from "zod"; -import { Comparison } from "./_types"; +import type { Comparison } from "./_types"; const KV_REST_API_TOKEN = process.env.KV_REST_API_TOKEN; const KV_REST_API_URL = process.env.KV_REST_API_URL; diff --git a/src/core/getStats.ts b/src/core/getStats.ts index 1a3a93f..fe9adc5 100644 --- a/src/core/getStats.ts +++ b/src/core/getStats.ts @@ -1,5 +1,5 @@ import { calculateStats } from "../utils/elo"; -import { Comparison, IssueSummary } from "./_types"; +import type { Comparison, IssueSummary } from "./_types"; const getStats = ( issues: Array, diff --git a/src/core/postComparisons.ts b/src/core/postComparisons.ts index ef27a3c..8858ba6 100644 --- a/src/core/postComparisons.ts +++ b/src/core/postComparisons.ts @@ -1,9 +1,9 @@ import { formatISO, fromUnixTime } from "date-fns"; import gql from "dedent"; -import { NextApiRequest } from "next"; +import type { NextApiRequest } from "next"; import { z } from "zod"; import { postBodySchema, postLinearResponseSchema } from "../linear/_schema"; -import { Comparison } from "./_types"; +import type { Comparison } from "./_types"; const KV_REST_API_TOKEN = process.env.KV_REST_API_TOKEN; const KV_REST_API_URL = process.env.KV_REST_API_URL; diff --git a/src/linear/LinearApp.tsx b/src/linear/LinearApp.tsx index 9f61a59..4baf051 100644 --- a/src/linear/LinearApp.tsx +++ b/src/linear/LinearApp.tsx @@ -1,7 +1,7 @@ import gql from "dedent"; -import { ReactNode, useCallback } from "react"; +import { type ReactNode, useCallback } from "react"; import Core from "../core/Core"; -import { +import type { Comparison, IssueDetail, IssueSummary, diff --git a/src/pages/_app.page.tsx b/src/pages/_app.page.tsx index 47fd4cd..7bacc85 100644 --- a/src/pages/_app.page.tsx +++ b/src/pages/_app.page.tsx @@ -1,6 +1,6 @@ import "./app.css"; -import { AppProps } from "next/app"; +import type { AppProps } from "next/app"; import LinearApp from "../linear/LinearApp"; const App = ({ Component, pageProps }: AppProps) => ( diff --git a/tsconfig.json b/tsconfig.json index dbaf8de..aeed536 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,16 @@ { + "extends": "@total-typescript/tsconfig/bundler/dom", "compilerOptions": { - "target": "es2015", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, + "incremental": true, "jsx": "preserve", - "incremental": true + "noEmit": true, + "noUncheckedIndexedAccess": false, + "paths": { + "@/*": ["./src/*"] + }, + "plugins": [{ "name": "next" }], + "strictNullChecks": true }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "core/SettingsForm.tsx.bak"], - "exclude": ["node_modules"] + "exclude": ["node_modules"], + "include": ["next-env.d.ts", ".next/types/**/*.ts", "src"] }