npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

typescript-template-configs

v4.0.0

Published

Shared TypeScript configuration files for library templates. Provides standardized ESLint, Prettier, Vitest, TypeScript, and build configs.

Downloads

125

Readme

typescript-template-configs

Validate Configs Package

Shared TypeScript configuration files for library templates. Provides standardized ESLint, Prettier, Vitest, TypeScript, and build configs.

📦 What's Included

This package provides base configuration files for TypeScript library templates:

Locked Configs (Use As-Is)

  • .prettierrc - Code formatting rules
  • .prettierignore - Files to ignore from formatting

Extendable Configs (Can Be Customized)

  • eslint.config.base.mjs - Base ESLint rules + TypeScript support
  • vitest.config.base.ts - Vitest test framework configuration
  • tsconfig.base.json - TypeScript compiler base settings
  • tsdown.config.base.ts - Build configuration for tsdown
  • package-scripts.json - Standardized npm scripts reference

🚀 Installation

pnpm add -D typescript-template-configs

# Also install peer dependency:
pnpm add -D tsdown

🛠️ CLI Commands

Initialize Project

npx typescript-template-configs
# or
npx typescript-template-configs init

Creates .npmrc to configure pnpm to hoist CLI binaries from peer dependencies.

Show Help

npx typescript-template-configs help

List Bundled Packages

npx typescript-template-configs info

Shows all 19 packages bundled with this config (eslint, prettier, typescript, vitest, etc.) that you don't need to install separately.

Remove Redundant Dependencies

npx typescript-template-configs cleanup
# or auto-confirm with
npx typescript-template-configs cleanup --yes

Scans your package.json and removes any devDependencies that are already bundled with typescript-template-configs.

Minimal Installation

Since this package bundles all tooling, you only need:

{
  "devDependencies": {
    "typescript-template-configs": "^3.0.0",
    "tsdown": "^0.12.0"
  }
}

For local development (testing before publishing):

# Build first, then test
pnpm build
node dist/cli.js help

# Or link globally
pnpm link --global
typescript-template-configs help

📖 Usage

Prettier (Locked - Use Exact Copy)

Copy the Prettier config to your project root:

cp node_modules/typescript-template-configs/.prettierrc .
cp node_modules/typescript-template-configs/.prettierignore .

Or reference it in your package.json:

{
  "prettier": "typescript-template-configs/prettier"
}

ESLint (Extendable)

Basic usage (inherit all base rules):

// eslint.config.mjs
import baseConfig from "typescript-template-configs/eslint"

export default [...baseConfig]

Extended usage (add variant-specific rules):

// eslint.config.mjs
import baseConfig from "typescript-template-configs/eslint"

export default [
  ...baseConfig,
  {
    // React-specific rules
    files: ["**/*.tsx"],
    rules: {
      "react/jsx-uses-react": "error",
      "react-hooks/rules-of-hooks": "error",
    },
  },
]

Vitest (Extendable)

Basic usage:

// vitest.config.ts
import { defineConfig } from "vitest/config"
import baseConfig from "typescript-template-configs/vitest"

export default defineConfig(baseConfig)

Extended usage:

// vitest.config.ts
import { defineConfig } from "vitest/config"
import baseConfig from "typescript-template-configs/vitest"

export default defineConfig({
  ...baseConfig,
  test: {
    ...baseConfig.test,
    setupFiles: ["./test/setup.ts"], // Add custom setup
  },
})

TypeScript (Extendable)

Basic usage:

{
  "extends": "typescript-template-configs/tsconfig",
  "compilerOptions": {
    "outDir": "./dist"
  }
}

Extended usage:

{
  "extends": "typescript-template-configs/tsconfig",
  "compilerOptions": {
    "outDir": "./dist",
    "jsx": "react-jsx",
    "lib": ["ES2020", "DOM"]
  }
}

Tsdown (Extendable)

Basic usage:

// tsdown.config.ts
import baseConfig from "typescript-template-configs/tsdown"

export default baseConfig

Extended usage (customize entry points):

// tsdown.config.ts
import baseConfig from "typescript-template-configs/tsdown"
import type { UserConfig } from "tsdown"

export default {
  ...baseConfig,
  entry: ["src/index.ts", "src/cli.ts"], // Multiple entry points
} satisfies UserConfig

Package Scripts (Reference Only)

The package-scripts.json file contains standardized npm scripts. Copy the relevant scripts to your package.json:

{
  "scripts": {
    "validate": "pnpm format && pnpm lint && pnpm test && pnpm build",
    "format": "prettier --write .",
    "format:check": "prettier --check .",
    "lint": "eslint ./src --fix",
    "lint:check": "eslint ./src",
    "test": "vitest run",
    "test:watch": "vitest",
    "test:coverage": "vitest run --coverage",
    "test:ui": "vitest --ui",
    "build": "rimraf dist && cross-env NODE_ENV=production tsdown",
    "build:watch": "tsdown --watch",
    "dev": "tsdown --watch",
    "prepublishOnly": "pnpm validate",
    "ts-types": "tsc"
  }
}

🔄 Update Workflow

When configs are updated in this package, update your template:

# Update to latest version
pnpm update typescript-template-configs

# Re-copy locked files (Prettier)
cp node_modules/typescript-template-configs/.prettierrc .
cp node_modules/typescript-template-configs/.prettierignore .

# Test that everything still works
pnpm validate

🎯 Design Philosophy

Locked vs Extendable

Locked files ensure consistency across all templates:

  • Prettier - Code formatting should be identical everywhere
  • Prevents formatting debates and merge conflicts

Extendable files allow variant-specific customization:

  • ESLint - Different variants need different rules (React, Node.js, etc.)
  • Vitest - Some variants need custom test setup
  • TypeScript - Browser vs Node targets, JSX support, etc.
  • Build configs - Different entry points, output formats

Semantic Versioning

This package follows semver:

  • Patch (1.0.x) - Bug fixes in configs
  • Minor (1.x.0) - New configs added, backward compatible
  • Major (x.0.0) - Breaking changes to existing configs

📚 Available Template Variants

Templates using these configs:

  • typescript-library-template - Base template (tsdown)
  • typescript-library-template-vite - Vite-based variant (coming soon)
  • typescript-library-template-react - React library variant (coming soon)

🤝 Contributing

Found a bug or want to improve the configs?

  1. Fork this repository
  2. Make your changes
  3. Test in a template project
  4. Submit a PR with explanation

📄 License

MIT © Jordan Burke

🔗 Related