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

Bug 365216

Summary: JavaScript editor shows an error in code for console keyword
Product: [ECD] Orion Reporter: Anton McConville <antonm>
Component: EditorAssignee: Project Inbox <orion.editor-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, mamacdon
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
screenshot of console.log showing an error none

Description Anton McConville CLA 2011-11-30 11:21:23 EST
Build Identifier: 

The JS Editor shows an error for 'console' as in console.log - this is an accepted JavaScript word.

see attached

Reproducible: Always

Steps to Reproduce:
1. Type console.log in the JS editor
2.
3.
Comment 1 Anton McConville CLA 2011-11-30 11:22:23 EST
Created attachment 207739 [details]
screenshot of console.log showing an error
Comment 2 Anton McConville CLA 2011-11-30 14:28:17 EST
Also for 'alert' - eg: alert( 'hello' );
Comment 3 Felipe Heidrich CLA 2011-11-30 14:36:19 EST
Not a bug, JSLint marks these occurrences as problems.
add at beginning of the file use:
/*global alert console whatever */
Comment 4 Mark Macdonald CLA 2011-11-30 14:51:13 EST
I like this rule JSLint follows, I just don't like having to write the same /*global*/ section everywhere. I thought we discussed letting the user provide a custom set of globals to always validate with (eg. "define require dojo") but I can't find a bug for it.
Comment 5 Anton McConville CLA 2011-11-30 15:26:27 EST
Interesting. 

One thought is that this could be a JavaScript Editor preference - to be able to select the granularity of error that JS Lint finds ( I've just begun to dig into the preference problem-space ).

Another thought is about perception. As a JavaScript developer when I saw that the JavaScript editor didn't recognize alert() or console.log(), it made me question the power behind the editor. The reality is that some of the very power behind it what is identifying those strings as errors!

So it begs the question again - who are we targeting with the Editor? If we're mostly targeting web developers, then what functionality do you think they'd most appreciate in this regard?
Comment 6 Felipe Heidrich CLA 2011-12-01 10:27:14 EST
You just need to pass the correct option to jslint
http://www.jslint.com/lint.html#global
http://www.jslint.com/lint.html#options

maybe you want browser set by default.