# eslint-plugin-import-sorting

> ESLint plugin to group and sort imports by module, à la Python isort

Latest version **2.2.0** (published 2025-01-21) · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-import-sorting
pnpm add eslint-plugin-import-sorting
yarn add eslint-plugin-import-sorting
bun add eslint-plugin-import-sorting
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2025-01-21 |
| First published | 2023-12-12 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.17.0 \|\| >=18.6.0 |
| Dependencies | 2 |
| Unpacked size | 73.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jeff |
| Maintainers | stormwarning |
| Keywords | eslint, eslint-plugin, eslintplugin, import, isort, order, python, sort |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-import-sorting
- Repository: https://github.com/stormwarning/eslint-plugin-import-sorting
- Homepage: https://github.com/stormwarning/eslint-plugin-import-sorting#readme
- Issues: https://github.com/stormwarning/eslint-plugin-import-sorting/issues
- npm.io page: https://npm.io/package/eslint-plugin-import-sorting

## Dependencies (2)

- [object.groupby](https://npm.io/package/object.groupby.md) 1.0.1
- [@typescript-eslint/utils](https://npm.io/package/@typescript-eslint/utils.md) 7.18.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2025-01-21
- 2.1.1 — 2024-12-19
- 2.1.0 — 2024-12-13
- 2.0.0 — 2024-08-30
- 1.2.2 — 2024-08-30
- 1.2.1 — 2024-08-29
- 1.2.0 — 2024-04-29
- 1.1.0 — 2024-01-30
- 1.0.3 — 2024-01-23
- 1.0.2 — 2024-01-19
- 1.0.1 — 2024-01-18
- 1.0.0 — 2023-12-12
- 0.0.0 — 2023-12-12

## README

# eslint-plugin-import-sorting

Enforce a convention in the order of `import` statements, inspired by 
[isort](https://timothycrosley.github.io/isort/#how-does-isort-work)’s grouping style:

1. Node standard modules
2. Framework modules
3. External modules
4. Internal modules
5. Explicitly local modules

This plugin includes an additional group for “style” imports where the import
source ends in `.css` or other style format. Imports are sorted alphabetically,
except for local modules, which are sorted by the number of `.` segements in
the path first, then alphabetically.

## Usage

Install the plugin, and ESLint if it is not already.

```sh
npm install --save-dev eslint eslint-plugin-import-sorting
```

Include the plugin in the `plugins` key of your ESLint config and enable the
rules.

```js
// eslint.config.js

import importSortingPlugin from 'eslint-plugin-import-sorting'

export default [
	{
		plugins: {
			'import-sorting': importSortingPlugin,
		},
		rules: {
			'import-sorting/order': 'error',
		},
	},
]
```

<!-- begin auto-generated rules list -->

🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).

| Name                                             | Description                                 | 🔧 |
| :----------------------------------------------- | :------------------------------------------ | :- |
| [order](docs/rules/order.md)                     | Consistently order `import` statements.     | 🔧 |
| [specifier-order](docs/rules/specifier-order.md) | Consistently order named import specifiers. | 🔧 |

<!-- end auto-generated rules list -->

---
_Source: https://npm.io/package/eslint-plugin-import-sorting · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
