talira

eslint-plugin-simple-import-sort

Autofixable import and export sorting for ESLint

open sourceMITfree

An ESLint plugin that sorts imports, and exports where possible, when you run eslint --fix, so you never sort them by hand. It handles comments and type imports, works with TypeScript, Prettier, dprint and eslint-plugin-import, and has no dependencies. It doesn't sort require calls.

Problems it solves

  • stop arguing about import order in code review
  • automatically sort JavaScript and TypeScript imports when I run ESLint
  • keep import order consistent without a separate formatter

Features

  • sorts imports with eslint --fix
  • sorts exports where possible
  • keeps comments with their imports
  • handles TypeScript type imports and exports
  • works alongside Prettier, dprint and eslint-plugin-import
  • no dependencies

Limitations

  • It doesn't sort require calls.1

Alternatives

The same job

These do what eslint-plugin-simple-import-sort does.

  1. eslint-plugin-import ESLint rules that validate imports and exports
  2. typescript-eslint The tooling that lets ESLint and Prettier lint and read TypeScript
  3. ESLint Find and fix problems in your JavaScript code.
  4. eslint-import-resolver-typescript TypeScript import resolution for eslint-plugin-import and eslint-plugin-import-x
  5. Oxc The JavaScript Oxidation Compiler: high-performance JavaScript and TypeScript tools in Rust
  6. XO Zero-config JavaScript and TypeScript linter built on ESLint

Compare eslint-plugin-simple-import-sort with the top 3