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

tidyscript

v1.0.1

Published

A CLI tool that analyses your code based on function length and indentation depth, checking for basic impediments to readability.

Readme

TidyScript Build Status codecov

A CLI tool that analyses your TypeScript of JavaScript code, checking for basic impediments to readability. The tool can be configured via a YAML config that sets limits on the length, in lines, of certain code block types, like functions, loops and classes. You can also set limits on the total number of occurences of these types in a given file. This is useful for reducing the number of conditionals in your code or reducing the number of functions in a class. Files that may have different structure to the rest of your project can be ignored. The data is then displayed in table form in the terminal, using Taybl.

Installation

To install TidyScript run

npm i tidyscript

Usage

To analyze your code using TidyScript, add it as a script to your package.json as

"tidyscript": tidyscript

and then run the command

npm run tidyscript <path>

where <path> is the directory or file that you want to analyze. Glob patterns can also be used. This will run TidyScript using some default values.

Installing TidyScript globally means you can just run

tidyscript <path>

from the root of any project.

To customise the limits you want to impose, and ignore any extraneous files, you'll need a .tidyscript.yml config file. A config file can be generated by running

tidyscript init

at the root of your project. Then values can be added for specific block types based on number of lines or number of occurences in any given file.

All blocks that violate these rules are then tabulated and displayed in the terminal.

Configuration

Line Limits

Line limits are limits on the number of lines in a given block type. That is, if a limit of 6 is specified for the 'function' type, then all functions with more than 6 lines in their body will be reported on. This is useful because functions, loops, if-statements and pretty much any block type becomes increasingly difficult to understand as the number of lines increases.

Type Limits

Type limits are limits on the number of occurences of a certain block type in a given file. That is, if a limit of 1 is specified for the 'class' type, then all files containing more than 1 class will be reported on. This is useful because code can often become worse with high concentrations of if-statements or loops. Also, for example, declaring multiple classes in the same file can sometimes be useful, but, more often than not, confuses the intention of the code.

Ignore

Some files have a purpose entirely different to the rest of the code, and thus don't abide by traditional ideas of cleanliness. It therefore makes more sense to ignore these files, rather than analyze them. To ignore a file or directory, add it to the list of files to ignore in the tidyscript config. Remember to seperate these paths into a list by using hyphens. Glob patterns are allowed in the ignore list, however, depending on the number of files matching the glob, this could impact performance. It is best to just ignore individual files and directories where possible.

Contributing

All contributions to TidyScript are welcome! Bug reports and feature requests are also encouraged. New functionality should be tested, and all existing tests should pass too. No one will be mad at you if you get it wrong so feel free to get involved!

Thanks for using TidyScript!