# Nrlint eslint:recommended rules not applied

**URL:** <https://discourse.nodered.org/t/nrlint-eslint-recommended-rules-not-applied/51502>\
**Category:** General\
**Created:** [25 September 2021 08:32 UTC](https://discourse.nodered.org/t/nrlint-eslint-recommended-rules-not-applied/51502 "2021-09-25T08:32:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![a\_grunt](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@a\_grunt](https://discourse.nodered.org/u/a_grunt)\
**Post date:** [25 September 2021 08:32 UTC](https://discourse.nodered.org/t/nrlint-eslint-recommended-rules-not-applied/51502/1 "2021-09-25T08:32:01Z")

</div>

Hi everyone!  
I am trying to check my function nodes code with function-eslint rule in nrlint.  
nrlint version - 1.0.2  
node-red version - 2.0.6  
NodeJS version - 14.17.3

The function-eslint rule configuration is default

```auto
{
    "env": {
        "es2021": true
    },
    "extends": "eslint:recommended",
    "parserOptions": {
        "ecmaVersion": 12
    },
    "rules": {}
}

```

But the default eslint rules from eslint:recommended config are ignored by linter  
For example i write the code which will trigger the ["for-direction" rule](https://eslint.org/docs/rules/for-direction) from eslint.

```auto
for (var i = 0; i < 10; i--) {
}

```

and don't get any warning in the linter panel.  
Manually specifying the rule in the rules section fixes the problem:

```auto
{
    "env": {
        "es2021": true
    },
    "extends": "eslint:recommended",
    "parserOptions": {
        "ecmaVersion": 12
    },
    "rules": {
        "for-direction": "error"
    }
}

```

In this configuration linter works as expected  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/b/fb0dc34d3b63d3643bf5da75dff9d0391d0b28f3.png)

Running nrlint from console gives the same result.

Minimal flow to reproduce the problem:

`[{"id":"d553f0ca4cf61cfb","type":"function","z":"3b054f355f3c4034","name":"","func":"for (var i = 0; i < 10; i--) {}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":280,"wires":[[]]}]`

The problem doesn't depend on the rule(tried multiple rules from eslint:recommended config)

Is it possible to not manually specify the default rules in config? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 September 2021 09:38 UTC](https://discourse.nodered.org/t/nrlint-eslint-recommended-rules-not-applied/51502/2 "2021-09-25T09:38:02Z")

</div>

Please raise an issue on the nrlint repository so it can be looked at.

I agree it would make sense to be able to do this, but I'm not sure if the eslint we bundle to run in the browser knows about the recommended rule sets like 'normal' eslint does.

---

<div class="post-metadata">

**Author:** ![a\_grunt](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@a\_grunt](https://discourse.nodered.org/u/a_grunt)\
**Post date:** [25 September 2021 19:40 UTC](https://discourse.nodered.org/t/nrlint-eslint-recommended-rules-not-applied/51502/3 "2021-09-25T19:40:42Z")

</div>

Thanks for the hint! I've looked into **eslint4b** code, which is used by **function-eslint** rule. Internally it calls **eslint** Linter module, which seems to be expecting "extended rules" to be included in rules object of config by some other code. So current behaviour is not a bug, and to make these rules apply I just need to specify them in the rules section.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 November 2021 19:41 UTC](https://discourse.nodered.org/t/nrlint-eslint-recommended-rules-not-applied/51502/4 "2021-11-24T19:41:20Z")

</div>

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