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

nodelinter

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodelinter

Linter for n8n nodes

  • 0.1.19
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
177
decreased by-28.63%
Maintainers
2
Weekly downloads
 
Created
Source

Nodelinter

Static code analyzer for n8n node files
by Iván Ovejero


Nodelinter is a static code analyzer for n8n node files, with ~70 linting rules for:

  • default values based on param type,
  • casing for display names and descriptions,
  • alphabetization for params and options,
  • required and optional key-value pairs,
  • expected values for specific params,
  • etc.

See full lintings list.

Operation

Run via npx:

npx nodelinter --target=/Users/john/n8n/packages/nodes-base/nodes/Stripe/Stripe.node.ts

Or run locally:

git clone https://github.com/n8n-io/nodelinter
cd nodelinter; npm i
npm run lint -- --target=/Users/john/n8n/packages/nodes-base/nodes/Stripe/Stripe.node.ts

Options

OptionEffect
--targetPath of the file or directory to lint
--configPath of the custom config to use
--printWhether to print output to lintOutput.json
--patternsLintable file patterns
--errors-onlyEnable error logs only
--warnings-onlyEnable warning logs only
--infos-onlyEnable info logs only

Examples:

# lint a single file
--target=./packages/nodes-base/nodes/Stripe/Stripe.node.ts

# lint all files in a dir
--target=./packages/nodes-base/nodes/Stripe

# use a custom config
--config=/Users/john/Documents/myConfig.json

# print logs to lintOutput.json
--print

# lint files ending with these patterns
--target=./src/input/MyNode --patterns:.node.ts,Description.ts

# lint files ending with this pattern
--target=./src/input/MyNode --patterns:.node.ts

# lint only rules with error classification
--target=./src/input/MyNode --errors-only

Custom config

You can override the Nodelinter default config with a custom config.

To do so, create a JSON file containing any keys to overwrite:

{
  "target": "/Users/john/n8n/packages/nodes-base/nodes/Notion/Notion.node.ts",
  "patterns": [".node.ts"],
  "sortMethod": "lineNumber",
  "lintings": {
    "PARAM_DESCRIPTION_MISSING_WHERE_OPTIONAL": {
      "enabled": false
    },
    "NAME_WITH_NO_CAMELCASE": {
      "enabled": false
    }
  }
}

And use the --config option:

npx nodelinter --config=/Users/john/Documents/myConfig.json

For convenience, when running locally, if you place a custom config file named nodelinter.config.json anywhere inside the nodelinter dir, the custom config file will be auto-detected.

Lint exceptions

Add // nodelinter-ignore-next-line LINTING_NAME to except the next line from one or more specific lintings:

// nodelinter-ignore-next-line PARAM_DESCRIPTION_WITH_EXCESS_WHITESPACE
description: 'Time zone used in the response.    The default is the time zone of the calendar.',

// nodelinter-ignore-next-line PARAM_DESCRIPTION_WITH_EXCESS_WHITESPACE PARAM_DESCRIPTION_UNTRIMMED
description: 'Time zone used in the response.    The default is the time zone of the calendar.   ',

Or add // nodelinter-ignore-next-line to except the next line from all lintings:

// nodelinter-ignore-next-line
description: 'Time zone used in the response.    The default is the time zone of the calendar.',

Author

© 2021 Iván Ovejero

License

Distributed under the MIT License.

Keywords

FAQs

Package last updated on 23 Sep 2021

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