Skip to content

usePackageJsonEngines (JSON)

Language JSON (and super languages)
biome.json
{
"linter": {
"rules": {
"nursery": {
"usePackageJsonEngines": "error"
}
}
}
}

Require the engines field in package.json.

The engines field lists the versions of Node.js and other tools that a package works with. Package managers such as npm read this field and warn when someone installs the package with a version outside that range. Without the field, nobody gets that warning, and the package can fail in ways that are hard to connect to an unsupported version.

The rule only checks that the field exists at the top level of the file. It does not check what the field contains. It applies to every package.json file, including packages that set "private": true.

package.json
{
"name": "my-package",
"version": "1.0.0"
}
/package.json:1:1 lint/nursery/usePackageJsonEngines ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

⚠ This package.json file is missing the engines field.

> 1 │ {
│ ^
2 │ "name": "my-package",
3 │ "version": "1.0.0"

ℹ The engines field tells package managers which versions of Node.js and other tools the package works with. Without it, the package can be installed with an unsupported version and no warning is shown.

ℹ Add an engines field that lists the supported versions, for example "engines": { "node": ">=20" }.

ℹ 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.

package.json
{
"name": "my-package",
"version": "1.0.0",
"engines": {
"node": ">=20"
}
}