Fixing nrlint findings

I've tried to run nrlint against my flows and got the following output:

> npx nrlint flows.json
╔═════════════════╤══════════╤═══════════════════════════════════════════════════════════════════════╤═══════════════════════════╗
║ Object ID       │ Severity │ Message                                                               │ Rule                      ║
╟─────────────────┼──────────┼───────────────────────────────────────────────────────────────────────┼───────────────────────────╢
║ 7950deec.712db  │ error    │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint           ║
║ 7950deec.712db  │ error    │ Definition for rule 'security/detect-object-injection' was not found. │ function-eslint           ║
║ 7c737c87.dad544 │ error    │ Parsing error: Unexpected token transport                             │ function-eslint           ║
║ e9d868fe.2e65d8 │ warn     │ Unconnected HTTP Response node                                        │ no-unconnected-http-nodes ║
╚═════════════════╧══════════╧═══════════════════════════════════════════════════════════════════════╧═══════════════════════════╝
✖ 4 problems (3 errors, 1 warnings)

No I'm struggeling to find out, how to correct these errors. What is the meaning of the first two messages?

How can I correct the last warning? e9d868fe.2e65d8 is the upper right http node in the next image. I've highlighted the nodes, which could throw errors and send messages to e9d868fe.2e65d8 from the catch: 5 node.

Impossible to help without seeing your function code.

Every http-response node must be connected to a http-in node. The reason is because the msg that is generated in the http-in node (by calling the endpoint) contains the necessary info to correctly respond to the caller.

In this instance, you've got a false positive warning. The lint rule is currently just looking at directly wired nodes - it doesn't know about catch nodes.

In the lint sidebar in the editor you can tell it to ignore that warning for that node.

This message is coming from eslint line 214. It isn't generated when running eslint on the code, although the same rule is triggered there as well.

I haven't integated nrlint into my flows, yet. Is it possible to configure this for the command line tool somehow?

To ignore a rule for a particular node, you can add the following to its description field in the editor:

// nrlint no-unconnected-http-nodes:off

1 Like

@knolleary This works well and suppresses the message.

@Steve-Mcl Any idea, what's behind the other two messages?

No. As I said...

... You haven't shown us what's in the function node that this error is pointing to yet.

Here is a minimal flow triggering this message:

[{"id":"fe99bf67ff84552f","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"7216987ec3d13f16","type":"function","z":"fe99bf67ff84552f","name":"Name","func":"/* eslint-disable security/detect-object-injection */\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":140,"wires":[]},{"id":"7409bcddd1b3500a","type":"inject","z":"fe99bf67ff84552f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":140,"wires":[["7216987ec3d13f16"]]}]

It looks like a configuration issue. How can I add the missing plugin to nrlint?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.