3.0.0 • Published 7 months ago

eslint-plugin-nommon v3.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 months ago

npm version

eslint-plugin-nommon

ESLint plugin for nommon

Installation

$ npm install eslint-plugin-nommon --save-dev

Usage

Add eslint-plugin-nommon to the plugins section of your .eslintrc configuration file:

{
    "plugins": [
        "eslint-plugin-nommon"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "nommon/no-dynamic-jpath": "error"
    }
}

Rule "nommon/no-dynamic-jpath"

autofixable

nommon/no-dynamic-jpath disallow JS variables in no.jpath().

Motivation: no.jpath(<jpath>) compiles given jpath to native JS function and stores it in cache. Dynamic jpath may increase memory usage and decrease application performance due to jpath compilation. You should use only static strings in jpath.

Bad examples:

no.jpath('.foo.' + bar, data);

no.jpath(`.foo.${ bar }`, data);

no.jpath(`.foo{ .bar === "${ baz }"`, data);

Good examples:

no.jpath('.foo' + '.bar', data);

no.jpath('.foo[bar]', data, { bar });

no.jpath('.foo{ .bar === baz}', data, { baz });
3.0.0

7 months ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

5 years ago

1.0.2

6 years ago

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago