This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
i++ should be parsed as UpdateExpression/++ rather than UnaryExpression/PlusPlusToken #58
Closed
Description
I ran into this while debugging why this got flagged with eslint:
let i = 0;
function f() {
i++;
}
f();
The error is 'i' is never reassigned. Use 'const' instead
.
The esprima parse for the i++
looks like this:
{
"expression": {
"argument": {
"name": "i",
"type": "Identifier"
},
"operator": "++",
"prefix": false,
"type": "UpdateExpression"
}
whereas the typescript-eslint-parser equivalent is:
"expression": {
"argument": {
"name": "i",
"type": "Identifier"
},
"operator": "PlusPlusToken",
"prefix": false,
"type": "UnaryExpression"
}