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

Bug 488512

Summary: [quickfix] Make a quick fix to remove unexpected comma (remove warning/error)
Product: [ECD] Orion Reporter: Steve Northover <steve_northover>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: curtis.windatt.public, Michael_Rennie
Version: unspecified   
Target Milestone: 12.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Steve Northover CLA 2016-02-26 00:55:32 EST
1) Type this in a file:
{
	"plugins": {},
	"libs": ["ecma5"],
	"ecmaVersion": 5,
	"dependencyBudget": 20000,
	"loadEagerly": [
		"public/index.html"
	],
}
2) Hover over the (x)
3) FEATURE REQUEST: Make this a quick fix

Discussion:  There is an argument that says that the trailing comma is good.  It allows you to always cut and paste without error.  In older versions of IE, this caused a syntax error, but these versions of IE are gone.

Personally, in all the code I write and when I mentor coops, I encourage the trailing comma.

Thoughts?  Remove the error, if not, please quickfix it.
Comment 1 Curtis Windatt CLA 2016-02-29 09:44:13 EST
*** Bug 488513 has been marked as a duplicate of this bug. ***
Comment 2 Curtis Windatt CLA 2016-02-29 09:52:01 EST
I recommend we remove the rule.  ESLint has removed no-comma-dangle for this reason.  ESLint has however replaced the rule with http://eslint.org/docs/rules/comma-dangle
Which can enforce both directions (no dangling comma, always dangling comma, ignore).  This kind of style rule would be more useful if projects could independently set their severities to enforce consistency across users.
Comment 3 Steve Northover CLA 2016-02-29 12:35:06 EST
If easy to quickfix, let's quickfix.  It should likely be an 'All'.  Can we do this?

We can discuss removing it or supporting it better later.  As I say, I would turn "always-dangle" on for myself but would understand that others would not like this and not force it on them.
Comment 4 Michael Rennie CLA 2016-02-29 17:04:34 EST
It should be easy to extend our quickfixes to the .tern-project file. 

I'll whip something up.
Comment 5 Michael Rennie CLA 2016-03-01 09:38:36 EST
Fixed in:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=3885cfa2fd516015cc05cc67a85629d975aa1699

The fix is 'fix all' enabled (like in JS files), but the JSLint parser does not continue after fatal parse errors (like an extraneous comma). Basically this means you will never see more than one extra comma error at a time, and fixing one extra comma might uncover another one farther down in the file.