# default-param-last

> Require parameters with a default value to come after the required ones

A default value is used when the caller leaves the argument out, but you can only leave out arguments at the end of a call. If a required parameter comes after it, the caller has to write `createUser(undefined, "Ada")` to get the default.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"default-param-last" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```js
function createUser(role = "member", name) {
  return { name, role };
}
```

Not reported:

{/* good */}
```js
function createUser(name, role = "member") {
  return { name, role };
}

function log(level = "info", ...messages) {
  console[level](...messages);
}
```
