{"record":{"id":"4ab90296c41d50a4","repo":"oxc-project/oxc","slug":"name-should-not-have-an-explicit-delay-of-0","errorCode":null,"errorMessage":"`{name}` should not have an explicit delay of `0`.","messagePattern":"`(.+?)` should not have an explicit delay of `0`\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/explicit_timer_delay.rs","lineNumber":24,"sourceCode":"use oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse schemars::JsonSchema;\nuse serde::Deserialize;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn missing_delay_diagnostic(span: Span, name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"`{name}` should have an explicit delay argument.\"))\n        .with_help(\"Add an explicit delay argument.\")\n        .with_label(span)\n}\n\nfn redundant_delay_diagnostic(span: Span, name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"`{name}` should not have an explicit delay of `0`.\"))\n        .with_help(\"Remove the explicit `0` delay argument.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Copy, Deserialize, JsonSchema)]\n#[serde(rename_all = \"kebab-case\")]\npub enum ExplicitTimerDelayMode {\n    #[default]\n    /// Require explicit `delay` argument for clarity.\n    Always,\n    /// Disallow explicit `0` delay, prefer implicit default.\n    Never,\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct ExplicitTimerDelay(ExplicitTimerDelayMode);\n\ndeclare_oxc_lint!(","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/explicit_timer_delay.rs#L6-L42","documentation":"Raised by unicorn/explicit_timer_delay (in its `never` mode) when `setTimeout` or `setInterval` is passed an explicit delay of `0` as its second argument. At the throw site the `0` is redundant — omitting the delay argument behaves identically (immediate async scheduling) — so the project style forbids spelling it out. redundant_delay_diagnostic fires from check_never for timer calls whose delay argument is the literal 0, naming the timer function in the message.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/explicit_timer_delay.rs:24 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the 0 delay argument from the timer call.","Set the rule option to 'always' if explicit delays are required."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}