Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-n8n-nodes-base

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-n8n-nodes-base

[![NPM version](https://img.shields.io/npm/v/eslint-plugin-n8n-nodes-base.svg?style=flat)](https://npmjs.org/package/eslint-plugin-n8n-nodes-base) [![Tests](https://github.com/ivov/eslint-plugin-n8n-nodes-base/actions/workflows/checks.yml/badge.svg)](http

  • 1.0.24
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
decreased by-10.87%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-n8n-nodes-base

NPM version Tests

ESLint plugin for linting n8n nodes.

Usage

  1. Install this plugin:
npm i -D eslint-plugin-n8n-nodes-base
  1. Choose a plugin config:
  • recommended (all rules)
  • autofixable-safe (not causing breaking changes)
  • autofixable-unsafe (causing breaking changes)
  • non-autofixable (to manually fix)
  1. Create the ESLint configuration file.

The following example...

  • provides the n8n-nodes-base plugin,
  • enables the rules tagged recommended, and
  • disables a specific rule from the enabled set.
{
  plugins: [ "eslint-plugin-n8n-nodes-base" ],
  extends: [ "plugin:n8n-nodes-base/recommended" ],
  rules: {
    "n8n-nodes-base/node-param-type-options-missing-from-limit": "off"
  }
}

Optionally, omit extends and enable rules individually:

{
  plugins: [ "eslint-plugin-n8n-nodes-base" ],
  rules: {
    "n8n-nodes-base/node-param-type-options-missing-from-limit": "error"
    "n8n-nodes-base/node-param-resource-without-no-data-expression": "error"
    "n8n-nodes-base/node-param-resource-with-plural-option": "error"
  }
}

Ruleset

Name                                        DescriptionAutofixable
cred-class-field-display-name-miscaseddisplayName field in credential class must be title cased.Yes, safe
cred-class-field-display-name-missing-apidisplayName field in credential class must be end with API.Yes, safe
cred-class-field-display-name-missing-oauth2displayName field in credential class must mention OAuth2 if applicable.No
cred-class-field-documentation-url-miscaseddocumentationUrl field in credential class must be camel cased.Yes, safe
cred-class-field-documentation-url-missingdocumentationUrl field in credential class must be present.Yes, safe
cred-class-field-name-missing-oauth2name field in credential class must mention OAuth2 if applicable.No
cred-class-field-name-unsuffixedname field in credential class must be suffixed with -Api.Yes, unsafe
cred-class-field-name-uppercase-first-charFirst char in name in credential class must be lowercase.Yes, unsafe
cred-class-field-placeholder-url-missing-egplaceholder for a URL in credential class must be prepended with e.g..Yes, safe
cred-class-field-properties-assertionIn a credential class, the field properties must be typed 'INodeProperties' and individual properties must have no assertions.Yes, safe
cred-class-name-missing-oauth2-suffixCredential class name must mention OAuth2 if applicable.No
cred-class-name-unsuffixedCredential class name must be suffixed with -Api.Yes, unsafe
filesystem-wrong-cred-filenameCredentials filename must match credentials class name, excluding the filename suffix. Example: TestApi.credentials.ts matches TestApi in class TestApi implements ICredentialType.No
filesystem-wrong-node-dirnameNode dirname must match node filename, excluding the filename suffix. Example: Test node dirname matches Test.node.ts node filename.No
filesystem-wrong-node-filenameNode filename must match name in node class description, excluding the filename suffix. Example: Test.node.ts matches Test in Test.description.name.No
filesystem-wrong-resource-description-filenameResource description file must use singular form. Example: UserDescription.ts, not UsersDescription.ts.No
node-class-description-credentials-name-unsuffixedname under credentials in node class description must be suffixed with -Api.Yes, unsafe
node-class-description-display-name-unsuffixed-trigger-nodedisplayName in node class description for trigger node must be suffixed with -Trigger.Yes, unsafe
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, safe
node-class-description-inputs-wrong-trigger-nodeThe number of inputs in node class description for trigger node should be zero.Yes, safe
node-class-description-missing-subtitlesubtitle in node class description must be present.Yes, safe
node-class-description-name-unsuffixed-trigger-nodename in node class description for trigger node must be suffixed with -Trigger.Yes, unsafe
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, safe
node-execute-block-double-assertion-for-itemsIn the execute() method there is no need to double assert the type of items.length.Yes, safe
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 network requests and NodeOperationError for internal errors, not the built-in Error.No
node-param-array-type-assertionArray of node parameters must be typed, not type-asserted.Yes, unsafe
node-param-collection-type-unsorted-itemsItems in collection-type node parameter must be alphabetized by name if more than five.Yes, safe
node-param-color-type-unusedcolor-type must be used for color-related node parameter.Yes, unsafe
node-param-default-missingdefault must be present in a node parameter.Yes, safe
node-param-default-wrong-for-booleandefault for boolean-type node parameter must be a boolean.Yes, safe
node-param-default-wrong-for-collectiondefault for collection-type node parameter must be an object.Yes, safe
node-param-default-wrong-for-fixed-collectiondefault for fixed-collection-type node parameter must be an object.Yes, safe
node-param-default-wrong-for-limitdefault for a Limit node parameter must be 50.Yes, safe
node-param-default-wrong-for-multi-optionsdefault for a multi-options-type node parameter must be an array.Yes, safe
node-param-default-wrong-for-numberdefault for a number-type node parameter must be a number.Yes, safe
node-param-default-wrong-for-optionsdefault for an options-type node parameter must be one of the options.Yes, safe
node-param-default-wrong-for-simplifydefault for a Simplify node parameter must be true.Yes, safe
node-param-default-wrong-for-stringdefault for a string-type node parameter must be a string.Yes, safe
node-param-description-boolean-without-whetherdescription in a boolean node parameter must start with Whether.No
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, safe
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, safe
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, safe
node-param-description-identical-to-display-namedescription in node parameter must not be identical to displayName.No
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, safe
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, safe
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, safe
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, safe
node-param-description-missing-for-ignore-ssl-issuesdescription for Ignore SSL node parameter must be present.Yes, safe
node-param-description-missing-for-return-alldescription for Return All node parameter must be present.Yes, safe
node-param-description-missing-for-simplifydescription for Simplify node parameter must be present.Yes, safe
node-param-description-missing-from-dynamic-multi-optionsdescription in dynamic-multi-options-type node parameter must be present.Yes, safe
node-param-description-missing-from-dynamic-optionsdescription in dynamic-options-type node parameter must be present.Yes, safe
node-param-description-missing-from-limitdescription in Limit node parameter must be present.Yes, safe
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, safe
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, safe
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, safe
node-param-description-url-missing-protocoldescription in node parameter must include protocol when containing a URL. Applicable by extension to description in option in options-type and multi-options-type node parameter.Yes, safe
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, safe
node-param-description-wrong-for-dynamic-multi-optionsdescription in dynamic-multi-options-type node parameter must be Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>Yes, safe
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/nodes/expressions.html#expressions">expression</a>Yes, safe
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, safe
node-param-description-wrong-for-limitdescription for Limit node parameter must be Max number of results to returnYes, safe
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, safe
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, safe
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)Yes, safe
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, safe
node-param-display-name-lowercase-first-charFirst char in displayName in node parameter or in fixed collection section must be uppercase. Applicable by extension to name in options-type or multi-options-type node parameter.Yes, safe
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, safe
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, safe
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, safe
node-param-display-name-wrong-for-dynamic-multi-optionsdisplayName for dynamic-multi-options-type node parameter must end with Name or IDNo
node-param-display-name-wrong-for-dynamic-optionsdisplayName for dynamic-options-type node parameter must end with Name or IDNo
node-param-display-name-wrong-for-simplifydisplayName for Simplify node parameter must be SimplifyYes, safe
node-param-display-name-wrong-for-update-fieldsdisplayName for Update operation node parameter must be Update FieldsYes, safe
node-param-fixed-collection-type-unsorted-itemsItems in a fixed-collection-type node parameter must be alphabetized by displayName if more than five.Yes, safe
node-param-min-value-wrong-for-limitminValue for Limit node parameter must be a positive integer.Yes, safe
node-param-multi-options-type-unsorted-itemsItems in a multi-options-type node parameter must be alphabetized by name if more than five.Yes, safe
node-param-operation-without-no-data-expressionnoDataExpression in an Operation node parameter must be present and enabled.Yes, safe
node-param-option-description-identical-to-namedescription in option in options-type node parameter must not be identical to name.No
node-param-option-name-containing-starOption name in options-type node parameter must not contain *. Use [All] instead.Yes, safe
node-param-option-name-duplicateOption name in options-type node parameter must not be a duplicate.Yes, safe
node-param-option-name-wrong-for-get-allOption name for Get All node parameter must be Get AllYes, safe
node-param-option-name-wrong-for-upsertOption name for Upsert node parameter must be Upsert.Yes, safe
node-param-option-value-duplicateOption value in options-type node parameter must not be a duplicate.Yes, safe
node-param-options-type-unsorted-itemsItems in options-type node parameter must be alphabetized by name if more than five.Yes, safe
node-param-required-falserequired: false in node parameter must be removed because it is implied.Yes, safe
node-param-resource-with-plural-optionOption name for a Resource node parameter must be singular.Yes, safe
node-param-resource-without-no-data-expressionnoDataExpression in a Resource node parameter must be present and enabled.Yes, safe
node-param-type-options-missing-from-limittypeOptions in Limit node parameter must be present.Yes, safe

Author

© 2022 Iván Ovejero

License

Distributed under the MIT License.

Keywords

FAQs

Package last updated on 17 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc