prefer-global/text-encoder
UnreleasedConfiguration
rslint.config.ts
Rule details
Enforces consistent use of the global TextEncoder or the TextEncoder export from util and node:util. Module references include require(), process.getBuiltinModule(), and static imports and re-exports.
Options
This rule accepts one string option:
"always"(default): use the globalTextEncoder."never": useTextEncoderfrom the module.
Enable Node.js globals in the configuration:
always
Examples of incorrect code:
Examples of correct code:
never
Examples of incorrect code:
Examples of correct code:
Global references respect configured globals and local bindings. For example, a function parameter named TextEncoder is not reported with "never".
This rule has no automatic fix or suggestions.