eslint-plugin-no-mixed-operators
v1.1.1
Published
Fixable no-mixed-operators rule for eslint
Readme
eslint-plugin-no-mixed-operators
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-operatorsOR
npm install --save-dev eslint-plugin-no-mixed-operatorsUsage
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
a && b + c - d / e || fwill automatically be fixed to
(a && b + c - (d / e)) || fOptions
All original options are available.
Running Tests
yarn test # npm testRunning Demo
cd demo # change to the demo directory
yarn # npm install
yarn test # npm testSee demo/index.js for fixed changes.
Author
Kai Hao

