Skip to content

eslint/default-param-last Style

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");

// Incorrect: optional argument can **not** be omitted
function createUser(isAdmin = false, id) {}
createUser(undefined, "tabby");

References

Released under the MIT License.