General developer forum

Minor irritation with PHPStorm, JavaScript doc comments and jQuery

 
Tim at Lone Pine Koala Sanctuary
Minor irritation with PHPStorm, JavaScript doc comments and jQuery
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

Tyical Moodle JavaScript might look like this:

define(['jquery'], function($) {

    "use strict";

    /**
     * Do something.
     *
     * @param {jQuery} someElement a DOM elements wrapped in a jQuery.
     */
    MyClass.prototype.doSomething = function(someElement) {
        someElement.addClass('className');
    };

And, in PHPStorm, that leads to the warning "Unresolved function of method addClass". This is presumably because PHPStorm does not know that $ and jQuery are the same thing. If you do $('.something').addClass('className') then there is no warning.

Does anyone know a way around this?

(It's not that important. I am just an obsessive who likes to get rid of all warnings if possible.)

 
Average of ratings: Useful (1)