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

Bug 426723

Summary: [eslint] Provide no-sparse-array rule
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: Michael_Rennie
Version: 5.0   
Target Milestone: 7.0   
Hardware: All   
OS: All   
Whiteboard:

Description Mark Macdonald CLA 2014-01-27 11:00:14 EST
The ECMAScript 5 grammar permits extra commas in cases that were considered syntax errors in ES3:

Object literal:
> var foo = {
>   bar: 0,
>   qux: 1,   // extra comma
> };

Array literal:
> var arr = [1,2,];      // extra comma
> var arr = [1,2,,,,];   // several extra commas (only arrays allow this)

Orion's validator should provide a rule that flags these. The rule should be set to "Ignore" by default (we should assume authors are targeting ES5, not ES3).
Comment 1 Michael Rennie CLA 2014-04-08 17:01:44 EDT
Closing wontfix. I don't think we should be creating rules for old (no longer used) language rules, that are also off by default.

If anyone disagrees, feel free to reopen.
Comment 2 Michael Rennie CLA 2014-10-15 09:45:19 EDT
Reopening to retarget at a specific eslint rule:

http://eslint.org/docs/rules/no-sparse-arrays.html