n/prefer-global/timers
eslint-plugin-n
No autofix
eslint.config.js
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/prefer-global/timers": "error",
},
},
];const { setTimeout } = require("timers")
setTimeout(() => {}, 1000)setTimeout(() => {}, 1000)setTimeout(() => {}, 1000)const { setTimeout } = require("timers")
setTimeout(() => {}, 1000)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.
n/prefer-global/timers
eslint-plugin-n
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/prefer-global/timers": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce either TextEncoder or require("util").TextEncoder
Enforce either TextDecoder or require("util").TextDecoder
Enforce either URLSearchParams or require("url").URLSearchParams
Enforce using node:assert/strict instead of node:assert.