node-red / nrlint

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

nrlint: require("./.nrlintrc.js") makes settings.js fail #27

Closed Stwissel closed 2 years ago

Stwissel commented 2 years ago

Current Behavior

Followed the instructions:

npm install nrlint --save
npx nrlint --init > .nrlintrc.js

added into module.exports of settings.js:

 nrlint: require("./.nrlintrc.js"),

node-red fails with error "Can't read settings.js"

Expected Behavior

Proper startup or update of instructions

Interim remedy found: copy content of .nrlintrc.js into settings.js:

nrlint: {
    "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,
        },
        extends: "eslint:recommended",
        parserOptions: {
          ecmaVersion: 12,
        },
        rules: {},
      },
    },
  },

Steps To Reproduce

like "current behavior"

Example flow

n/a

Environment

knolleary commented 2 years ago

I'm not able to reproduce this. The generated nrlintrc file can be required without problem in my settings file.

What do you get if you run node settings.js in your .node-red directory?

Stwissel commented 2 years ago

agghhh my bad.

I had .nrlintrc.js in the project root. Once moved to .node-red it worked as designed. suggest to mention in the readme.md npx nrlint --init > .node-red/.nrlintrc.js, since most rc style files tend to live in the root.

Love your work