Enforce default parameters to be last
Putting default parameter at last allows function calls to omit optional tail arguments.
// Correct: optional argument can be omitted
function createUser(id, isAdmin = false) {}
createUser("tabby")
// Incorrect: optional argument can **not** be omitted
function createUser(isAdmin = false, id) {}
createUser(undefined, "tabby")
This rule enforces default parameters to be the last of parameters.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
This rule was introduced in ESLint v6.4.0.
© OpenJS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/latest/rules/default-param-last