One of the side projects that has been ticking over in the background for quite a long time now is a linter tool for Node-RED flows.
Our friends at Hitachi have made a great start on it and I'm currently in the process of pulling it together to hopefully release alongside 2.0.
It will be an optional install (just like the Flow Debugger will be).
It will run either as a command-line tool on flow json files, or in the editor reporting back in realtime as you edit your flows.
One of the pieces missing at the moment is a really good collection of linting rules that can be used to check flows.
It has been designed to be pluggable, so that anyone can publish their own rules to npm and plug them into the tool. But we do want to make sure the core set is a solid starting point.
Now, I really want to stress the idea here is not to come up with a set of fixed rules that everyone must obey. Each rule has to be enabled before it is active. We will have a default configuration that applies a standard set, but users will be able to tune it to their own taste.
At the moment, we have the following rules:
avoid-loops- detects and warns if it detects a wiring loop
flow-size- allows you to specify a maximum number of nodes that should appear on any one flow.
http-in-response- warns if it detects any
http innodes that do not eventually reach an
http responsenode. (And vice versa)
named-functions- warns if any function nodes have not had a name set
eslintagainst all of the function nodes
So my request to the wider NR community is for your ideas for any rules we could include in the core set.
The type of thing we're look for are:
- rules that will help detect a bug in a flow
- rules that will help ensure best practices are followed
- rules that will help improve the overall quality of the flows.