Nary a Package Missing

    eslint-plugin-no-mixed-operators

    1.1.1 • Public • Published

    eslint-plugin-no-mixed-operators

    NPM

    Fixable no-mixed-operators rule for eslint.

    Why

    The plugin originally comes from the need of supporting prettier to work with eslint. But since eslint/eslint#8916 didn't get enough consensus from the team, I figured to create a drop-in replaceable plugin myself.

    Installation

    yarn add -D eslint-plugin-no-mixed-operators

    OR

    npm install --save-dev eslint-plugin-no-mixed-operators

    Usage

    Use it like a regular plugin and disable the original one if it's already enabled.

    // .eslintrc
    {
      "plugins": ["no-mixed-operators"],
      "rules": [
        "no-mixed-operators": "off",
        "no-mixed-operators/no-mixed-operators": "error"
      ]
    }

    Then you can fix the code with --fix via eslint CLI.

    eslint --fix .

    Example

    Considered the following code

    && b + c - d / e || f

    will automatically be fixed to

    (&& b + c - (/ e)) || f

    Options

    All original options are available.

    Running Tests

    yarn test # npm test 

    Running Demo

    cd demo # change to the demo directory 
    yarn # npm install 
    yarn test # npm test 

    See demo/index.js for fixed changes.

    Author

    Kai Hao

    Keywords

    none

    Install

    npm i eslint-plugin-no-mixed-operators

    DownloadsWeekly Downloads

    2,952

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    11.8 kB

    Total Files

    6

    Last publish

    Collaborators

    • kevin940726