File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
crates/oxc_linter/src/rules/eslint Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -16,21 +16,29 @@ pub struct DefaultParamLast;
1616
1717declare_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
You can’t perform that action at this time.
0 commit comments