ESLint plugin v3.0.1 that enforces import/export paths to follow native ESM resolution by requiring explicit file extensions (e.g., '.mjs', '.js'). Works exclusively with ESLint v9+ flat config and is fully ESM. Released as stable; active development. Unlike eslint-plugin-import which validates path existence, this focuses on explicit-extension rule to prevent ambiguous ESM resolution. Automatically fixable via --fix.
npm install eslint-plugin-import-esmVerified import paths — ran on the pinned version, not inferred.
Configures ESLint v9 flat config with recommended preset and explicit .mjs extension rule.
Migrate to ESLint flat config. Use defineConfig from 'eslint/config' and apply plugin configs as shown.
Use import statement in an ESM context (module type in package.json or .mjs file).
Upgrade Node.js to version 18.0.0 or newer.
Use 'import-esm/explicit-extension' instead of 'explicit-extension'.
Provide configuration: ['error', { extension: '.mjs' }] or ['warn', { extension: '.js' }].Run 'npm install eslint-plugin-import-esm --save-dev' and ensure it's in package.json dependencies.
Update ESLint to v9+ with 'npm install eslint@9 --save-dev'.
Use 'import importEsmPlugin from 'eslint-plugin-import-esm'' in an ESM context.
Use 'import-esm/explicit-extension' in the rules object.