eslint-module-utils (v2.12.1) provides core utilities for eslint-plugin-import and other module-related ESLint plugins. It includes helpers for parsing module resolution, resolving module paths, and managing module caches. Released under the MIT license, it supports Node >=4 and is maintained as part of the eslint-plugin-import ecosystem. Key differentiators: it is the foundational utility package powering eslint-plugin-import's module resolution, cache, and parsing features, and is used by plugins like eslint-plugin-import, eslint-plugin-node, and eslint-plugin-import-access.
npm install eslint-module-utilsVerified import paths — ran on the pinned version, not inferred.
Creates a ModuleCache instance, sets a resolved path for module 'fs', and retrieves it.
Pass an options object to the ModuleCache constructor, e.g., new ModuleCache({ cache: true }).Migrate to parseForESLint from @typescript-eslint/parser if using TypeScript.
Use the enhanced-resolve package or rely on eslint-plugin-import's resolver for modern resolution.
npm install eslint-module-utils --save-dev
npm install doctrine --save-dev
Use correct import: import { ModuleCache } from 'eslint-module-utils'