Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add strictness level for plusplus #2744

Open
ttsirkia opened this issue Nov 3, 2015 · 2 comments
Open

Add strictness level for plusplus #2744

ttsirkia opened this issue Nov 3, 2015 · 2 comments
Labels

Comments

@ttsirkia
Copy link

ttsirkia commented Nov 3, 2015

It would be nice to have an option for plusplus which allows use cases such as

for (var i = 0; i < myArray.length; i++)

or

myVar++;

But it should complain about this:

myVar = myOtherVar + mySecondVar++;

So I suggest that there are three modes: false, strict/true or simple that allows usage when not in complex expressions.

Especially that looping case is so common that there should be option to allow it although it would be elsewhere forbidden.

@jugglinmike
Copy link
Member

I think there's a case to be made for the safety of increment/decrement operators when used as statements. @rwaldron What do you think?

As for the actual implementation, given that plusplus: true enables the restriction, I think the most logical configuration value (that also maintains backwards compatibility) would be plusplus: expr.

@ttsirkia
Copy link
Author

ttsirkia commented Nov 4, 2015

I'm fine with any option names. My original suggestion was that true means the original and the most restricted mode and the new option (such as expr or simple) allows usage in certain places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants