[](https://npmjs.org/package/eslint-plugin-n8n-nodes-base)
npm install eslint-plugin-n8n-nodes-base
ESLint plugin for linting n8n nodes.
Install this plugin:
``sh`
pnpm i -D eslint-plugin-n8n-nodes-base
Create an ESLint configuration file>) and decide how to set up the plugin.
If you specify only the plugin, all rules in the plugin are disabled by default and must be individually enabled:
`js`
{
plugins: [ "eslint-plugin-n8n-nodes-base" ],
rules: {
"n8n-nodes-base/node-param-array-type-assertion": "warn",
"n8n-nodes-base/node-param-default-wrong-for-collection": "error"
}
}
If you specify both the plugin and a config, all config rules are enabled by default and must be individually disabled:
`js`
{
plugins: [ "eslint-plugin-n8n-nodes-base" ],
extends: [ "plugin:n8n-nodes-base/nodes" ],
rules: {
"n8n-nodes-base/node-param-array-type-assertion": "off",
"n8n-nodes-base/node-param-default-wrong-for-collection": "off"
}
}
| Config | Content |
| ------------- | --------------------------------------------------- |
| nodes | Ruleset for n8n nodes |credentials
| | Ruleset for n8n credentials |community
| | Ruleset for package.json in n8n community package |
In the community ruleset, the five *-still-default rules allow you to define your own default values:
`js`
{
plugins: [ "eslint-plugin-n8n-nodes-base" ],
extends: [ "plugin:n8n-nodes-base/nodes" ],
rules: {
"n8n-nodes-base/community-package-json-author-name-still-default": [
"error",
{ authorName: "Neil Armstrong" }, // user-defined default
],
}
}
| Name | Description | Autofixable |
| :-- | :-- | :-- |
| community-package-json-author-email-still-default | The author.email value in the package.json of a community package must be different from the default value '' (empty string) or a user-defined default. | No |author
| community-package-json-author-missing | The key must be present in the package.json of a community package. | No |author.name
| community-package-json-author-name-missing | The key must be present in the package.json of a community package. | No |author.name
| community-package-json-author-name-still-default | The value in the package.json of a community package must be different from the default value '' (empty string) or a user-defined default. | No |description
| community-package-json-description-missing | The key must be present in the package.json of a community package. | No |description
| community-package-json-description-still-default | The value in the package.json of a community package must be different from the default value '' (empty string) or a user-defined default. | No |keywords
| community-package-json-keywords-missing | The key must be present in the package.json of a community package. | No |keywords
| community-package-json-keywords-without-official-tag | The value in the package.json of a community package must be an array containing the value 'n8n-community-node-package'. | No |description
| community-package-json-license-missing | The key must be present in the package.json of a community package. | No |license
| community-package-json-license-not-default | The key in the package.json of a community package must be the default value MIT. | No |n8n.n8nNodesApiVersion
| community-package-json-n8n-api-version-missing | The key must be present in the package.json of a community package. | No |n8n.n8nNodesApiVersion
| community-package-json-n8n-api-version-not-number | The value in the package.json of a community package must be a number. | No |n8n
| community-package-json-n8n-missing | The key must be present in the package.json of a community package. | No |n8n.nodes
| community-package-json-n8n-nodes-empty | The value in the package.json of a community package must contain at least one filepath. | No |n8n.nodes
| community-package-json-n8n-nodes-missing | The key must be present in the package.json of a community package. | No |name
| community-package-json-name-missing | The key must be present in the package.json of a community package. | No |name
| community-package-json-name-still-default | The key in the package.json of a community package must be different from the default value n8n-nodes-<...> or a user-defined default. | No |repository.url
| community-package-json-repository-url-still-default | The value in the package.json of a community package must be different from the default value https://github.com/<...>/n8n-nodes-<...>.git or a user-defined default. | No |version
| community-package-json-version-missing | The key must be present in the package.json of a community package. | No |authenticate
| cred-class-field-authenticate-type-assertion | In a credential class, the field must be typed IAuthenticateGeneric | Yes |displayName
| cred-class-field-display-name-miscased | field in credential class must be title cased, except for n8n API and E-goi API | Yes |displayName
| cred-class-field-display-name-missing-api | field in credential class must be end with API. | Yes |displayName
| cred-class-field-display-name-missing-oauth2 | field in credential class must mention OAuth2 if the credential is OAuth2. | No |documentationUrl
| cred-class-field-documentation-url-miscased | field in credential class must be camel cased. Only applicable to nodes in the main repository. | Yes |documentationUrl
| cred-class-field-documentation-url-missing | field in credential class must be present. | Yes |documentationUrl
| cred-class-field-documentation-url-not-http-url | field in credential class must be an HTTP URL. Only applicable to community credentials. | No |name
| cred-class-field-name-missing-oauth2 | field in credential class must mention OAuth2 if the credential is OAuth2. | No |name
| cred-class-field-name-unsuffixed | field in credential class must be suffixed with -Api. | Yes |name
| cred-class-field-name-uppercase-first-char | First char in in credential class must be lowercase. | Yes |placeholder
| cred-class-field-placeholder-url-missing-eg | for a URL in credential class must be prepended with e.g.. | Yes |properties
| cred-class-field-properties-assertion | In a credential class, the field must be typed INodeProperties and individual properties must have no assertions. | Yes |typeOptions.password
| cred-class-field-type-options-password-missing | In a sensitive string-type field, must be set to true to obscure the input. A field name is sensitive if it contains the strings: secret,password,token,key. See exceptions in source. | Yes |OAuth2
| cred-class-name-missing-oauth2-suffix | Credential class name must mention if the credential is OAuth2. | No |-Api
| cred-class-name-unsuffixed | Credential class name must be suffixed with . | Yes |TestApi.credentials.ts
| cred-filename-against-convention | Credentials filename must match credentials class name, excluding the filename suffix. Example: matches TestApi in class TestApi implements ICredentialType. | No |name
| node-class-description-credentials-name-unsuffixed | under credentials in node class description must be suffixed with -Api. | Yes |displayName
| node-class-description-display-name-unsuffixed-trigger-node | in node class description for trigger node must be suffixed with -Trigger. | Yes |description
| node-class-description-empty-string | in node class description must be filled out. | No |icon
| node-class-description-icon-not-svg | in node class description should be an SVG icon. | No |inputs
| node-class-description-inputs-wrong-regular-node | The number of in node class description for regular node should be one, or two for Merge node. | Yes |inputs
| node-class-description-inputs-wrong-trigger-node | The number of in node class description for trigger node should be zero. | Yes |subtitle
| node-class-description-missing-subtitle | in node class description must be present. | Yes |name
| node-class-description-name-miscased | in node class description must be camel cased. | Yes |name
| node-class-description-name-unsuffixed-trigger-node | in node class description for trigger node must be suffixed with -Trigger. | Yes |color
| node-class-description-non-core-color-present | in node class description is deprecated and must not be present, except for nodes whose icon is a Font Awesome icon - usually core nodes. | Yes |outputs
| node-class-description-outputs-wrong | The number of in node class description for any node must be one, or two for If node, or four for Switch node. | Yes |Test
| node-dirname-against-convention | Node dirname must match node filename, excluding the filename suffix. Example: node dirname matches Test section of Test.node.ts node filename. | No |execute()
| node-execute-block-double-assertion-for-items | In the method there is no need to double assert the type of items.length. | Yes |execute()
| node-execute-block-error-missing-item-index | In the operations in the method in a node, NodeApiError and NodeOperationError must specify itemIndex as the third argument. | No |execute()
| node-execute-block-missing-continue-on-fail | The method in a node must implement continueOnFail in a try-catch block. | No |execute()
| node-execute-block-wrong-error-thrown | The method in a node may only throw ApplicationError, NodeApiError, NodeOperationError, or TriggerCloseError. | No |
| node-filename-against-convention | name in node class description must match the node filename without the .node.ts suffix. Example: If description.name is Test, then filename must be Test.node.ts. Version suffix in filename (e.g. -V2) is disregarded. | No |
| node-param-array-type-assertion | Array of node parameters must be typed, not type-asserted. | Yes |
| node-param-collection-type-item-required | Items in collection-type node parameter must not have a required property. | Yes |
| node-param-collection-type-unsorted-items | Items in collection-type node parameter must be alphabetized by name if five or more than five. | No |
| node-param-color-type-unused | string-type color-related node parameter must be color-type. | Yes |
| node-param-default-missing | default must be present in a node parameter, except in node parameters under modes. | Yes |
| node-param-default-wrong-for-boolean | default for boolean-type node parameter must be a boolean. | Yes |
| node-param-default-wrong-for-collection | default for collection-type node parameter must be an object. | Yes |
| node-param-default-wrong-for-fixed-collection | default for fixed-collection-type node parameter must be an object. | Yes |
| node-param-default-wrong-for-limit | default for a Limit node parameter must be 50. | Yes |
| node-param-default-wrong-for-multi-options | default for a multi-options-type node parameter must be an array. | Yes |
| node-param-default-wrong-for-number | default for a number-type node parameter must be a number, except for a number-type ID parameter. | Yes |
| node-param-default-wrong-for-options | default for an options-type node parameter must be one of the options. | Yes |
| node-param-default-wrong-for-simplify | default for a Simplify node parameter must be true. | Yes |
| node-param-default-wrong-for-string | default for a string-type node parameter must be a string, unless typeOptions.multipleValues is set to true. | Yes |
| node-param-description-boolean-without-whether | description in a boolean node parameter must start with Whether. | No |
| node-param-description-comma-separated-hyphen | The string comma-separated in description must be hyphenated. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-empty-string | description in node parameter or in option in options-type and multi-options-type param must be filled out or removed. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-excess-final-period | description in node parameter must end without a final period if a single-sentence description. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-excess-inner-whitespace | description in node parameter must not contain excess inner whitespace. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-identical-to-display-name | description in node parameter must not be identical to displayName. | Yes |
| node-param-description-line-break-html-tag | description in node parameter must not contain an HTML line break. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-lowercase-first-char | First char in description in node parameter must be uppercase. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-miscased-id | ID in description in node parameter must be fully uppercased. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-miscased-json | JSON in description in node parameter must be fully uppercased. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-miscased-url | URL in description in node parameter must be fully uppercased. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-missing-final-period | description in node parameter must end with a final period if a multiple-sentence description, unless ending with . Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-missing-for-ignore-ssl-issues | description for Ignore SSL node parameter must be present. | Yes |
| node-param-description-missing-for-return-all | description for Return All node parameter must be present. | Yes |
| node-param-description-missing-for-simplify | description for Simplify node parameter must be present. | Yes |
| node-param-description-missing-from-dynamic-multi-options | description in dynamic-multi-options-type node parameter must be present. | Yes |
| node-param-description-missing-from-dynamic-options | description in dynamic-options-type node parameter must be present. | Yes |
| node-param-description-missing-from-limit | description in Limit node parameter must be present. | Yes |
| node-param-description-unencoded-angle-brackets | description in node parameter must encode angle brackets for them to render. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-unneeded-backticks | description in node parameter must not use unneeded backticks. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-untrimmed | description in node parameter must be trimmed. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-url-missing-protocol | description in node parameter must include protocol e.g. https:// when containing a URL. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-weak | description in node parameter must be either useful or omitted. Applicable by extension to description in option in options-type and multi-options-type node parameter. | Yes |
| node-param-description-wrong-for-dynamic-multi-options | description in dynamic-multi-options-type node parameter must be Choose from the list, or specify IDs using an expression | Yes |
| node-param-description-wrong-for-dynamic-options | description in dynamic-options-type node parameter must be Choose from the list, or specify an ID using an expression | Yes |
| node-param-description-wrong-for-ignore-ssl-issues | description for Ignore SSL node parameter must be Whether to connect even if SSL certificate validation is not possible | Yes |
| node-param-description-wrong-for-limit | description for Limit node parameter must be Max number of results to return | Yes |
| node-param-description-wrong-for-return-all | description for Return All node parameter must be Whether to return all results or only up to a given limit | Yes |
| node-param-description-wrong-for-simplify | description for Simplify node parameter must be Whether to return a simplified version of the response instead of the raw data | Yes |
| node-param-description-wrong-for-upsert | description for Upsert node parameter must be Create a new record, or update the current one if it already exists (upsert). The resource name e.g. 'contact' is also allowed instead of 'record'. | Yes |
| node-param-display-name-excess-inner-whitespace | displayName in node parameter or in fixed collection section must not contain excess inner whitespace. Applicable by extension to name in options-type or multi-options-type node parameter. | Yes |
| node-param-display-name-miscased-id | ID in displayName in node parameter must be fully uppercased. Applicable by extension to name in options-type or multi-options-type node parameter. | Yes |
| node-param-display-name-miscased | displayName in node parameter or in fixed collection section must title cased. Applicable by extension to name in options-type or multi-options-type node parameter. | Yes |
| node-param-display-name-not-first-position | By convention, displayName in node parameter must be placed first. | Yes |
| node-param-display-name-untrimmed | displayName in node parameter or in fixed collection section must be trimmed. Applicable by extension to name in options-type or multi-options-type node parameter. | Yes |
| node-param-display-name-wrong-for-dynamic-multi-options | displayName for dynamic-multi-options-type node parameter must end with Names or IDs | Yes |
| node-param-display-name-wrong-for-dynamic-options | displayName for dynamic-options-type node parameter must end with Name or ID | Yes |
| node-param-display-name-wrong-for-simplify | displayName for Simplify node parameter must be Simplify | Yes |
| node-param-display-name-wrong-for-update-fields | displayName for Update operation node parameter must be Update Fields | Yes |
| node-param-fixed-collection-type-unsorted-items | Items in a fixed-collection-type node parameter section must be alphabetized by displayName if five or more than five, unless the items are address fields. | Yes |
| node-param-hint-untrimmed | hint in node parameter must be trimmed. | Yes |
| node-param-hint-url-missing-protocol | hint in node parameter must include protocol e.g. https:// when containing a URL. | Yes |
| node-param-min-value-wrong-for-limit | minValue for Limit node parameter must be a positive integer. | Yes |
| node-param-multi-options-type-unsorted-items | Items in a multi-options-type node parameter must be alphabetized by name if five or more than five. | No |
| node-param-name-untrimmed | name in node parameter or in fixed collection section must be trimmed. | Yes |
| node-param-operation-option-action-miscased | The property action in an option in an Operation node parameter must be sentence-cased. | Yes |
| node-param-operation-option-action-wrong-for-get-many | The property action in a Get Many option in an Operation node parameter must start with Get many. | Yes |
| node-param-operation-option-description-wrong-for-get-many | The property description in a Get Many option in an Operation node parameter must mention many instead of all. | Yes |
| 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. | Yes |
| node-param-operation-without-no-data-expression | noDataExpression in an Operation node parameter must be present and enabled. | Yes |
| node-param-option-description-identical-to-name | description in option in options-type node parameter must not be identical to name. | Yes |
| node-param-option-name-containing-star | Option name in options-type node parameter must not contain *. Use [All] instead. | Yes |
| node-param-option-name-duplicate | Option name in options-type node parameter must not be a duplicate. | Yes |
| node-param-option-name-wrong-for-get-many | Option name for Get Many node parameter must be Get Many | Yes |
| node-param-option-name-wrong-for-upsert | Option name for Upsert node parameter must be Create or Update. | Yes |
| node-param-option-value-duplicate | Option value in options-type node parameter must not be a duplicate. | Yes |
| node-param-options-type-unsorted-items | Items in options-type node parameter must be alphabetized by name if five or more than five. | No |
| node-param-placeholder-miscased-id | ID in placeholder in node parameter must be fully uppercased. | Yes |
| node-param-placeholder-missing-email | placeholder for Email node parameter must exist. | Yes |
| node-param-required-false | required: false in node parameter must be removed because it is implied. | Yes |
| node-param-resource-with-plural-option | Option name for a Resource node parameter must be singular. | Yes |
| node-param-resource-without-no-data-expression | noDataExpression in a Resource node parameter must be present and enabled. | Yes |
| node-param-type-options-max-value-present | maxValue in typeOptions in Limit node parameter is deprecated and must not be present. | Yes |
| node-param-type-options-missing-from-limit | typeOptions in Limit node parameter must be present. | Yes |
| node-param-type-options-password-missing | In a sensitive string-type parameter, typeOptions.password must be set to true to obscure the input. A node parameter name is sensitive if it contains the strings: secret,password,token,apiKey. See exceptions in source. | Yes |
| node-resource-description-filename-against-convention | Resource description file must use singular form. Example: UserDescription.ts, not UsersDescription.ts. | No |
1. Make a PR updating version in package.json to the new version following semver. Merge it.
2. Make a tag for the new version:
``sh``
git tag v1.16.2
git push origin v1.16.2
3. Create a release using the tag.
4. Check that the npm publish action succeeds.
© 2024 Iván Ovejero