n/prefer-global/text-decoder
eslint-plugin-n
No autofix
eslint.config.js
Enforce either TextDecoder or require("util").TextDecoder
const { TextDecoder } = require("util")
const u = new TextDecoder(s)const u = new TextDecoder(s)const u = new TextDecoder(s)const { TextDecoder } = require("util")
const u = new TextDecoder(s)Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
Enforce either global timer functions or require("timers")
n/prefer-global/text-decoder
eslint-plugin-n
Oxlint does not have this rule.
Biome does not have this rule.
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/prefer-global/text-decoder": "error",
},
},
];