eslint-plugin-constant-check

0.0.269 • Public • Published

eslint-plugin-constant-check

Plugin performs check for variable and value match

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-constant-check:

$ npm install eslint-plugin-constant-check --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-constant-check globally.

Usage

Add constant-check to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "constant-check"
    ]
}

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

{
    "rules": {
        "constant-check/rule-name": 2
    }
}

Supported Rules

exact-match

  • performs checks for uppercase variables only including non-object declarations however excluding boolean && number types
  • check for exact matches of all variables dec

check tests/src/rules/exact-match.spec.js for examples

loose-match

  • performs checks for uppercase variables for object like declarations only
  • checks for typos

check tests/src/rules/loose-match.spec.js for examples

suggest-constant

  • show warning if object should be UPPERCASE when most of the property values in an object match by loose-match

TODO

check objects partially, excluding computed keys

Package Sidebar

Install

npm i eslint-plugin-constant-check

Weekly Downloads

1

Version

0.0.269

License

ISC

Last publish

Collaborators

  • ridotcom