n/require-child-process-timeout
eslint-plugin-n
No autofix
eslint.config.js
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/require-child-process-timeout": "error",
},
},
];import { execSync, execFile, spawn } from "node:child_process"
import { promisify } from "node:util"
execSync("docker ps")
promisify(execFile)("gh", ["api", "user"])
spawn("docker", ["logs", "-f", "container"], { timeout: 0 })import { execSync, execFile, spawn } from "node:child_process"
import { promisify } from "node:util"
execSync("docker ps", { timeout: 10_000 })
promisify(execFile)("gh", ["api", "user"], { timeout: 60_000 })
spawn("docker", ["logs", "-f", "container"], {
signal: AbortSignal.timeout(60_000),
})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/require-child-process-timeout
eslint-plugin-n
import n from "eslint-plugin-n";
export default [
{
plugins: { n },
rules: {
"n/require-child-process-timeout": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce using node:assert/strict instead of node:assert.
Enforce either URLSearchParams or require("url").URLSearchParams
Enforce either global timer functions or require("timers")