| Summary: | Distinguish jslint errors from warnings | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Jay Arthanareeswaran <jarthana> |
| Component: | Client | Assignee: | 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: | |||
This comes from jslint. They should really only be considered warnings. In case you don't understand why jslint complains, see: http://rayfd.wordpress.com/2007/03/18/really-understanding-javascripts-equality-and-identity/ 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. |
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.