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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jipis/eslint-plugin-import-sort

v0.3.1

Published

A highly-opinionated ESLint plugin to enforce a strict custom sorting order of `import` statements across four clearly defined sections.

Downloads

20

Readme

@jipis/eslint-plugin-import-sort

A highly-opinionated ESLint plugin to enforce a strict custom sorting order of import statements across four clearly defined sections.

🔧 Rule: custom-import-sort

✨ Features

  • Groups imports into four distinct blocks:

    1. External packages ( from node_modules, e.g. 'react', 'lodash')
    2. Internal modules (from subdirectories of your project’s src directory, excluding src/types)
    3. Internal types (imports starting with types/)
    4. Stylesheets (.css, .scss, .sass)
  • Enforces blank lines between groups

  • Within each group:

    1. Named imports (e.g., import { foo } from 'bar';)
    2. Namespace imports (e.g., import * as Foo from 'bar';)
    3. Default imports (e.g., import Foo from 'bar';)
  • Fixes incorrect import order automatically with --fix

  • Supports both semicolon and no-semicolon code styles (though fix code will always be with semicolons -- TODO)


📦 Installation

npm install --save-dev @jipis/eslint-plugin-import-sort

🛠 Usage (ESLint Flat Config)

In your eslint.config.js:

import importSort from '@jipis/eslint-plugin-import-sort';

export default [
  {
    files: ['**/*.js', '**/*.ts'],
    plugins: {
      importSort,
    },
    rules: {
      'importSort/custom-import-sort': ['error', { srcDir: 'src' }],
    },
  },
];

🔧 Replace "src" with the root path of your source tree if different. The plugin scans that directory for subdirectories to treat as internal paths. If src is the root of the source tree, the option can be omitted.


✅ Example

// Correct
import fs from 'fs';
import path from 'path';

import { Button } from 'components';
import utils from 'utils/helpers';

import { MyType } from 'types/models';

import './index.css';
// Incorrect
import { MyType } from 'types/models';
import './index.css';
import utils from 'utils/helpers';
import path from 'path';
import fs from 'fs';
import { Button } from 'components';

🧪 Behavior Summary

  • All imports from external packages go first
  • Internal code imports (excluding types/) go next
  • Then internal types/ imports
  • Then stylesheets
  • Within each section:
    • Specifier groups (named → namespace → default)
    • Strict character sort (e.g. A < B < Z < a < b)
  • Blank line between each section
  • Fix output always includes semicolons

📁 Project Structure Assumptions

Your internal imports are assumed to be anything that:

  • Starts with a folder name under src/ (or your configured srcDir)
  • Starts with './' or '../'

Types are grouped separately if they start with types/.


📝 TODO

  • Add an option to enable or disable semicolons in the fixed code output
  • Handle mixed imports (e.g., named and default) from a single module more robustly
  • Ensure renamed imports (e.g., import { foo as bar }) are sorted and grouped correctly

💡 Suggestions or Issues?

Open a GitHub issue or pull request at jipis/eslint-plugin-import-sort.


📝 License

MIT