-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Description:
When using the no-nodejs-modules
rule from eslint-plugin-import, the cross-environment crypto module is flagged as a violation. Even though it can be a Node.js core module, so technically it's not wrong, but it can also be available from most browser environments and hence violate the intent of the rule that prevent any node js module import are used in browser environment.
Example Code:
import * as crypto from 'crypto';
Expected Behavior:
crypto
should not be flagged by no-nodejs-modules if the context is ambiguous since it is also available in browser environments. The rule should differentiate between modules that are strictly Node.js core modules (e.g. node:crypto
) and those that are also valid in browser contexts.
Actual Behavior:
Do not import Node.js builtin module "crypto"eslint[import/no-nodejs-modules](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/no-nodejs-modules.md)
Environment:
- eslint-plugin-import: 2.32.0
- ESLint: 9.31.0