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
ImportDeclaration.parent is not expected to be a TSModuleDeclaration #217
Labels
Comments
I have seen this one before. If I remember correctly it doesnt cuase a crash. But it expects that the parent is the Program node, which is true for es6. Not sure if we should update our produced ast nodes or fix the plugin. But in this case it might make sense to use the property body instead of statements. I think class nodes use body property can't remember which nodes, if any, use the statements property. |
it crashed for me: const { parent } = node // parent === { type: 'TSModuleBlock', statements: [...], ... }
const nodePosition = parent.body.indexOf(node) // parent.body === undefined |
Do you want to submit a PR to rename |
flying-sheep
added a commit
to flying-sheep/typescript-eslint-parser
that referenced
this issue
Apr 12, 2017
Done: #218 |
flying-sheep
added a commit
to flying-sheep/typescript-eslint-parser
that referenced
this issue
Apr 12, 2017
flying-sheep
added a commit
to flying-sheep/typescript-eslint-parser
that referenced
this issue
Apr 12, 2017
flying-sheep
added a commit
to flying-sheep/typescript-eslint-parser
that referenced
this issue
Apr 12, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
the rule
import/newline-after-import
accesses aImportDeclaration
’s parent, expecting it to have abody
that’s not true if you encounter a
TSModuleDeclaration
→TSModuleBlock
→ImportDeclaration
:a fix for this specific problem would be a visitor like
TSModuleDeclaration(m) { m.body = m.statements }
The text was updated successfully, but these errors were encountered: