JSHint is throwing a "jQueryPlugin is defined but never used" error on the declaration of jQueryPlugin.
How do I tell JSHint to either ignore this specific error or define jQueryPlugin in a way JSHint understands.
define([
'jquery',
'underscore',
'backbone',
'some-jquery-plugin'
], function ($, _, Backbone, jQueryPlugin) //here is the error
{
'use strict';
var someView = Backbone.View.extend(
{
someFunction: function ()
{
$('#a-css-id').jQueryPlugin();
},
});
return someView;
});
Things I've tried
/* exported jQueryPlugin */
exports statement at top of file dose not work for this (been suggested in other questions)
/* jshint unused:false*/
works, but makes the rule global in the file (2000+ lines of code) so I don't see it as a workable solution.
/* jshint ignore:line */
is apparently not enabled in build system - so I cant commit this change (grunt-contrib-jshint)
The simplest solution would be to just remove jQueryPlugin
from the list of arguments:
define([
'jquery',
'underscore',
'backbone',
'some-jquery-plugin'
], function ($, _, Backbone)
{
Two reasons:
You do not use that value. (You use $(...).jQueryPlugin
, which is different.)
I've loaded many jQuery plugins with RequireJS and never encountered any plugin that returned a useful value as a module. They all install themselves on $
and typically return undefined
as their module value.