1.16.1 • Published 6 months ago

eslint-plugin-n8n-nodes-base v1.16.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

eslint-plugin-n8n-nodes-base

NPM version Tests

ESLint plugin for linting n8n nodes.

Usage

Install this plugin:

pnpm i -D eslint-plugin-n8n-nodes-base

Create an ESLint configuration file and decide how to set up the plugin.

Specify only plugin

If you specify only the plugin, all rules in the plugin are disabled by default and must be individually enabled:

{
  plugins: [ "eslint-plugin-n8n-nodes-base" ],
  rules: {
    "n8n-nodes-base/node-param-array-type-assertion": "warning",
    "n8n-nodes-base/node-param-default-wrong-for-collection": "error"
  }
}

Specify plugin and config

If you specify both the plugin and a config, all config rules are enabled by default and must be individually disabled:

{
  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"
  }
}
ConfigContent
nodesRuleset for n8n nodes
credentialsRuleset for n8n credentials
communityRuleset for package.json in n8n community package

User-defined defaults

In the community ruleset, the five *-still-default rules allow you to define your own default values:

{
  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
    ],
  }
}

Ruleset

Name                                        DescriptionAutofixable
community-package-json-author-email-still-defaultThe 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
community-package-json-author-missingThe author key must be present in the package.json of a community package.No
community-package-json-author-name-missingThe author.name key must be present in the package.json of a community package.No
community-package-json-author-name-still-defaultThe author.name value in the package.json of a community package must be different from the default value '' (empty string) or a user-defined default.No
community-package-json-description-missingThe description key must be present in the package.json of a community package.No
community-package-json-description-still-defaultThe description value in the package.json of a community package must be different from the default value '' (empty string) or a user-defined default.No
community-package-json-keywords-missingThe keywords key must be present in the package.json of a community package.No
community-package-json-keywords-without-official-tagThe keywords value in the package.json of a community package must be an array containing the value 'n8n-community-node-package'.No
community-package-json-license-missingThe description key must be present in the package.json of a community package.No
community-package-json-license-not-defaultThe license key in the package.json of a community package must be the default value MIT.No
community-package-json-n8n-api-version-missingThe n8n.n8nNodesApiVersion key must be present in the package.json of a community package.No
community-package-json-n8n-api-version-not-numberThe n8n.n8nNodesApiVersion value in the package.json of a community package must be a number.No
community-package-json-n8n-missingThe n8n key must be present in the package.json of a community package.No
community-package-json-n8n-nodes-emptyThe n8n.nodes value in the package.json of a community package must contain at least one filepath.No
community-package-json-n8n-nodes-missingThe n8n.nodes key must be present in the package.json of a community package.No
community-package-json-name-missingThe name key must be present in the package.json of a community package.No
community-package-json-name-still-defaultThe name key in the package.json of a community package must be different from the default value n8n-nodes-<...> or a user-defined default.No
community-package-json-repository-url-still-defaultThe repository.url 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
community-package-json-version-missingThe version key must be present in the package.json of a community package.No
cred-class-field-authenticate-type-assertionIn a credential class, the field authenticate must be typed IAuthenticateGenericYes
cred-class-field-display-name-miscaseddisplayName field in credential class must be title cased, except for n8n API and E-goi APIYes
cred-class-field-display-name-missing-apidisplayName field in credential class must be end with API.Yes
cred-class-field-display-name-missing-oauth2displayName field in credential class must mention OAuth2 if the credential is OAuth2.No
cred-class-field-documentation-url-miscaseddocumentationUrl field in credential class must be camel cased. Only applicable to nodes in the main repository.Yes
cred-class-field-documentation-url-missingdocumentationUrl field in credential class must be present.Yes
cred-class-field-documentation-url-not-http-urldocumentationUrl field in credential class must be an HTTP URL. Only applicable to community credentials.No
cred-class-field-name-missing-oauth2name field in credential class must mention OAuth2 if the credential is OAuth2.No
cred-class-field-name-unsuffixedname field in credential class must be suffixed with -Api.Yes
cred-class-field-name-uppercase-first-charFirst char in name in credential class must be lowercase.Yes
cred-class-field-placeholder-url-missing-egplaceholder for a URL in credential class must be prepended with e.g..Yes
cred-class-field-properties-assertionIn a credential class, the field properties must be typed INodeProperties and individual properties must have no assertions.Yes
cred-class-field-type-options-password-missingIn a sensitive string-type field, typeOptions.password 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
cred-class-name-missing-oauth2-suffixCredential class name must mention OAuth2 if the credential is OAuth2.No
cred-class-name-unsuffixedCredential class name must be suffixed with -Api.Yes
cred-filename-against-conventionCredentials filename must match credentials class name, excluding the filename suffix. Example: TestApi.credentials.ts matches TestApi in class TestApi implements ICredentialType.No
node-class-description-credentials-name-unsuffixedname under credentials in node class description must be suffixed with -Api.Yes
node-class-description-display-name-unsuffixed-trigger-nodedisplayName in node class description for trigger node must be suffixed with -Trigger.Yes
node-class-description-empty-stringdescription in node class description must be filled out.No
node-class-description-icon-not-svgicon in node class description should be an SVG icon.No
node-class-description-inputs-wrong-regular-nodeThe number of inputs in node class description for regular node should be one, or two for Merge node.Yes
node-class-description-inputs-wrong-trigger-nodeThe number of inputs in node class description for trigger node should be zero.Yes
node-class-description-missing-subtitlesubtitle in node class description must be present.Yes
node-class-description-name-miscasedname in node class description must be camel cased.Yes
node-class-description-name-unsuffixed-trigger-nodename in node class description for trigger node must be suffixed with -Trigger.Yes
node-class-description-non-core-color-presentcolor 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
node-class-description-outputs-wrongThe number of outputs in node class description for any node must be one, or two for If node, or four for Switch node.Yes
node-dirname-against-conventionNode dirname must match node filename, excluding the filename suffix. Example: Test node dirname matches Test section of Test.node.ts node filename.No
node-execute-block-double-assertion-for-itemsIn the execute() method there is no need to double assert the type of items.length.Yes
node-execute-block-error-missing-item-indexIn the operations in the execute() method in a node, NodeApiError and NodeOperationError must specify itemIndex as the third argument.No
node-execute-block-missing-continue-on-failThe execute() method in a node must implement continueOnFail in a try-catch block.No
node-execute-block-wrong-error-thrownThe execute() method in a node may only throw NodeApiError for failed API requests and NodeOperationError for internal errors, not the built-in Error. Refer to NodeErrors.ts.No
node-filename-against-conventionname 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.No
node-param-array-type-assertionArray of node parameters must be typed, not type-asserted.Yes
node-param-collection-type-item-requiredItems in collection-type node parameter must not have a required property.Yes
node-param-collection-type-unsorted-itemsItems in collection-type node parameter must be alphabetized by name if five or more than five.Yes
node-param-color-type-unusedstring-type color-related node parameter must be color-type.Yes
node-param-default-missingdefault must be present in a node parameter, except in node parameters under modes.Yes
node-param-default-wrong-for-booleandefault for boolean-type node parameter must be a boolean.Yes
node-param-default-wrong-for-collectiondefault for collection-type node parameter must be an object.Yes
node-param-default-wrong-for-fixed-collectiondefault for fixed-collection-type node parameter must be an object.Yes
node-param-default-wrong-for-limitdefault for a Limit node parameter must be 50.Yes
node-param-default-wrong-for-multi-optionsdefault for a multi-options-type node parameter must be an array.Yes
node-param-default-wrong-for-numberdefault for a number-type node parameter must be a number, except for a number-type ID parameter.Yes
node-param-default-wrong-for-optionsdefault for an options-type node parameter must be one of the options.Yes
node-param-default-wrong-for-simplifydefault for a Simplify node parameter must be true.Yes
node-param-default-wrong-for-stringdefault for a string-type node parameter must be a string, unless typeOptions.multipleValues is set to true.Yes
node-param-description-boolean-without-whetherdescription in a boolean node parameter must start with Whether.No
node-param-description-comma-separated-hyphenThe 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-stringdescription 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-perioddescription 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-whitespacedescription 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-namedescription in node parameter must not be identical to displayName.Yes
node-param-description-line-break-html-tagdescription 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-charFirst 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-idID 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-jsonJSON 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-urlURL 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-perioddescription in node parameter must end with a final period if a multiple-sentence description, unless ending with </code>. Applicable by extension to description in option in options-type and multi-options-type node parameter.Yes
node-param-description-missing-for-ignore-ssl-issuesdescription for Ignore SSL node parameter must be present.Yes
node-param-description-missing-for-return-alldescription for Return All node parameter must be present.Yes
node-param-description-missing-for-simplifydescription for Simplify node parameter must be present.Yes
node-param-description-missing-from-dynamic-multi-optionsdescription in dynamic-multi-options-type node parameter must be present.Yes
node-param-description-missing-from-dynamic-optionsdescription in dynamic-options-type node parameter must be present.Yes
node-param-description-missing-from-limitdescription in Limit node parameter must be present.Yes
node-param-description-unencoded-angle-bracketsdescription 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-backticksdescription 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-untrimmeddescription 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-protocoldescription 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-weakdescription 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-optionsdescription in dynamic-multi-options-type node parameter must be Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>Yes
node-param-description-wrong-for-dynamic-optionsdescription in dynamic-options-type node parameter must be Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>Yes
node-param-description-wrong-for-ignore-ssl-issuesdescription for Ignore SSL node parameter must be Whether to connect even if SSL certificate validation is not possibleYes
node-param-description-wrong-for-limitdescription for Limit node parameter must be Max number of results to returnYes
node-param-description-wrong-for-return-alldescription for Return All node parameter must be Whether to return all results or only up to a given limitYes
node-param-description-wrong-for-simplifydescription for Simplify node parameter must be Whether to return a simplified version of the response instead of the raw dataYes
node-param-description-wrong-for-upsertdescription 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-whitespacedisplayName 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-idID 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-miscaseddisplayName 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-positionBy convention, displayName in node parameter must be placed first.Yes
node-param-display-name-untrimmeddisplayName 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-optionsdisplayName for dynamic-multi-options-type node parameter must end with Names or IDsYes
node-param-display-name-wrong-for-dynamic-optionsdisplayName for dynamic-options-type node parameter must end with Name or IDYes
node-param-display-name-wrong-for-simplifydisplayName for Simplify node parameter must be SimplifyYes
node-param-display-name-wrong-for-update-fieldsdisplayName for Update operation node parameter must be Update FieldsYes
node-param-fixed-collection-type-unsorted-itemsItems 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-untrimmedhint in node parameter must be trimmed.Yes
node-param-hint-url-missing-protocolhint in node parameter must include protocol e.g. https:// when containing a URL.Yes
node-param-min-value-wrong-for-limitminValue for Limit node parameter must be a positive integer.Yes
node-param-multi-options-type-unsorted-itemsItems in a multi-options-type node parameter must be alphabetized by name if five or more than five.No
node-param-name-untrimmedname in node parameter or in fixed collection section must be trimmed.Yes
node-param-operation-option-action-miscasedThe property action in an option in an Operation node parameter must be sentence-cased.Yes
node-param-operation-option-action-wrong-for-get-manyThe 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-manyThe property description in a Get Many option in an Operation node parameter must mention many instead of all.Yes
node-param-operation-option-without-actionAn 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-expressionnoDataExpression in an Operation node parameter must be present and enabled.Yes
node-param-option-description-identical-to-namedescription in option in options-type node parameter must not be identical to name.Yes

| node-param-option-name-containing-star

1.16.1

6 months ago

1.16.0

9 months ago

1.14.0

9 months ago

1.15.0

9 months ago

1.13.0

1 year ago

1.12.1

1 year ago

1.12.0

1 year ago

1.9.5

2 years ago

1.9.4

2 years ago

1.11.0

2 years ago

1.11.2

1 year ago

1.11.1

1 year ago

1.10.1

2 years ago

1.10.0

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.9.3

2 years ago

1.9.1

2 years ago

1.9.0

2 years ago

1.7.1

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.4.1

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.3.10

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.2.10

2 years ago

1.0.31

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.5.5

2 years ago

1.5.4

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.0.40

2 years ago

1.0.44

2 years ago

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.45

2 years ago

1.6.5

2 years ago

1.2.9

2 years ago

1.0.29

2 years ago

1.0.30

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago