0

For example, I have the following script "test.js":

/**
 * Adds two numbers.
 * @param {number} a First number.
 * @param {number} b First number.
 * @return {number} Sum of two numbers.
 */
function add(a, b) {
  return a + b;
}

var sum = add(1, 2);
var sum1 = add(1, 2, 4);
var sum2 = add('1', '2');

The function "add" is annotated by jsdoc. It accepts two numbers. I would like to check the input parameters by gjslint.

gjslint --strict --jslint_error "all" --jsdoc test.js

I expect to see 2 errors for lines where sum1 (3 input parameters) and sum2 (2 string parameters) are calculated. But the tools says "1 files checked, no errors found."

user607854
  • 85
  • 1
  • 5

1 Answers1

0

I have not used the Closure Linter, but I believe that is more used for style issues - missing semicolons and such (adherence to http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml)

The Closure Compiler, however, will give a JSC_WRONG_ARGUMENT_COUNT warning for the use case above.

ne8il
  • 2,427
  • 1
  • 20
  • 18
  • 1
    I am trying to do the same. Spent hours trying to do this with lint and now the hello world example does not give any warnings or errors either. Could you point us to a working example of how to do this? – HMR Mar 11 '13 at 10:58