import-js/eslint-plugin-import

[import/order] option to either sort by export name or alias name

Open

#3181 aperta il 24 apr 2025

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)JavaScript (1540 fork)batch import
help wantedimport/export orderingsemver-minor

Metriche repository

Star
 (4946 star)
Metriche merge PR
 (Merge medio 138g 22h) (3 PR mergiate in 30 g)

Descrizione

Given the following configuration:

"import/order": [
    "error",
    {
        alphabetize: {
            order: "asc",
        },
        named: true,
    },
],

The following import statement will fail:

import { b, a as c } from "lib"

That's because a is expected to be before b. However, since a is being renamed to c, I would like to be able to determine the order based on the alias name.

Guida contributor