malsup / blockui

jQuery BlockUI Plugin
http://jquery.malsup.com/block/
1.69k stars 506 forks source link

Pass JSHint #58

Closed mar10 closed 11 years ago

mar10 commented 11 years ago

It would be cool, if blockui would pass the JSHint (with default options):

http://www.jshint.com/

Currently we get a lot of warnigs like this:

Line 38: if (title) $m.append('<h1>'+ title+'</h1>');
    Expected '{' and instead saw '$m'.
Line 521: if (e.keyCode && e.keyCode == 9) {
    Expected '===' and instead saw '=='.
Line 572: setup(jQuery);
    'jQuery' is not defined.
Line 545: function focus(back) {
    'focus' is defined but never used.
malsup commented 11 years ago

I use jshint (love it). But I don't feel obligated to use its default settings.

mar10 commented 11 years ago

It wasn't my intention to missionate - moved from jslint to jshint myself, because of the flexibility ;-)

I combined your plugin together with other code into a common file, so I have different jshint option assumptions.

What do you think about adding the relaxing options like

;(function() {
/*jshint eqeqeq:false, curly:false */
"use strict";
    function setup($) {
        $.fn._fadeIn = $.fn.fadeIn;

which remedies most of the warnings in my case.

(unused:false doesn't seem to work if defined inside the local scope, but those two warnings might indicate potential for optimization, though I haven't looked into the code):

Line 27: var mode = document.documentMode || 0;
'mode' is defined but never used.
Line 545: function focus(back) {
'focus' is defined but never used.
malsup commented 11 years ago

Ah, yes, that's a good idea to add the relaxation switches to the plugin. Will do.