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

tsconfigcheck

v2.0.0

Published

Quickly check your tsconfig.json for missing properties.

Downloads

19

Readme

tsconfigcheck

npm install size

Quickly check your tsconfig.json for missing properties.

  • Compares your tsconfig.json against ALL "properties" from the official tsconfig schema
  • Uncomment's all commented-out properties in your tsconfig.json prior to checking so that they don't show up as missing

Why?

  1. tsc --init only includes a subset of all truly possible tsconfig properties.
  2. The tsconfig reference itself doesn't necessarily document each and every possible property.
  3. Opening a browser window every time just to check for new properties can be a hassle.
  4. ?
  5. OCD (probably)

Install

npm i -g tsconfigcheck

For one-off/impromptu invocations without worrying about local or global installation, skip the installation step above and use npx (see usage).

You may also install the cli/binary locally inside of your package if you'd like. The following will add tsconfigcheck to your developer dependencies (via the -D flag) inside your package.json and will place the physical binary inside of the local node_modules directory.

# Note: cd into your package's root directory first
npm i -D tsconfigcheck

Then, to run the locally installed binary, use npx (see usage).

If you don't have a tsconfig.json yet for your TypeScript project, you can generate one with tsc --init. You can also make the contents of tsconfig.json an empty object {} in order to simply get back a list of all valid properties from the schema.

Usage

# Missing path defaults to tsconfig.json in the current directory
tsconfigcheck [tsconfigpath]

# To run a local installation, or, if you skipped the installation step
npx tsconfigcheck [tsconfigpath]

Note: this is quite a rough and small program atm, hence why it has been restricted to checking tsconfigs only. In my opinion, it should really only be used as an interactive cli tool to help ensure yourself that you've gone over absolutely all of the current, published tsconfig settings (as reported by the official schema) when scaffolding a new project, and should probably not be relied upon for anything too serious (including using it in CI and other such automated environments). I imagine it is best used manually/by hand and by humans rather than machines, although merely piping the output into sed/awk/grep probably wouldn't hurt either if you'd like to do that in order to filter the output).

Missing properties are output as JSON property paths (more formally known as JavaScript Object Notation (JSON) Pointers), one per line. For any listed missing properties that you would like to introduce to your tsconfig.json, you will have to go back and add them to your tsconfig.json by hand.

Caveats, Etcetera

The buildOptions root property from the tsconfig schema does not appear to be documented in the public tsconfig reference, so it very well may not be a valid tsconfig.json property. It might only be listed in order to document cli-only options/flags, or it may simply exist for internal use only. You may want to ignore this property and everything under it.

The ts-node root property (including everything under it) is used for options to ts-node. It is typically only used/needed in projects that actually use ts-node.

This tool does not do any schema validation against tsconfig.json as it is not meant for that. Use a different tool to validate your tsconfig.json.

Missing properties output by this tool must be added to your tsconfig.json (if you wish to do so) manually/by-hand, or via any other such external means. The feature of automatically adding missing properties along with their default values (and possibly descriptions etc.) may come at a later time sometime in the future, as may a cli flag for generating a tsconfig.json complete with every single property.

Since, prior to comparing your tsconfig.json against the tsconfig schema, this tool attempts to uncomment any properties that have been commented-out via // in your tsconfig.json, any non-JSON appearing inside such comments will cause issues. If you are having issues with parser errors, make sure that every single property has a trailing comma before running this tool. Any JSON properties commented out via /* */ multiline comment markers will be falsely reported as missing from the file.

JSON pointers containing escape sequences are not properly handled yet, but this probably isn't an issue since there aren't any tsconfig.json properties that contain ~ or /.

Finally, issues and pull-requests are both welcomed and encouraged!

License

MIT