default
must be present in a node parameter, except in node parameters under modes
.
📋 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.
❌ Example of incorrect code:
const test = {
displayName: "Test",
name: "test",
type: "options",
options: [
{
name: "First Option",
value: "firstOption",
},
{
name: "Second Option",
value: "secondOption",
},
],
};
const test = {
displayName: "Test",
name: "test",
type: "options",
};
✅ Example of correct code:
const test = {
displayName: "Test",
name: "test",
type: "options",
default: "firstOption",
options: [
{
name: "First Option",
value: "firstOption",
},
{
name: "Second Option",
value: "secondOption",
},
],
};
const test = {
displayName: "Scope",
name: "scope",
type: "hidden",
default: scopes.join(","),
};
const test = {
displayName: "Scope",
name: "scope",
type: "hidden",
default: scopes,
};
const test = {
displayName: "Auth URI Query Parameters",
name: "authQueryParameters",
type: "hidden",
default: `user_scope=${userScopes.join(" ")}`,
};
const test = {
displayName: "Value",
name: "value",
type: "number",
default: -1,
};
const test = {
displayName: "Board",
name: "boardIdRLC",
type: "resourceLocator",
default: { mode: "list", value: "" },
required: true,
displayOptions: {
show: {
operation: ["get", "delete", "update"],
resource: ["board"],
"@version": [2],
},
},
description: "The ID of the board",
modes: [
{
displayName: "From List",
name: "list",
type: "list",
hint: "Select a board from the list",
placeholder: "Choose...",
initType: "board",
typeOptions: {
searchListMethod: "searchBoards",
searchFilterRequired: true,
searchable: true,
},
},
{
displayName: "ID",
name: "id",
type: "string",
hint: "Enter Board Id",
validation: [
{
type: "regex",
properties: {
regex: "[a-zA-Z0-9]+",
errorMessage: "ID value cannot be empty",
},
},
],
placeholder: "KdEAAdde",
url: "=https://trello.com/b/{{$value}}",
},
{
displayName: "By URL",
name: "url",
type: "string",
hint: "Enter board URL",
placeholder: "https://trello.com/b/e123456/board-name",
validation: [
{
type: "regex",
properties: {
regex: "http(s)?://trello.com/b/([a-zA-Z0-9]+)/[a-zA-Z0-9]+",
errorMessage:
"URL has to be in the format: http(s)://trello.com/b/<board ID>/<board name>",
},
},
],
extractValue: {
type: "regex",
regex: "https://trello.com/b/([a-zA-Z0-9]+)",
},
},
],
};