Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
bin
 
 
lib
 
 
nr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

nrlint

Node-RED Flow Linter

WORK IN PROGRESS. Current code is aimed for investigating architecture of flow linter.

This repository contains following 5 modules.

  • nrlint
    • main module for Node-RED flow linter.
  • plugins/nrlint-plugin-func-style-eslint
    • flow linter plugin to check JavaScript coding style in function node.
  • plugins/nrlint-plugin-no-func-name
    • flow linter plugin to check whether a function node has a name.
  • plugins/nrlint-plugin-http-in-resp
    • flow linter plugin to check whether each http-in node has corresponding http-response, and vice versa.
  • plugins/nrlint-plugin-loop
    • flow linter plugin to check whether a flow contains possible infinite loops.

Usage

From Command-line

  • clone this repository
 % git clone https://github.com/node-red/nrlint.git
  • install nrlint and plugin
 % npm install -g /path/to/nrlint
 % npm install -g /path/to/nrlint-plugin-func-style-eslint
 % npm install -g /path/to/nrlint-plugin-no-func-name
 ...
  • add lint configuration to $HOME/.nrlintrc.js
module.exports = {
  "rules": [
    {
      "name": "no-func-name",
      "mode": "warn",
    },
    {
      "name": "func-style-eslint",
      "parserOptions": {
        "ecmaVersion": 6
      },
      "rules": {
        "semi": 2
      }
    },
  ]
}
  • set module path to environment variable NODE_PATH
 % export NODE_PATH=$(npm root -g)
  • run nrlint command
 % nrlint /path/to/flow.json

From Node-RED Editor

  • clone this repository
 % git clone https://github.com/node-red/nrlint.git
  • install nrlint and plugin
 % cd $HOME/.node-red
 % npm install /path/to/nrlint
 % npm install /path/to/nrlint-plugin-func-style-eslint
 % npm install /path/to/nrlint-plugin-no-func-name
  • add lint configuration to $HOME/settings.js
...
    nrlint: {
      rules: [
        {
          "name": "no-func-name",
          "mode": "warn",
        },
        {
          "name": "func-style-eslint",
          "parserOptions": {
            "ecmaVersion": 6
          },
          "rules": {
            "semi": 2
          }
        }
      ]
    }
...
  • run Node-RED
 % npm start
  • Then, lint tab (marked with a paw) will be appeared.

Limitation

  • Only following rule can use from editor:
    • no-func-name
    • func-style-eslint
    • flowsize

About

Node-RED Flow Linter

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.