package
ESLint plugin that enforces imports to follow native ESM resolution
npm install eslint-plugin-import-esmGitHub-flavored package documentation.
Across all versions, last 30 days.
7,626 in 30 days
Runtime metadata.
Tagged topics.
ESLint plugin that enforces imports to follow native ESM resolution.
You'll first need to install ESLint v9:
npm i eslint --save-devNext, install eslint-plugin-import-esm:
npm install eslint-plugin-import-esm --save-devThis plugin works well with eslint-plugin-import, which validates existence of paths amongst other checks.
Using the recommended preset:
import { defineConfig } from "eslint/config";
import importEsmPlugin from 'eslint-plugin-import-esm';
export default defineConfig([
importEsmPlugin.configs.recommended,
...
]);Using without the recommended preset:
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' }]
}
}
]);💼 Configurations enabled in.
✅ Set in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.
| Name | Description | 💼 | 🔧 |
|---|---|---|---|
| explicit-extension | Validate if import and export paths have an explicit extension | ✅ | 🔧 |
| Name | |
|---|---|
| ✅ | recommended |
Estimated unpacked size across 1 packages.
14.7 kB
Includes dependencies.