-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
eslint version: 7.20.0
eslint-plugin-import version: 2.22.1
According to the Webpack docs on resolve settings, a module can be ignored by providing a value of false. This is the replacement for the now-deprecated null-loader.
Setting
resolve.aliastofalsewill tell webpack to ignore a module.module.exports = { //... resolve: { alias: { 'ignored-module': false, './ignored-module': false, }, }, };
But when this configuration is used, and import/namespace (or another rule from this plugin) tries to resolve the namespace, eslint crashes:
Oops! Something went wrong! :(
ESLint: 7.20.0
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received type boolean (false)
at Object.statSync (node:fs:1125:10)
at Function.ExportMap.for (.../node_modules/eslint-plugin-import/src/ExportMap.js:305:20)
at Function.get (.../node_modules/eslint-plugin-import/src/ExportMap.js:293:10)
at forEach (.../node_modules/eslint-plugin-import/src/rules/namespace.js:49:35)
at Array.forEach (<anonymous>)
at Program (.../node_modules/eslint-plugin-import/src/rules/namespace.js:81:14)
at .../node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (.../node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (.../node_modules/eslint/lib/linter/node-event-generator.js:256:26)
An example of when this would be used is when a module is imported only in dev mode, but is stubbed out for production builds. At runtime it will never be used, but the import still exists in the code so the linter tries to resolve it.
It might make sense to treat this the same way as externals:
fregante, bstream, JonathanGuo, jvanderen1 and dcsaszar