lint: Forbid ++ and -- operators in many positions#5878
Conversation
|
I looked at the failures in the checker, scanner and emitter. All the checker ones can be trivially split into two expressions -- they are all of the form The ones in the scanner all look like this: return pos++, token = SyntaxKind.PercentToken;(there are a lot of the form pos++;
return token = SyntaxKind.PercentToken;But that's based on my understanding of The emitter uses prefix |
There was a problem hiding this comment.
This is not an override and won't be called by the RuleWalker's walk of the tree, right? I don't know what the usual style for lint rules is, but in the past I found it less confusing to give these non-recursive checker methods a different prefix, something like checkIncrementDecrement.
|
👍 |
|
TS shouldn't get in the way of what is completely traditionally valid JS/Java/C code. |
|
This is for our own codebase, not for users. |
|
Whew! Sorry! O_o |
|
This is superceeded by #6212 now. |
Always forbid prefix versions, forbid postfix versions when not used in a for statement, an expression statement, or an element access expression.
@DanielRosenwasser is still on the fence about this rule, since we violate it so many times already and isn't sure if its the right call to add it.