TypeScript: Range data missing from FunctionExpression
JamesHenry opened this issue ยท 5 comments
Hey @andy-ms!
I have begun using our prettier
tests as a way of finalising the AST alignment work between typescript-eslint-parser
and babylon-typescript-plugin
. The overarching issue is here: prettier/prettier#2334
I have only just begun digging into it, but the first issue I noticed was that for the below code, babylon is currently not including a range: []
property on the FunctionExpression
within the first then()
(presumably the others as well I did not double check ๐ ). This is causing prettier to throw because it is expecting the range array to exist.
Input Code
someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
return someObject.someFunction().then(function() {
anotherFunction();
});
});
});
});
});
});
});
});
});
});
});
});
});
});
Babylon/Babel Configuration
{
sourceType: "module",
allowImportExportEverywhere: true,
allowReturnOutsideFunction: true,
plugins: [
"jsx",
"typescript",
"doExpressions",
"objectRestSpread",
"decorators",
"classProperties",
"exportExtensions",
"asyncGenerators",
"functionBind",
"functionSent",
"dynamicImport",
"numericSeparator"
]
};
Your Environment
software | version |
---|---|
Babylon | 7.0.0-beta.16 |
node | 7 |
npm | 4 |
Operating System | macOS 10.12.5 |
Hey @JamesHenry! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.
All hail robot @hzoo ๐ค ๐
Looks like inclusion of the range
property is behind a flag, could you try adding it to your configuration?
Can't believe I missed that ๐ thanks, @andy-ms! I'll keep you posted on the other points I find.