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

Bug 422873

Summary: [eslint] Cannot validate file due to "Unexpected string" exception
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: JS ToolsAssignee: Mark Macdonald <mamacdon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 5.0   
Target Milestone: 5.0 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2013-11-29 13:14:31 EST
1. Create a .js file containing this code
> /*global define*/
> define([
> 	'orion/plugin'
> 	'stringexternalizer/nonnlsSearchUtil'
> ], function (PluginProvider, NlsSearchUtil) {
> });
2. An exception is thrown by the AST provider (which should not happen), and as a result the file is not validated.
Comment 1 Mark Macdonald CLA 2013-11-29 17:11:33 EST
Smaller case:

foo(['a' 'b']);

^ Note the lack of comma between parameters.

And actually the provider is not throwing. It's just returning a very incomplete AST, and ESLint is throwing when it tries to analyze the scopes with escope. 

I've improved our error handling code when ESLint throws. It now correctly shows you the parse errors and puts another marker up informing you that the validator failed.

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=44c10b7
Comment 2 Mark Macdonald CLA 2013-11-29 19:36:59 EST
(In reply to Mark Macdonald from comment #1)
> I've improved our error handling code when ESLint throws. It now correctly
> shows you the parse errors and puts another marker up informing you that the
> validator failed.

On second thought, maybe the ESLint error should only be shown when (if) there are no parse errors returned by esprima. It is confusing to always display what is basically an internal error. I will change this so it's only shown as a last ditch warning that why we couldn't check your code.
Comment 3 Mark Macdonald CLA 2013-12-05 12:16:57 EST
(In reply to Mark Macdonald from comment #2)

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=cc72298