mirror of
https://git.proxmox.com/git/pve-eslint
synced 2025-10-04 12:57:20 +00:00

includes a (minimal) working wrapper Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
766 B
766 B
enforce default parameters to be last (default-param-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")
Rule Details
This rule enforces default parameters to be the last of parameters.
Examples of incorrect code for this rule:
/* eslint default-param-last: ["error"] */
function f(a = 0, b) {}
function f(a, b = 0, c) {}
Examples of correct code for this rule:
/* eslint default-param-last: ["error"] */
function f(a, b = 0) {}