chore(config): pin @types/bun, tighten TypeScript strictness, and refactor config logic

- Pin `@types/bun` to `^1.3.14` for reproducible builds instead of using `latest`
- Update `tsconfig.json` with stricter type-checking flags and reorganize compiler options
- Refactor `initConfig` to DRY up the model default logic and add a null guard before process exit
This commit is contained in:
mitchell 2026-05-26 19:27:41 -04:00
parent d98ddb3ca7
commit f668037582
5 changed files with 39 additions and 26 deletions

View file

@ -18,7 +18,7 @@
},
"devDependencies": {
"@biomejs/biome": "2.4.12",
"@types/bun": "latest",
"@types/bun": "^1.3.14",
"esbuild": "0.28.0"
},
"peerDependencies": {

2
pnpm-lock.yaml generated
View file

@ -55,7 +55,7 @@ importers:
specifier: 2.4.12
version: 2.4.12
'@types/bun':
specifier: latest
specifier: ^1.3.14
version: 1.3.14
esbuild:
specifier: 0.28.0

View file

@ -23,17 +23,20 @@ export async function initConfig(old: AppConfig | null): Promise<AppConfig> {
if (isCancel(baseURL)) process.exit(1);
const models = await getModels(baseURL);
const initialValue = models.includes(old?.model ?? "")
? old?.model
: models[0];
const model = await autocomplete({
message: "Choose a default model:",
initialValue: models.includes(old?.model ?? "") ? old?.model : models[0],
placeholder: models.includes(old?.model ?? "") ? old?.model : models[0],
initialValue,
placeholder: initialValue ?? "Start typing...",
options: models.map((model) => ({ value: model })),
validate: (value) =>
models.includes(typeof value === "string" ? value : "")
? undefined
: `Unable to find model "${value}"`,
});
if (isCancel(model)) process.exit(1);
if (!model || isCancel(model)) process.exit(1);
const config = { baseURL, model } satisfies AppConfig;

View file

@ -1,4 +1,4 @@
import { renderMarkdown } from "./src/render/markdown.ts";
import { renderMarkdown } from "./src/render/markdown";
const text = await Bun.file("README.md").text();

View file

@ -1,29 +1,39 @@
{
// Visit https://aka.ms/tsconfig to read more about this file
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
// Environment Settings
// See also https://aka.ms/tsconfig/module
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"esModuleInterop": true,
"noEmit": true,
// For nodejs:
"lib": ["esnext"],
"types": ["bun"],
// and npm install -D @types/node
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Stricter Typechecking Options
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"exactOptionalPropertyTypes": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
// Style Options
"noImplicitReturns": true,
"noImplicitOverride": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true,
// Recommended Options
"strict": true,
"jsx": "react-jsx",
//"allowImportingTsExtensions": true,
"allowArbitraryExtensions": true,
"verbatimModuleSyntax": true,
"isolatedModules": true,
"noUncheckedSideEffectImports": true,
"moduleDetection": "force",
"skipLibCheck": true
}
}