# order

Rule `import/order`. Enforce a convention in module import order.

- Source: import
- Technologies: Imports
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 10.3M weekly downloads of presets that enable it
- Trend: +1.9% last quarter
- Rank: #878 by reach, #1621 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `import/order` | no | safe | package `eslint-plugin-import` | [docs](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/order.md) |

## Code examples

### Incorrect: the rule reports this

```ts
import _ from 'lodash';
import path from 'path'; // `path` import should occur before import of `lodash`

// -----

var _ = require('lodash');
var path = require('path'); // `path` import should occur before import of `lodash`

// -----

var path = require('path');
import foo from './foo'; // `import` statements must be before `require` statement
```

### Correct: the rule accepts this

```ts
import path from 'path';
import _ from 'lodash';

// -----

var path = require('path');
var _ = require('lodash');

// -----

// Allowed as ̀`babel-register` is not assigned.
require('babel-register');
var path = require('path');

// -----

// Allowed as `import` must be before `require`
import foo from './foo';
var path = require('path');
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import importPlugin from "eslint-plugin-import";

export default [
  {
    plugins: { import: importPlugin },
    rules: {
      "import/order": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [import/no-useless-path-segments](https://lintradar.dev/rules/import/no-useless-path-segments.md): Forbid unnecessary path segments in import and require statements.
- [import/extensions](https://lintradar.dev/rules/import/extensions.md): Ensure consistent use of file extension within the import path.
- [import/no-self-import](https://lintradar.dev/rules/import/no-self-import.md): Forbid a module from importing itself.
- [import/no-cycle](https://lintradar.dev/rules/import/no-cycle.md): Forbid a module from importing a module with a dependency path back to itself.
- [import/newline-after-import](https://lintradar.dev/rules/import/newline-after-import.md): Enforce a newline after import statements.
- [import/no-extraneous-dependencies](https://lintradar.dev/rules/import/no-extraneous-dependencies.md): Forbid the use of extraneous packages.

---

Web page: https://lintradar.dev/rules/import/order. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
