Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 490642

Summary: [acorn] Provide a default sourceType of script with a quick fix to change it
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: Olivier_Thomann
Version: 12.0   
Target Milestone: 12.0   
Hardware: All   
OS: All   
Whiteboard:

Description Michael Rennie CLA 2016-03-29 17:55:22 EDT
For the maximum compatibility (using import / export or not in es6 land) we should set the default sourceType parser option to be 'module'.

We should probably also set the hashBang option to true.
Comment 1 Michael Rennie CLA 2016-03-29 17:57:05 EDT
The other option is call 'allowHashBang' not 'hashBang'
Comment 2 Michael Rennie CLA 2016-03-30 10:27:19 EDT
After discussion with Olivier, we decided that that default source type should be 'script' and when we encounter the parse errors for import / export we offer a quick fix to update / add a section to a .tern-project file that sets the source type to 'module'. 

That way we have maximum compatibility with all scripts that do not have import / export statements in them.
Comment 3 Michael Rennie CLA 2016-05-04 10:28:10 EDT
Bumping this to P2, there currently is no way for an end user to configure the sourceType to properly support es6 modules.
Comment 4 Michael Rennie CLA 2016-05-04 16:47:20 EDT
Olivier, I pushed your patch to forward 'sourceType' through the .tern-project file:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=9921669919b1b932066111c73aa3cd88ac276acb
Comment 5 Olivier Thomann CLA 2016-05-05 10:39:51 EDT
See bug 493082 for the case with import statements. To check it, please use export statement for now.
Comment 6 Olivier Thomann CLA 2016-05-05 19:23:15 EDT
Delivered.