question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disable no-mixed-operators rule

See original GitHub issue

Please consider adding options in the config to disable (or add) certain linting rules. The default options are very aggressive and I end up with a lot of warnings both in command line output and in browser console. My main nemesis is no-mixed-operators, since I often use the x && y || z construct as an alternative to ternary operator. It is too common to put disable comments every time.

I can comment out the rules in the plugin, but that doesn’t seem to be a good solution since it won’t work well with updates.

On a side note, what are the implications of ejecting? The manual doesn’t make that very clear. I understand that I can’t go back to “managed” state, but what are the benefits of staying in that state?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
matthewdanielcommented, Jul 16, 2018

I compile typescript into the src folder which react-scripts then picks up.

IMO the rules should be setup in such a way as to support generated code.

1reaction
hielfxcommented, Dec 26, 2017

I think you can disable it adding a .eslintrc file in the project root folder and overwritting the create-react-app default rules like this:

{
  "extends": "react-app",
  "rules": {
   "no-mixed-operators": 0 // <- turn the eslint rule off by adding "off" or 0
  }
}

Hope this helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-mixed-operators - ESLint - Pluggable JavaScript Linter
This rule warns when different operators are used consecutively without parentheses in an expression. var foo = a && b || c ||...
Read more >
Mixed operators in JSX - reactjs - Stack Overflow
Disallow mixes of different operators (no-mixed-operators) ... to be notified about mixed operators, then it's safe to disable this rule.
Read more >
eslint-plugin-no-mixed-operators - npm
Fixable no-mixed-operators rule for eslint. ... Use it like a regular plugin and disable the original one if it's already enabled.
Read more >
fix: Remove superfluous no-mixed-operators rule and re-order
no-mixed-operators is already disabled in eslint-config-prettier: ... This also alphabetizes the remaining rules.
Read more >
eslint-config-prettier/README.md - UNPKG
26, - [no-mixed-operators](#no-mixed-operators) ... 191, There a few rules that eslint-config-prettier disables that actually can be.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found