node-red / nrlint

Node-RED Flow Linter
Apache License 2.0
36 stars 15 forks source link

Custom Rule Plugins - works fine with the CLI, but is not enabled for Web Editor? #28

Open andreasmarkussen opened 2 years ago

andreasmarkussen commented 2 years ago

Current Behavior

I was expecting that I could create a custom NRLint rule, and use it both for web and cli. However, the Web Editor does not take the "plugins" key into account.

Expected Behavior

I would expect that custom rules would be possible to load in the Web editor.

Steps To Reproduce

1) Create a plugin containing a rule 2) See that it works with node_modules/nrlint/bin/nrlint.js 3) See that it does not work on the web

Example flow

paste your flow here

Environment

PS. Love the concept of the NRLint.

andreasmarkussen commented 2 years ago

I dont mind giving a go at it, but I have no idea on where to start.

andreasmarkussen commented 2 years ago

And if someone wants to do a PR that can enable custom lint plugins in the UI, then let me know. I would be able to sponsor it financially.

andreasmarkussen commented 2 years ago

I have now been through the NRLint code, and I can see that the loading of custom plugins is not covered by the current code in the nrlint-worker.js file, and I can see perhaps the custom rule needs to be webpacked, in order to get it into the browser?

k-toumura commented 2 years ago

Thank you for using nrlint!

To use the rule module from the browser, currently nrlint uses Webpack. I've made a simple example of a rule plugin. I hope this will help you to create your own rule plugins.