Skip to content

noUselessUndefined

biome.json
{
"linter": {
"rules": {
"nursery": {
"noUselessUndefined": "error"
}
}
}
}

Disallow the use of useless undefined.

undefined is the default value for new variables, parameters, return statements, etc., so specifying it doesn’t make any difference.

let foo = undefined;
code-block.js:1:11 lint/nursery/noUselessUndefined  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Don’t use unnecessary undefined.

> 1 │ let foo = undefined;
^^^^^^^^^
2 │

undefined is the default value for new variables, parameters, return statements, etc… so specifying it doesn’t make any difference.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Safe fix: Remove the undefined.

1 │ let·foo·=·undefined;
-----------
const {foo = undefined} = bar;
code-block.js:1:14 lint/nursery/noUselessUndefined  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Don’t use unnecessary undefined.

> 1 │ const {foo = undefined} = bar;
^^^^^^^^^
2 │

undefined is the default value for new variables, parameters, return statements, etc… so specifying it doesn’t make any difference.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Safe fix: Remove the undefined.

1 │ const·{foo·=·undefined}·=·bar;
-----------
function foo() {
return undefined;
}
code-block.js:2:11 lint/nursery/noUselessUndefined  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Don’t use unnecessary undefined.

1 │ function foo() {
> 2 │ return undefined;
^^^^^^^^^
3 │ }
4 │

undefined is the default value for new variables, parameters, return statements, etc… so specifying it doesn’t make any difference.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Safe fix: Remove the undefined.

2 │ ···return·undefined;
---------
function* foo() {
yield undefined;
}
code-block.js:2:9 lint/nursery/noUselessUndefined  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Don’t use unnecessary undefined.

1 │ function* foo() {
> 2 │ yield undefined;
^^^^^^^^^
3 │ }
4 │

undefined is the default value for new variables, parameters, return statements, etc… so specifying it doesn’t make any difference.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Safe fix: Remove the undefined.

2 │ ··yield·undefined;
---------
function foo(bar = undefined) {}
code-block.js:1:20 lint/nursery/noUselessUndefined  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Don’t use unnecessary undefined.

> 1 │ function foo(bar = undefined) {}
^^^^^^^^^
2 │

undefined is the default value for new variables, parameters, return statements, etc… so specifying it doesn’t make any difference.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Safe fix: Remove the undefined.

1 │ function·foo(bar·=·undefined)·{}
-----------
function foo({bar = undefined}) {}
code-block.js:1:21 lint/nursery/noUselessUndefined  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Don’t use unnecessary undefined.

> 1 │ function foo({bar = undefined}) {}
^^^^^^^^^
2 │

undefined is the default value for new variables, parameters, return statements, etc… so specifying it doesn’t make any difference.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

Safe fix: Remove the undefined.

1 │ function·foo({bar·=·undefined})·{}
-----------
let foo;
const {foo} = bar;
function foo() {
return;
}
function* foo() {
yield;
}
function foo(bar) {}
function foo({bar}) {}
foo();