GGistDev

Config and Tooling

Configure TypeScript for correctness and great DX. Integrate linting, formatting, and fast builds.

tsconfig essentials

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "strict": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "noUncheckedIndexedAccess": true,
    "noFallthroughCasesInSwitch": true,
    "exactOptionalPropertyTypes": true,
    "outDir": "dist",
    "sourceMap": true
  },
  "include": ["src"]
}

Key strict flags tighten correctness.

Path aliases

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/lib/*": ["src/lib/*"],
      "@/components/*": ["src/components/*"]
    }
  }
}

Project references (monorepos)

Split large codebases into buildable pieces.

// packages/core/tsconfig.json
{
  "compilerOptions": { "composite": true, "declaration": true, "outDir": "dist" },
  "include": ["src"]
}
// tsconfig.json at root
{
  "files": [],
  "references": [
    { "path": "packages/core" },
    { "path": "packages/web" }
  ]
}

ESLint + Prettier

  • Use @typescript-eslint parser and plugin
  • Extend recommended + strict configs
  • Let Prettier handle formatting; disable stylistic ESLint rules that conflict

Build setups

  • Vite/tsup/esbuild for libraries and apps
  • ts-node/tsx for scripts and dev tools
  • For Node ESM, use module: NodeNext and proper package.json type: "module"

Testing

  • Vitest/Jest with ts-jest or esbuild transformers
  • Use ts-node/register or native support in Vitest for TS test files

Summary

  • Turn on strict flags; model paths and references for scale
  • Pair ESLint + Prettier; pick a fast builder suited to your target