diff --git a/crates/oxc_linter/src/rules/eslint/default_param_last.rs b/crates/oxc_linter/src/rules/eslint/default_param_last.rs index 8bac472be4673..48372684f61f3 100644 --- a/crates/oxc_linter/src/rules/eslint/default_param_last.rs +++ b/crates/oxc_linter/src/rules/eslint/default_param_last.rs @@ -16,21 +16,29 @@ pub struct DefaultParamLast; declare_oxc_lint!( /// ### What it does + /// /// Enforce default parameters to be last /// /// ### Why is this bad? + /// /// Putting default parameter at last allows function calls to omit optional tail arguments. /// /// ### Example - /// ```javascript - /// // Correct: optional argument can be omitted - /// function createUser(id, isAdmin = false) {} - /// createUser("tabby") /// + /// Examples of **incorrect** code for this rule: + /// + /// ```javascript /// // Incorrect: optional argument can **not** be omitted /// function createUser(isAdmin = false, id) {} /// createUser(undefined, "tabby") /// ``` + /// + /// Examples of **correct** code for this rule: + /// + /// ```javascript + /// function createUser(id, isAdmin = false) {} + /// createUser("tabby") + /// ``` DefaultParamLast, eslint, style