# eslint-plugin-import-esm

> ESLint plugin that enforces imports to follow native ESM resolution

Latest version **3.0.1** (published 2025-06-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-import-esm
pnpm add eslint-plugin-import-esm
yarn add eslint-plugin-import-esm
bun add eslint-plugin-import-esm
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2025-06-26 |
| First published | 2023-01-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 18.0.0 |
| Dependencies | 0 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | André Cruz |
| Maintainers | satazor |
| Keywords | eslint, eslintplugin, eslint-plugin, esm, node, resolution |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-import-esm
- Repository: https://github.com/satazor/eslint-plugin-import-esm
- Homepage: https://github.com/satazor/eslint-plugin-import-esm#readme
- Issues: https://github.com/satazor/eslint-plugin-import-esm/issues
- npm.io page: https://npm.io/package/eslint-plugin-import-esm

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 3.0.1 (latest) — 2025-06-26
- 3.0.0 — 2025-06-26
- 2.0.0 — 2024-02-04
- 1.2.1 — 2023-01-17
- 1.1.1 — 2023-01-17
- 1.1.0 — 2023-01-15
- 1.0.0 — 2023-01-14
- 0.0.1 — 2023-01-14

## README

# eslint-plugin-import-esm

ESLint plugin that enforces imports to follow native ESM resolution.

## Installation

You'll first need to install [ESLint v9](https://eslint.org/):

```sh
npm i eslint --save-dev
```

Next, install `eslint-plugin-import-esm`:

```sh
npm install eslint-plugin-import-esm --save-dev
```

This plugin works well with [`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import), which validates existence of paths amongst other checks.

## Usage

Using the recommended preset:

```js
import { defineConfig } from "eslint/config";
import importEsmPlugin from 'eslint-plugin-import-esm';

export default defineConfig([
  importEsmPlugin.configs.recommended,
  ...
]);
```

Using without the recommended preset:

```js
import { defineConfig } from "eslint/config";
import importEsmPlugin from 'eslint-plugin-import-esm';

export default defineConfig([
  {
    plugins: { 'import-esm': importEsmPlugin },
    rules: {
      'import-esm/explicit-extension': ['error', { extension: '.mjs' }]
    }
  }
]);
```

## Rules

<!-- begin auto-generated rules list -->

💼 Configurations enabled in.\
✅ Set in the `recommended` configuration.\
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).

| Name                                                   | Description                                                    | 💼 | 🔧 |
| :----------------------------------------------------- | :------------------------------------------------------------- | :- | :- |
| [explicit-extension](docs/rules/explicit-extension.md) | Validate if import and export paths have an explicit extension | ✅  | 🔧 |

<!-- end auto-generated rules list -->

## Configs

<!-- begin auto-generated configs list -->

|    | Name          |
| :- | :------------ |
| ✅  | `recommended` |

<!-- end auto-generated configs list -->

---
_Source: https://npm.io/package/eslint-plugin-import-esm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
