Skip to content

eslint/sort-imports Style

🛠️ An auto-fix is available for this rule for some violations.

What it does

This rule checks all import declarations and verifies that all imports are first sorted by the used member syntax and then alphabetically by the first member or alias name.

When declaring multiple imports, a sorted list of import declarations make it easier for developers to read the code and find necessary imports later.

Why is this bad?

Example

javascript
import { b, a, c } from "foo.js";

import d from "foo.js";
import e from "bar.js";

References

Released under the MIT License.