ESLint import resolver for ESM modules via package.json exports map.
Relies on NPM package resolve.exports
https://github.com/lukeed/resolve.exports
See:
- import-js/eslint-plugin-import#1868
- import-js/eslint-plugin-import#1810
- browserify/resolve#224
- wooorm/import-meta-resolve#2
- eslint-community/eslint-plugin-n#4
- mysticatea/eslint-plugin-node#255
- mysticatea/eslint-plugin-node#244
- mysticatea/eslint-plugin-node#258
- https://github.com/webpack/enhanced-resolve
Ok, so I ran some additional tests.
Both "my" and "your"
builtinModules
solutions work (I tested them one by one, and I added an import typo likefss
instead offs
to check false negatives / positives), ... however note in my case I have the following ESLint config:...the important part is the
import/resolver
>typescript
object, which when commented-out triggers either of ourbuiltinModules
conditionals (for example, forimport { readFileSync } from "fs"
). However if I leave mytypescript
settings in, then thebuiltinModules
conditionals are never reached, as NodeJS module imports such asfs
seem to be captured appropriately somewhere else in the ESLint resolver chain, outside of my custom resolver.