I have looked at many stackoverflow answers about getting rid of (necessary) unused parameters errors from jslint by locally wrapping functions as follows:
/*jslint unparam: true*/
//my function with unused parameters
/*jslint unparam: false*/
However when I try to do this I get the following error from JSLint instead:
Unexpected '/*jslint'.
I have tried all manner of white space around it, such as:
/* jslint unparam: true */
/*jslint unparam : true */
/* jslint unparam: true*/
But if such changes have any effect at all, it is that the jslint inline directive is not seen at all, and the unused errors remain instead.
After a bit of toying around, I suspect the issue is JSLint being in some other mode during processing. The function in question is inside of a custom class declaration, similar to the following:
var myClass = CreateClass({
Constructor : function myClass()
{
//initialize
},
Parent : null,
Definition :
{
//member functions that will be copied into prototype,
// be added to custom chaining functionality, etc go here
/*jslint unparam: true*/
doSomething : function doSomething(inUnusedInterfaceParam, inUsedParam)
{
//do something with inUsedParam, but NOT inUnusedInterfaceParam
}
/*jslint unparam: false*/
}
});
And no matter how I move the directive around it doesn't work. For example I have also tried variations of:
doSomething : /*jslint unparam: true*/
function doSomething(inUnusedInterfaceParam, inUsedParam)
{
//do something with inUsedParam, but NOT inUnusedInterfaceParam
}
/*jslint unparam: false*/
This issue is just one of many that is causing me to develop a real love/hate relationship to JSLint. I will probably strip it out of my build at some point in favor of JSHint, but I have not yet wanted to devote the time to do that. In the mean time, is there a way to get jslint to shut up here? And what condition(s) cause jslint to complain about it's own inline directives, as it is currently doing?