This repository was archived by the owner on Jan 19, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 75
Empty body function cuase errors for several eslint rules #253
Labels
Comments
@JamesHenry Any chance we could get fix in for this in the next release.
|
This was referenced May 11, 2017
This was referenced Jun 13, 2017
👋 @JamesHenry @soda0289, is this issue being worked on? I'm having a related issue that I've described here. |
ddunkin
added a commit
to ddunkin/typescript-eslint-parser
that referenced
this issue
Nov 30, 2017
Fixes crash in indent rule. Related to eslint#253.
ddunkin
added a commit
to ddunkin/typescript-eslint-parser
that referenced
this issue
Nov 30, 2017
Fixes crash in indent rule. Related to eslint#253.
This was finally fixed by #412. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There was a long standing issue with this parser and escope that caused a crash when encountering an empty body function. This is because ESTree defines that all Function/Method Declarations and Function expressions should have a body.
Escope has since been forked as eslint-scope and can now parse empty body function nodes. There are still serveral eslint rules that expect functions to have bodies.
Issues this caused are: #162 #92 #80 #78
These issue have caused the parser to change the node type of the following function nodes:
TSAbstractMethods
TSNamespaceFunctionDeclaration
(We do this even for non empty body functions which causes another problem Namespace exported function return causing later code to be marked unreachable #127)There are other cases where we do not change the node type of empty body functions. These include:
There are two options to fix this. We can change the type of these node or modify the failing eslint rules.
I have proposed the following PRs: #166 #165 #163
All of these change the type of both the function declaration and function expression. Maybe we should just remove the function expression entierly. We can create the following new nodes:
Sorry about the long post but wanted to create a summary of the current situation and allow for easier discussion. If we keep keep the nodes the way they are we might want to change back the TSNamespaceFunction declaration since it is causing another issue.
@JamesHenry thoughts?
The text was updated successfully, but these errors were encountered: