[//]: # "File generated from a template. Do not edit this file directly." # node-param-default-wrong-for-options `default` for an options-type node parameter must be one of the options. 📋 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: ```js const test = { displayName: "Test", name: "test", type: "options", options: [ { name: "Minus One", value: -1, }, { name: "Zero", value: 0, }, { name: "One", value: 1, }, ], default: "", }; const test = { displayName: "Test", name: "test", type: "options", default: "wrong", options: [ { name: "First", value: "first", }, { name: "Second", value: "second", }, ], }; const test = { displayName: "Test", name: "test", type: "options", default: "wrong", }; ``` ✅ Example of **correct** code: ```js const test = { displayName: "Test", name: "test", type: "options", default: "first", options: [ { name: "First", value: "first", }, { name: "Second", value: "second", }, ], }; const allCurrencies = []; const test = { displayName: "Currency", name: "currency", type: "options", default: "eur", options: allCurrencies, }; const MY_CONSTANT = { a: 1, b: 2 }; const test = { displayName: "User", name: "currency", type: "options", default: "eur", options: [ { name: "a", value: MY_CONSTANT.a, }, { name: "a", value: MY_CONSTANT.b, }, ], }; const test = { displayName: "Test", name: "test", type: "options", default: "any_value", typeOptions: { loadOptionsMethod: "getFields", }, }; const test = { displayName: "Model", name: "model", type: "options", default: "gpt-3.5-turbo-1106", typeOptions: { loadOptions: { routing: { request: { method: "GET", url: "=/v1/models", }, }, }, }, }; const myVariable = "first"; const test = { displayName: "Test", name: "test", type: "options", default: myVariable, options: [ { name: "First", value: "first", }, { name: "Second", value: "second", }, ], }; const test = { displayName: "Test", name: "test", type: "options", default: myObject.getValue(), typeOptions: { loadOptionsMethod: "getFields", }, }; const currencies = [ { name: "USD", value: "USD" }, { name: "EUR", value: "EUR" }, ]; const test = { displayName: "Currency", name: "currency", type: "options", default: "USD", options: currencies.sort((a, b) => a.name.localeCompare(b.name)), }; const config = { currencyOptions: [ { name: "USD", value: "USD" }, { name: "EUR", value: "EUR" }, ], }; const test = { displayName: "Currency", name: "currency", type: "options", default: "EUR", options: config.currencyOptions, }; const lastNodeResponseMode = { name: "Last Node", value: "lastNode" }; const respondToWebhookResponseMode = { name: "Respond to Webhook", value: "respondToWebhook", }; const test = { displayName: "Response Mode", name: "responseMode", type: "options", options: [lastNodeResponseMode, respondToWebhookResponseMode], default: "lastNode", description: "When and how to respond to the webhook", }; ``` ## Links - [Rule source](../../lib/rules/node-param-default-wrong-for-options.ts) - [Test source](../../tests/node-param-default-wrong-for-options.test.ts)