Socket
Book a DemoInstallSign in
Socket

eslint-plugin-arithmetic

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-arithmetic

ESLint plugin that does calculations using --fix

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

eslint-plugin-arithmetic

Demonstration of eslint-plugin-arithmetic

ESLint rule which calculates out some simple arithmetics.
Useful for when you know what you want to write, but you cannot be bothered to calculate it.

  • Supports +, -, *, /, %, |
  • Supports Math.floor(), Math.ceil(), Math.round()
  • Recommended for use in an editor which autofixes your code when you save the file

Installation

# Shell
npm install -D eslint-plugin-arithmetic
// eslintrc.js
{
    "plugins": ["arithmetic"],
    "rules": {
        "calc": "warn"
    }
}

But what if I don't want to calculate some stuff?

Sometimes it is useful to have things like 3600 * 1000 in your code to make it easier to understand that you mean 1 hour. Maybe you will find the package ms useful.

You can also put // eslint-disable-line arithmetic/calc at the end of a line to not calculate an expression.

If you find this cumbersome, this package might not be for you.

Created by

License

MIT

Keywords

eslint

FAQs

Package last updated on 19 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts