{"record":{"id":"9b16bf03144006cf","repo":"oxc-project/oxc","slug":"defaults-are-not-permitted","errorCode":null,"errorMessage":"Defaults are not permitted.","messagePattern":"Defaults are not permitted\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/jsdoc/no_defaults.rs","lineNumber":16,"sourceCode":"use oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\nuse schemars::JsonSchema;\nuse serde::Deserialize;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n    utils::{get_function_nearest_jsdoc_node, should_ignore_as_internal, should_ignore_as_private},\n};\n\nfn no_defaults_diagnostic(span: Span, x1: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Defaults are not permitted.\").with_help(x1.to_string()).with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct NoDefaults(Box<NoDefaultsConfig>);\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// This rule reports defaults being used on the relevant portion of `@param` or `@default`.\n    /// It also optionally reports the presence of the square-bracketed optional arguments at all.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// The rule is intended to prevent the indication of defaults on tags\n    /// where this would be redundant with ES2015 default parameters.\n    ///\n    /// ### Examples\n    ///","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsdoc/no_defaults.rs#L1-L34","documentation":"Fires from jsdoc/no-defaults when a documented function parameter carries a default value in its signature while the rule forbids documenting/permitting defaults. The run visitor finds the nearest JSDoc node for the function and the helper attaches the rule's contextual help text.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/jsdoc/no_defaults.rs:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the default value from the parameter signature","Wrap the parameter in an options object if optional behavior is needed"],"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-14T05:17:10.506Z"}