jsHint error in ngTableParams; A constructor name should start with an uppercase letter
If possible stick to coding best practices like the jsHint suggests.
+1. Makes me have to start my grunt server with --force
A quick fix is to include it in an ignor block like;
/* jshint ignore:start */
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: 5 // count per page
}, {
counts: [], // hide page counts control
total: 1 // value less than count hide pagination
});
/* jshint ignore:end */
we have this /* jshint ignore:start */ scattered throughout our js files that use nb-table. +1 for following JSHint best practice. much obliged!
+1, also getting JSHint problems with the parameters being _ rather than camelcase.
line 19 col 0 Identifier 'total_items' is not in camel case.
+1 Please.
+1 @numediaweb: maybe you should use:
/* jshint -W055 */ // XXX: ngTableParams.
$scope.tableParams = new ngTableParams({
page: 1, // show first page
count: 5 // count per page
...
/* jshint +W055 */
http://jslinterrors.com/a-constructor-name-should-start-with-an-uppercase-letter
Hi! any news on that issue? I would really like to get rid off those `/* jshint ignore:start */`` notations :/
Why not just change the name of the variable when it's injected and jshint won't complain: ['ngTableParams', function(NgTableParams) {}]
@gnarf nice suggestion! it works like charm, thanks!
Also, a pretty simple patch to ngTableParams could make it work with or without new...
if (!(this instanceof ngTableParams)) return new ngTableParams(baseParameters, baseSettings);
+1
/*jshint newcap:false*/
at the top of the page gets rid of the errors too.
I don't think that bypassed JsHint is a good solution. JsHint is a set of good manners and this should be respected for best code quality. NgTable is not an exception and it should be consider to rename variables to fit JsHint for maintainability and code clarity.
+1, please make sure the codebase is JSHint compliant
+1 @ctjhoa-linagora is correct.
+1
+1
+1
For me, the best way to get rid of this is to create a simple factory like :
.factory('NgTableParams', function (ngTableParams) {
return ngTableParams;
})
This allow you to directly inject NgTableParams in your controllers without worrying about JSHint useless comments or change the name of the injected variable everywhere you have to inject it.
I am out of the office until 29-08-2014.
Ik ben momenteel niet aanwezig.
Voor dringende zaken kunt u contact opnemen met het secretariaat, 053-574 16 86.
Met vriendelijke groet, Ronald Brinkerink
Note: This is an automated response to your message "Re: [ng-table] jsHint error in ngTableParams; A constructor name should start with an uppercase letter (#203)" sent on 15-8-2014 15:41:44.
This is the only notification you will receive while this person is away.