Skip to content

Latest commit

 

History

History
194 lines (181 loc) · 3.48 KB

node-param-operation-option-without-action.md

File metadata and controls

194 lines (181 loc) · 3.48 KB

node-param-operation-option-without-action

An option in an Operation node parameter must have an action property. The action property may or may not be identical to the description 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: "Operation",
	name: "operation",
	type: "options",
	noDataExpression: true,
	displayOptions: {
		show: {
			resource: ["entity"],
		},
	},
	default: "getAll",
	options: [
		{
			name: "Create",
			value: "create",
			description: "Create an entity",
		},
		{
			name: "Delete",
			value: "delete",
			description: "Delete an entity",
		},
		{
			name: "Get",
			value: "get",
			description: "Retrieve an entity",
		},
		{
			name: "Get All",
			value: "getAll",
			description: "Retrieve all entities",
		},
		{
			name: "Update",
			value: "update",
			description: "Update an entity",
		},
	],
};

const test = {
	displayName: "Action",
	name: "action",
	type: "options",
	noDataExpression: true,
	displayOptions: {
		show: {
			resource: ["accountContact"],
		},
	},
	default: "getAll",
	options: [
		{
			name: "Create",
			value: "create",
			description: "Create an account contact",
		},
		{
			name: "Delete",
			value: "delete",
			description: "Delete an account contact",
		},
		{
			name: "Get",
			value: "get",
			description: "Retrieve an account contact",
		},
		{
			name: "Get All",
			value: "getAll",
			description: "Retrieve all account contacts",
		},
		{
			name: "Update",
			value: "update",
			description: "Update an account contact",
		},
	],
};

✅ Example of correct code:

const test = {
	displayName: "Operation",
	name: "operation",
	type: "options",
	noDataExpression: true,
	displayOptions: {
		show: {
			resource: ["entity"],
		},
	},
	default: "getAll",
	options: [
		{
			name: "Create",
			value: "create",
			description: "Create an entity",
			action: "Create an entity",
		},
		{
			name: "Delete",
			value: "delete",
			description: "Delete an entity",
			action: "Delete an entity",
		},
		{
			name: "Get",
			value: "get",
			description: "Retrieve an entity",
			action: "Get an entity",
		},
		{
			name: "Get All",
			value: "getAll",
			description: "Retrieve all entities",
			action: "Get all entities",
		},
		{
			name: "Update",
			value: "update",
			description: "Update an entity",
			action: "Update an entity",
		},
	],
};

const test = {
	displayName: "Action",
	name: "action",
	type: "options",
	noDataExpression: true,
	displayOptions: {
		show: {
			resource: ["entity"],
		},
	},
	default: "getAll",
	options: [
		{
			name: "Create",
			value: "create",
			description: "Create an entity",
			action: "Create an entity",
		},
		{
			name: "Delete",
			value: "delete",
			description: "Delete an entity",
			action: "Delete an entity",
		},
		{
			name: "Get",
			value: "get",
			description: "Retrieve an entity",
			action: "Get an entity",
		},
		{
			name: "Get All",
			value: "getAll",
			description: "Retrieve all entities",
			action: "Get all entities",
		},
		{
			name: "Update",
			value: "update",
			description: "Update an entity",
			action: "Update an entity",
		},
	],
};

Links