This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 426723 - [eslint] Provide no-sparse-array rule
Summary: [eslint] Provide no-sparse-array rule
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: 5.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 7.0   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-27 11:00 EST by Mark Macdonald CLA
Modified: 2014-10-15 10:44 EDT (History)
1 user (show)

See Also:


Attachments

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