Skip to content

Commit 16541de

Browse files
committed
docs(linter): improve docs of default-param-last (#11032)
1 parent 2c2f3c4 commit 16541de

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

crates/oxc_linter/src/rules/eslint/default_param_last.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,29 @@ pub struct DefaultParamLast;
1616

1717
declare_oxc_lint!(
1818
/// ### What it does
19+
///
1920
/// Enforce default parameters to be last
2021
///
2122
/// ### Why is this bad?
23+
///
2224
/// Putting default parameter at last allows function calls to omit optional tail arguments.
2325
///
2426
/// ### Example
25-
/// ```javascript
26-
/// // Correct: optional argument can be omitted
27-
/// function createUser(id, isAdmin = false) {}
28-
/// createUser("tabby")
2927
///
28+
/// Examples of **incorrect** code for this rule:
29+
///
30+
/// ```javascript
3031
/// // Incorrect: optional argument can **not** be omitted
3132
/// function createUser(isAdmin = false, id) {}
3233
/// createUser(undefined, "tabby")
3334
/// ```
35+
///
36+
/// Examples of **correct** code for this rule:
37+
///
38+
/// ```javascript
39+
/// function createUser(id, isAdmin = false) {}
40+
/// createUser("tabby")
41+
/// ```
3442
DefaultParamLast,
3543
eslint,
3644
style

0 commit comments

Comments
 (0)