Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery-Lint is attempting to (re)validate the jQuery object? #23

Open
erikstainsby opened this issue May 16, 2011 · 1 comment
Open

Comments

@erikstainsby
Copy link

It seems a complete waste of cycles for Lint to be scanning and judging jQuery itself. In the first place, it will be endlessly exhausting for you to try to keep up to date with the modifications in each new jQuery release; in the second case, it is simply rude to judge your parents [ ;) ]

The following is a few lines from the top of a very very long list of similar reports which are fundamentally wrong. jQuery does allow $.extend( target, [object1], [objectN] ) ~ the only required parameter being the first one.

This is a direct lift from api.jquery.com:

When we supply two or more objects to $.extend(), properties from all of the objects are added to the target object.

If only one argument is supplied to $.extend(), this means the target argument was omitted. In this case, the jQuery object itself is assumed to be the target. By doing this, we can add new functions to the jQuery namespace. This can be useful for plugin authors wishing to add new methods to JQuery.

Keep in mind that the target object (first argument) will be modified, and will also be returned from $.extend(). If, however, we want to preserve both of the original objects, we can do so by passing an empty object as the target.

Here's is the jQuery-Lint output.

I have my log buffer set to 2k lines, and it fills completely with loops on this error. *(It would be nice to see a limit-to-number-of-same-errors-logged option added to the LINT .api namespace.)

Unexpected token in attribute selector: '!'.

trigger(ready) called incorrectly                                      jquery.lint.js (line 96)
- More info:                                                           jquery.lint.js (line 111)
   - Collection: [Document carousel.html]
      - Location:                                                      jquery.lint.js (line 111)
             @http://dev.stainsby.ca/widgets/lib/jquery/jquery-1.4.4.js:452 
             @http://dev.stainsby.ca/widgets/lib/jquery/jquery-1.4.4.js:875 
         You passed: ["ready"]
         - Available signatures include:                               jquery.lint.js (line 101)
             trigger(eventType, extraParameters)
             trigger(event)  

(!) jQuery.extend(function () {                                        jquery.lint.js (line 96)
             return runFunction(fn, arguments, _internal, this); 
    }, function () { 
             return runFunction(fn, arguments, _internal, this); 
    }) called incorrectly

- More info:                                                                          jquery.lint.js (line 111)
    - Location:                                                                       jquery.lint.js (line 111)
             (an empty string)
    You passed: [function(), function()]
    - Available signatures include:                                   jquery.lint.js (line 101)
          jQuery.extend(target, [object1], [objectN])
          jQuery.extend([deep], target, object1, [objectN])

(!)  jQuery.extend(function () {                                         jquery.lint.js (line 96)
        return runFunction(fn, arguments, _internal, this); 
      }, function () { 
        return runFunction(fn, arguments, _internal, this); 
      }) called incorrectly

- More info:                                                                         jquery.lint.js (line 111)
    - Location:                                                                      jquery.lint.js (line 111)
             (an empty string)
    You passed: [function(), function()]
    - Available signatures include:                                  jquery.lint.js (line 101)
          jQuery.extend(target, [object1], [objectN])
          jQuery.extend([deep], target, object1, [objectN])
hpbuniat added a commit to hpbuniat/jQuery-Lint that referenced this issue May 17, 2011
hpbuniat added a commit to hpbuniat/jQuery-Lint that referenced this issue May 17, 2011
@hpbuniat
Copy link
Contributor

Hi,

the first point is a good hint, but i guess the initial approach was to do a full or nothing check. It might be tricky to check if a call comes from inside jquery. But as jquery internally should also mind it's api .. it's just cycles we're wasting - not food :).

The signature checks are against the published api - which is of course not complete. I've just updated the parser.

Note that the current jq-lint version, shipped with eg. firequery, still has some issues with jquery > 1.4 (including 1.4.4).

padolsey added a commit that referenced this issue May 17, 2011
padolsey added a commit that referenced this issue Jun 13, 2011
"Among with other minor updates, this should fix #15. I think #12, #17, #21 and #23 were also fixed." From @hpbuniat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants