Nrlint install error

Hi all,

I´m trying to install nrlint to my NR (running on Windows10) according to the documentation (https://github.com/node-red/nrlint).

But when I add the following to my settings.js, I´m unable to start node red.

module.exports = {
	// Add a `nrlint` entry pointing to your nrlint config file
    nrlint: require("./.nrlintrc.js"),
	
    // the tcp port that the Node-RED web server is listening on
    uiPort: process.env.PORT || 1880,
...
H:\>node-red
Error loading settings file: C:\Users\xxx\.node-red\settings.js
C:\Users\xxx\.node-red\.nrlintrc.js:1
��m


SyntaxError: Invalid or unexpected token
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (C:\Users\xxx\.node-red\settings.js:23:13)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

Hi,
Did you create the nrlintrc.js file? with the following command in your node-red directory:

npx nrlint --init > .nrlintrc.js

If you open it what does it look like?

Yes, I did. Here is the content (the file is in the same folder as settings.js):

module.exports = {
    "rules": {
        "align-to-grid": true,
        "max-flow-size": true,
        "no-duplicate-http-in-urls": true,
        "no-loops": true,
        "no-overlapping-nodes": true,
        "no-unconnected-http-nodes": true,
        "no-unnamed-functions": true,
        "no-unnamed-links": true,
        "function-eslint": {
            "config": {
                "env": {
                    "es2021": true
                },
                "parserOptions": {
                    "ecmaVersion": 12
                },
                "rules": {
                    "constructor-super": "error",
                    "for-direction": "error",
                    "getter-return": "error",
                    "no-async-promise-executor": "error",
                    "no-case-declarations": "error",
                    "no-class-assign": "error",
                    "no-compare-neg-zero": "error",
                    "no-cond-assign": "error",
                    "no-const-assign": "error",
                    "no-constant-condition": "error",
                    "no-control-regex": "error",
                    "no-debugger": "error",
                    "no-delete-var": "error",
                    "no-dupe-args": "error",
                    "no-dupe-class-members": "error",
                    "no-dupe-else-if": "error",
                    "no-dupe-keys": "error",
                    "no-duplicate-case": "error",
                    "no-empty": "error",
                    "no-empty-character-class": "error",
                    "no-empty-pattern": "error",
                    "no-ex-assign": "error",
                    "no-extra-boolean-cast": "error",
                    "no-extra-semi": "error",
                    "no-fallthrough": "error",
                    "no-func-assign": "error",
                    "no-global-assign": "error",
                    "no-import-assign": "error",
                    "no-inner-declarations": "error",
                    "no-invalid-regexp": "error",
                    "no-irregular-whitespace": "error",
                    "no-misleading-character-class": "error",
                    "no-mixed-spaces-and-tabs": "error",
                    "no-new-symbol": "error",
                    "no-obj-calls": "error",
                    "no-octal": "error",
                    "no-prototype-builtins": "error",
                    "no-redeclare": "error",
                    "no-regex-spaces": "error",
                    "no-self-assign": "error",
                    "no-setter-return": "error",
                    "no-shadow-restricted-names": "error",
                    "no-sparse-arrays": "error",
                    "no-this-before-super": "error",
                    "no-undef": "error",
                    "no-unexpected-multiline": "error",
                    "no-unreachable": "error",
                    "no-unsafe-finally": "error",
                    "no-unsafe-negation": "error",
                    "no-unused-labels": "error",
                    "no-unused-vars": "error",
                    "no-useless-catch": "error",
                    "no-useless-escape": "error",
                    "no-with": "error",
                    "require-yield": "error",
                    "use-isnan": "error",
                    "valid-typeof": "error"
                }
            }
        }
    }
}

There is no error in the content you posted. Is there something before module.exports in the file?

No.
.nrlintrc - Kopie.txt (6.8 KB)
settings - Kopie.txt (12.2 KB)

As it stands, I don't see anything broken :thinking:

1 Like

When I open .nrlintrc with nano I see

��m^@o^@d^@u^@l^@e^@.^@e^@x^@p^@o^@r^@t^@s^@ ^@=^@ ^@{^@
^@
^@ ^@ ^@ ^@ ^@"^@r^@u^@l^@e^@s^@"^@:^@ ^@{^@
...

So it appears not to be 8 bit encoded, which I suspect is the problem. What tool did you use to create it?

I used windows 10 standard editor to create this file.

EDIT: opened the file with notepad++ and saved as UTF-8 solved the problem! Thanks!

1 Like

Me again!

NR is running now, also the "lint" tab is visible, but there seems to be no function.
Shouldn´t it recognize loops and so on? How can I check if lint works correctly?

Have you checked settings?

Yes. It seems lint is not working, I have some rule violations, but nothing shows up.

Can you check the browser's JavaScript Console for any error messages?

No one? I tried to install nrlint also on a raspberry pi (all is up to date), but it seems to also not work! Same behaviour as on windows machine, lint tab is available but none of the rule violations are reported.

Am I missing some important step?

EDIT: (NR 3.1.3 - NRLINT 1.1.0 - Node18)

I confirm,
The Plugin has been loaded, the sidebar added but it is not triggered.
I don't have any errors in the console.
(NR 3.1.3 - NRLINT 1.1.0 - Node20)

@knolleary Works with v3.1.0 but anymore with the v3.1.1

1 Like

@knolleary would you have a look on this, please?

I am running v3.1.3 and it works for me.

However, I am using Node V18.19.0

Strange, I can no longer create the behavior :thinking:

just to be clear, is there any service that needs to be started besides NR?

No. NRLint is started as a web worker (and by the looks of your console, it is starting!)

Please raise an issue here: Issues · node-red/nrlint · GitHub

Link back to this thread and include as much info as possible.

Ta.

1 Like