npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details


  • User packages



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.


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 🙏

© 2021 – Pkg Stats / Ryan Hefner




Re-orders import statements in JavaScript and TypeScript files.





Re-orders imports in JavaScript and TypeScript files, in-place. Usable with ES6-style import, as well as Node-style require. Handles multi-line imports, as well as interspersed comments.

Important Notes

  • Requires use of semicolons.
  • Comments associated with imports must be placed above their associated imports, NOT to the right of their imports on the same line; otherwise, they will be associated with the next statement.


Alphabetizes members.

import { fnB , fnC, fnA } from 'some-source';


import { fnA, fnB , fnC } from 'some-source';

Alphabetizes imports.

import { fnD , fnF, fnE } from 'some-module';
import { fnB , fnC, fnA } from 'some-source';


import { fnA , fnB, fnC } from 'some-source';
import { fnD , fnE, fnF } from 'some-module';

Groups related imports.

Example, grouped by /vendor/ and /homegrown/.

import { fnD , fnF, fnE } from 'some-vendor-lib';
import { ComponentX } from 'some-homegrown-module';
import { fnB , fnC, fnA } from 'other-vendor-lib';
import { ModuleY } from 'other-homegrown-module';


import { fnA , fnB, fnC } from 'other-vendor-lib';
import { fnD , fnE, fnF } from 'some-vendor-lib';

import { ComponentX } from 'some-homegrown-module';
import { ModuleY } from 'other-homegrown-module';

Usage (WIP)


npm install import-reorder


The CLI looks for a file named reorder.config.js in the current working directory. The config should export an object with the following shape (with examples):

module.exports = {
  caseSensitive: false,
  defaultGroup: 'Components',
  fileTypes: /(\.js$|\.jsx$|\.ts$|\.tsx$)/,
  groups: {
    Vendor: /(react|mobx|vendor)/,
    Platform: /platform/,
    Toolkit: /toolkit/,
    'Models/Constants/Types': /(models|constants|types)/,
    Stores: /stores/,
    StdLib: /fs/,
    Config: /config/
  ignoreFiles: /config/,
  importPattern: /(import.*from|const.*require)/,
  indentSpaces: 2,
  maxLineLength: 80,
  membersBegin: /(import \{|const \{)/
  • caseSensitive: Whether to compare case sensitively. Defaults to false if unset (case insensitive).
  • defaultGroup: Name of the default group, should you want to label it.
  • fileTypes: The filetypes you want to read; regex of the file extensions.
  • groups: Defines the groups you want your imports to be in, groupName: /pattern/.
  • ignoreFiles: The files you want to ignore and not modify (for use cases like dynamic imports).
  • indentSpaces: Size of your indent.
  • maxLineLength: Length of your lines.


The CLI expects paths separated by \n if there are multiple, relative to the current working directory.

echo 'fileA.js\nfileB.js\nAnotherDir/fileC.ts' | node_modules/import-reorder/reorder.js

With staged files:

git diff --name-only --cached | node_modules/import-reorder/reorder.js

The above can be added as a git hook with tools like Husky. Example:

// package.json
  "husky": {
    "hooks": {
      "pre-commit": "git diff --name-only --cached | node_modules/import-reorder/reorder.js",


import-reorder exports the CLI as well as the ReOrderer class. The class requires as parameters a config object (see above) and the current working directory.

const ReOrderer = require('./import-reorder');

const config = require(`${process.cwd()}/reorder.config`);

const reOrderer = new ReOrderer(config, process.cwd());

const sortedText = reOrderer.processText(someBlobOfText);

With the class, it's possible to make this tool part of more complex workflows.