Skip to content
Conan edited this page May 5, 2022 · 2 revisions

big-number-rules 🔢 docs

Scroll down for:

Installation

$ pnpm i eslint-plugin-big-number-rules --save-dev

Configuration

After installation, make the plugin available to your eslint:

// .eslintrc
{
  "plugins": ["big-number-rules"]
}

Recommended rules will warn about everything:

// .eslintrc
{
  "plugins": ["big-number-rules"],
  "extends": ["plugin:big-number-rules/recommended"]
}

"Everything" means this:

// .eslintrc
{
  "plugins": ["big-number-rules"],
  "rules": {
    "big-number-rules/arithmetic": "warn",
    "big-number-rules/assignment": "warn",
    "big-number-rules/isNaN": "warn",
    "big-number-rules/math": "warn",
    "big-number-rules/number": "warn",
    "big-number-rules/parseFloat": "warn",
    "big-number-rules/rounding": "warn"
  },
  "settings": {
    "big-number-rules": {
      // Specify the following if you want rules to
      // apply only to files with this declaration:
      //
      //   import ... from 'bignumber.js'
      //
      "importDeclaration": "bignumber.js",

      // Optionally, you can also apply rules only when
      // importing the desired specifier from such
      // declarations:
      //
      //   import BigNumber from 'bignumber.js'
      //
      "importSpecifier": "BigNumber"
    }
  }
}