Skip to content

Latest commit

 

History

History
81 lines (70 loc) · 1.42 KB

node-param-collection-type-item-required.md

File metadata and controls

81 lines (70 loc) · 1.42 KB

node-param-collection-type-item-required

Items in collection-type node parameter must not have a required property.

📋 This rule is part of the plugin:n8n-nodes-base/nodes config.

🔧 Run ESLint with --fix option to autofix the issue flagged by this rule.

Examples

❌ Example of incorrect code:

const test = {
	displayName: "Options",
	name: "options",
	type: "collection",
	placeholder: "Add Option",
	default: {},
	displayOptions: {
		show: {
			resource: ["collection"],
			operation: ["getAll"],
		},
	},
	options: [
		{
			displayName: "First",
			name: "first",
			type: "boolean",
			required: true,
			default: true,
		},
		{
			displayName: "Second",
			name: "second",
			type: "string",
			default: "",
		},
	],
};

✅ Example of correct code:

const test = {
	displayName: "Options",
	name: "options",
	type: "collection",
	placeholder: "Add Option",
	default: {},
	displayOptions: {
		show: {
			resource: ["collection"],
			operation: ["getAll"],
		},
	},
	options: [
		{
			displayName: "First",
			name: "first",
			type: "boolean",
			default: true,
		},
		{
			displayName: "Second",
			name: "second",
			type: "string",
			default: "",
		},
	],
};

Links