Eclipse JavaScript Code Formatting and JSHint Anonymous Feature Conflict

I am using Eclipse JavaScript code formatting (Indigo version) and using the jshint-eclipse plugin with white: true to check if the code matches.

Eclipse code formatting and the JSHint plugin conflict with the declaration format of an anonymous function. Formatting JavaScript code formats anonymous functions as follows:

var f1 = function() { }; 

But the jshint-eclipse plugin gives the warning "Missing spaces after function". The correct format for this plugin is:

 var f1 = function () { }; 

NOTE SPACE AFTER function

Is there a way to format anonymous function declarations differently with eclipse than regular function declarations. I would like to add one place after the β€œfunction” for anonymous functions, but not for ordinary functions.

Thanks.

Update eclipse relevant bug here

+4
source share
2 answers

There is an error for this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=315507

A similar error in Aptana has been fixed: http://jira.appcelerator.org/browse/APSTUD-3792

I developed a patch for this: https://github.com/eclipse/webtools.jsdt.core/pull/1 which I hope will be merged and released soon.

0
source

Check the JavaScript formatting settings (Preference-> JavaScript-> Code Style-> Formatter) on the White Space tab for function declarations.

-2
source

Source: https://habr.com/ru/post/1399897/


All Articles