![](/img/trans.png)
[英]Google Closure Linter not working in Sublime Text 2 for Windows
[英]Is it possible to check function arguments by google closure linter (gjslint) tool?
例如,我有以下腳本“ 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');
函數“ add”由jsdoc注釋。 它接受兩個數字。 我想通過gjslint檢查輸入參數。
gjslint --strict --jslint_error "all" --jsdoc test.js
我希望在計算sum1(3個輸入參數)和sum2(2個字符串參數)的行中看到2個錯誤。 但是工具說“檢查了1個文件,沒有發現錯誤”。
我沒有使用Closure Linter,但是我認為它更多地用於樣式問題-缺少分號等(遵守http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml )
但是,Closure編譯器將針對上述用例給出JSC_WRONG_ARGUMENT_COUNT個警告。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.