-
-
Notifications
You must be signed in to change notification settings - Fork 75
Converting type
to VariableDeclaration
causing issue with core indent rule
#89
Comments
For what it's worth, I would support a length check in the |
That seems like a bug in the parser. Why is |
Reflecting more on this, I do agree. The length check I am suggesting would fix the symptom of the issue, but it would come at the expense of the The I will look into converting the @platinumazure Thanks a lot! Now, based on the thoughts above, do you and @nzakas feel that the runtime error in ESLint is actually a good thing to leave in as it is a signal for when a |
I didn't realize that there was an eventual goal of converting the type On Sep 16, 2016 2:06 PM, "James Henry" [email protected] wrote:
|
I wouldn't say there explicitly was, the goal is just to allow TS PR submitted here #91 |
I don't think the ESLint rule has an error, so I wouldn't touch that. I'm sorry I wasn't clear and didn't look close enough at the PR for using a VariableDeclaration for type declarations. My intention was to completely implement VariableDeclaration as we would any of var, let, or const, not just the top node. |
Background
In 0.3.0 we added the conversion of type declarations, such as:
...to
VariableDeclaration
ESTree nodes. The final ESTree nodes have an emptydeclarations: []
array property.Issue
When using
typescript-eslint-parser
0.3.0 with the core ruleindent
enabled, a runtime TypeError is thrown.This is because the
indent
rule implementation does not check for a positive length of the declarations array before attempting to evaluate its final item.From
indent.js
:Solution
IMHO, this is a bug in the core rule and it should be fixed there via a simple length check, but I wanted to report it here to get @nzakas thoughts before submitting a PR to ESLint.
The text was updated successfully, but these errors were encountered: