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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cprussin/tsconfig

v3.0.1

Published

A set of strict shared typescript configs

Downloads

2,020

Readme

@cprussin/tsconfig v3.0.1Docs


@cprussin/tsconfig v3.0.1

This package contains a set of strict shared typescript configs.

Installing

Use the package manager of your choice to install:

  • npm: npm install --save-dev @cprussin/tsconfig
  • pnpm: pnpm add -D @cprussin/tsconfig
  • yarn: yarn add -D @cprussin/tsconfig

Usage

Add the config you want to extend to your tsconfig.json, for example:

{
  "extends": "@cprussin/tsconfig/base.json"
}

Note that "noEmit": true is set by configs here. The intention is that most of the case, you're type checking with typescript and distributed untranspiled files, or that if you're transpiling then the transpilation tools you're using will override that setting in their own configs as needed. For instance, if you're using webpack, you could configure ts-loader like this:

{
  loader: "ts-loader",
  options: {
    compilerOptions: {
      sourceMap: process.env.NODE_ENV === "development",
      noEmit: false,
    },
  },
}

Or you could have a build script in your package.json that runs tsc directly:

{
  "name": "foo",
  "scripts": {
    "build": "tsc --noEmit false --outDir ./dist"
  }
}

Configurations

base.json

// tsconfig.json
{
  "extends": "@cprussin/tsconfig/base.json"
}

The base configuration that everything else extends from. Sets a bunch of strict options such as "strict": true, "allowJs": false, "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, etc. If you want to be as strict as I do and you aren't incrementally adding typescript to a legacy project, you probably don't want to override most of these options, but it might make sense to override the target or lib options.

Note that no options are set for JSX or for DOM libraries. If you need any of that, you'll want to use one of the configs that extends base.json instead of using base.json directly.

dom.json

// tsconfig.json
{
  "extends": "@cprussin/tsconfig/dom.json"
}

Very simply extends the base.json config by adding the dom and dom.iterable libs.

react.json

// tsconfig.json
{
  "extends": "@cprussin/tsconfig/react.json"
}

Adds the "jsx": "preserve" option to the dom.json config.

nextjs.json

// tsconfig.json
{
  "extends": "@cprussin/tsconfig/nextjs.json"
}

Adds the nextjs typescript plugin to the react.json config.

webworker.json

// tsconfig.json
{
  "extends": "@cprussin/tsconfig/webworker.json"
}

Extends the base.json config by adding the webworker lib.