Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365216 - JavaScript editor shows an error in code for console keyword
Summary: JavaScript editor shows an error in code for console keyword
Status: CLOSED WONTFIX
Alias: None
Product: Orion
Classification: ECD
Component: Editor (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-30 11:21 EST by Anton McConville CLA
Modified: 2011-12-01 10:27 EST (History)
2 users (show)

See Also:


Attachments
screenshot of console.log showing an error (5.38 KB, image/png)
2011-11-30 11:22 EST, Anton McConville CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.