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

Bug 344486

Summary: Distinguish jslint errors from warnings
Product: [ECD] Orion Reporter: Jay Arthanareeswaran <jarthana>
Component: ClientAssignee: Project Inbox <orion.client-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: mamacdon, simon_kaegi, thatnitind
Version: 0.2   
Target Milestone: 0.3 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Jay Arthanareeswaran CLA 2011-05-02 12:52:05 EDT
I am not sure if Orion can do anything here. Anyway, here it goes. 

In the following code, there are error markers on both conditions. The message expects '!==' and '===' respectively. Note the additional '=' in the expected operators.

function foo(i) {
	if (i != 10) {
		// Do something
	}
	else if (i == 15) {
		// Do something else
	}
}

Steps:
1. Create a new folder, a new JavaScript file, let's say abc.js and enter the code given above.
Comment 1 John Arthorne CLA 2011-05-02 16:19:15 EDT
This comes from jslint. They should really only be considered warnings.
Comment 2 John Arthorne CLA 2011-05-02 16:21:07 EDT
In case you don't understand why jslint complains, see:

http://rayfd.wordpress.com/2007/03/18/really-understanding-javascripts-equality-and-identity/
Comment 3 Mark Macdonald CLA 2011-09-23 13:24:56 EDT
Here are some errors that we should consider displaying as warnings:
- == versus ===
- != versus !==
- One-line if/else statement with no braces
- Unfiltered for..in loop
- Use of 'new' for side effects
- Making functions inside a loop

IMO error markers should be limited to code that will cause parse errors or exceptions at runtime (TypeErrors etc). Warnings are more appropriate for programming mistakes that might lead to unintended behavior.