n8n/packages/@n8n/eslint-plugin-community-nodes/docs/rules/require-files-array.md

962 B

Require a non-empty "files" array in package.json (@n8n/community-nodes/require-files-array)

⚠️ This rule warns in the following configs: recommended, ☑️ recommendedWithoutN8nCloudSupport.

Rule Details

The files field in package.json controls which files are included when the package is published to npm. Without it, every file in the package directory gets published — including tests, source files, build artifacts, and config files — bloating the published package and potentially leaking unintended content.

Declaring an explicit, non-empty files array ensures only the intended files (typically dist and any credential assets) are published.

Examples

Incorrect

{
	"name": "n8n-nodes-example",
	"version": "1.0.0"
}
{
	"name": "n8n-nodes-example",
	"files": []
}

Correct

{
	"name": "n8n-nodes-example",
	"files": ["dist"]
}