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

Parameter validation wrongly associates closure and doc block #176

Closed
Krinkle opened this issue Nov 20, 2015 · 4 comments
Closed

Parameter validation wrongly associates closure and doc block #176

Krinkle opened this issue Nov 20, 2015 · 4 comments
Labels
Milestone

Comments

@Krinkle
Copy link

Krinkle commented Nov 20, 2015

JSDuck supports the concept of documenting class members not explicitly declared in code. Typically this is used for creating basic entities for upstream libraries.

Examples:

In general however it uses the rule that a documentation block and code are only associated when directly connected. If there is an empty line between, then it is no longer associated.

So e.g.

/**
 * Descriptive description of Foo.
 *
 * @class Foo
 */

/**
 * Descriptive description of bar.
 *
 * @method bar
 * @param x
 */

( function ( $ ) {
  ..
}( jQuery ) );

Would not associate method bar with the closure. And it would not throw a warning about parameter x not matching $, for two reasons:

  • There is a new line in between.
  • It is not a plain function declaration or expression assigned to a property in an object literal, or variable assignment. As such, the function seen there is irrelevant.

The same is like this:

/**
 * @param x
 */
var foo = ( function ( y, z ) {
  ..
  return function ( x ) { .. };
}( 1, 2 ) );

I'm not sure whether this error is a regression, or that it is part of a new rule. But for Wikimedia, jquery.suggestions.js (source code) is causing the following warning:

   27 | * @param {Object} options
13:54:14 Expected $ but got options at ./resources/src/jquery/jquery.suggestions.js :

Because it is wrongly associating the block with the closure.

@qfox qfox added the bug label Nov 20, 2015
@paladox
Copy link

paladox commented Dec 2, 2015

@Krinkle should we change /* too /! temporarily until the problem is fixed.

@qfox qfox added this to the v1.3.0 milestone Dec 6, 2015
@qfox qfox closed this as completed in 4735603 Dec 7, 2015
@paladox
Copy link

paladox commented Dec 9, 2015

Please reopen this. The problem still happens.

@paladox
Copy link

paladox commented Dec 9, 2015

@paladox
Copy link

paladox commented Dec 9, 2015

It is to do with checkParamNames. checkParamNames is causing the error.

@qfox qfox reopened this Dec 9, 2015
@qfox qfox modified the milestones: 1.4, v1.3.0 Dec 12, 2015
@Krinkle Krinkle closed this as completed Mar 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants