@@ -7,17 +7,17 @@ module.exports = function() {};
77
88module . exports . prototype = {
99
10- configure : function ( options ) {
10+ configure : function ( options ) {
1111 assert ( typeof options === 'object' , 'jsDoc option requires object value' ) ;
1212 this . _options = options ;
1313 this . _optionsList = Object . keys ( options ) ;
1414 } ,
1515
16- getOptionName : function ( ) {
16+ getOptionName : function ( ) {
1717 return 'jsDoc' ;
1818 } ,
1919
20- check : function ( file , errors ) {
20+ check : function ( file , errors ) {
2121 var validators = this . loadValidators ( ) ;
2222
2323 // skip if there is nothing to check
@@ -32,14 +32,13 @@ module.exports.prototype = {
3232 'FunctionDeclaration' ,
3333 'FunctionExpression'
3434
35- ] , function ( node ) {
36- node . jsDoc = jsDocs . node ( node ) ;
37-
35+ ] , function ( node ) {
36+ node . jsDoc = jsDocs . forNode ( node ) ;
3837 for ( var j = 0 , k = validators . length ; j < k ; j += 1 ) {
3938 validators [ j ] . call ( that , node , addError ) ;
4039 }
4140
42- function addError ( text , loc ) {
41+ function addError ( text , loc ) {
4342 loc = loc || { } ;
4443 loc . line = loc . hasOwnProperty ( 'line' ) ? loc . line : ( node . jsDoc . loc . start . line ) ;
4544 loc . column = loc . hasOwnProperty ( 'column' ) ? loc . column : 0 ; //node.jsDoc[i].indexOf('@');
@@ -49,7 +48,7 @@ module.exports.prototype = {
4948
5049 } ,
5150
52- loadValidators : function ( ) {
51+ loadValidators : function ( ) {
5352 var passedOptions = this . _optionsList ;
5453 var validators = [ ] ;
5554 if ( ! passedOptions ) {
@@ -58,12 +57,16 @@ module.exports.prototype = {
5857
5958 Object . keys ( validatorsByName ) . forEach ( function ( name ) {
6059 var v = validatorsByName [ name ] ;
60+
61+ // skip unused
6162 if ( ! v . coveredOptions ) {
6263 return ;
6364 }
65+
66+ // store used
6467 for ( var i = 0 , l = v . coveredOptions . length ; i < l ; i += 1 ) {
6568 if ( passedOptions . indexOf ( v . coveredOptions [ i ] ) !== - 1 ) {
66- validators . push ( v . bind ( this ) ) ;
69+ validators . push ( v ) ;
6770 return ;
6871 }
6972 }
0 commit comments