Skip to content

The less code, the fewer bugs. β€” Kevlin Henney

Enforce the unary operators ++ and -- (no-no-plusplus) ​

πŸ’Ό This rule is enabled in the following configs: 🌐 all, βœ… recommended.

πŸ”§ This rule is automatically fixable by the --fix CLI option.

πŸ“– Rule details ​

Use ++ instead of += 1, and -- instead of -= 1.

The initial plan was to replace += 4 by ++++++++, and so on. But it turns out consecutive ++ don't work πŸ™„

πŸ”— See also ​

πŸ”§ Config ​

js
{ rules: { 'ninja/no-no-plusplus': 2 } }

πŸ”— See also ​

πŸ§‘β€πŸ’» Demo ​

Released under the MIT License