Skip to content

Files

Latest commit

 

History

History
20 lines (13 loc) · 750 Bytes

ordered-imports.md

File metadata and controls

20 lines (13 loc) · 750 Bytes

Pattern: Wrong import statement order

Issue: -

Description

Requires that import statements be alphabetized.

Enforce a consistent ordering for ES6 imports:

  • Named imports must be alphabetized (i.e. import {A, B, C} from "foo";)
    • The exact ordering can be controlled by the named-imports-order option.
    • longName as name imports are ordered by longName.
  • Import sources must be alphabetized within groups, i.e.: import * as foo from "a"; import * as bar from "b";
  • Groups of imports are delineated by blank lines. You can use these to group imports however you like, e.g. by first- vs. third-party or thematical ly.

Further Reading