Skip to content

emptyFields

Reports empty package.json fields that do not add package metadata.

✅ This rule is included in the package-json logical presets.

This rule reports empty arrays and objects in package.json fields. Empty fields usually add no package metadata, and they can leave readers unsure whether configuration was omitted or left unfinished.

The rule ignores top-level files by default because an empty files array has npm packaging behavior.

{
"main": "./lib/index.js",
"scripts": {}
}
{
"main": "./lib/index.js",
"simple-git-hooks": {
"pre-commit": "pnpm exec nano-staged",
"preserveUnused": []
}
}

Type: string[]

Default: ["files"]

Top-level package properties whose empty array or object values should not be reported.

Use this option for tools that treat an empty package field as meaningful configuration. Configured values replace the default list, so include "files" if your package relies on npm’s handling for an empty files array.

any
packageJson
.
any
rules
({
emptyFields: {
ignoreProperties: string[];
}
emptyFields
: {
ignoreProperties: string[]
ignoreProperties
: ["files", "browserslist"],
},
});

If a package uses a tool that treats an empty top-level package field as meaningful configuration, configure this rule to ignore that property.

Made with ❤️‍🔥 around the world by the Flint team and contributors.