typescript と tslint をリンターとして使ってプログラムを書いています。私が現在気に入っているルールのリストは次のとおりです (tslint.json)。
{
"extends": "tslint:recommended",
"rules": {
"comment-format": [false, "check-space"],
"eofline": false,
"triple-equals": [false, "allow-null-check"],
"no-trailing-whitespace": false,
"one-line": false,
"no-empty": false,
"typedef-whitespace": false,
"whitespace": false,
"radix": false,
"no-consecutive-blank-lines": false,
"no-console": false,
"typedef": [true,
"variable-declaration",
"call-signature",
"parameter",
"property-declaration",
"member-variable-declaration"
],
"quotemark": false,
"no-any": true,
"one-variable-per-declaration": false
}
}
私は Tslint を使用していますが、パラメーターの数が間違っている関数の呼び出しをキャッチできません。たとえば、次の機能があります。
let displayTimer: Function = function(): void {
document.getElementById('milliseconds').innerHTML = ms.toString();
document.getElementById('seconds').innerHTML = seconds.toString();
document.getElementById('minutes').innerHTML= minutes.toString();
};
そして、私はこのような別の関数内からそれを呼び出しています:
let turnTimerOn: Function = function(): void {
ms += interval;
if (ms >= 1000)
{
ms = 0;
seconds += 1;
}
if (seconds >= 60)
{
ms = 0;
seconds = 0;
minutes += 1;
}
displayTimer(1);
};
ご覧のとおり、displayTimer 関数にパラメーターを渡しています (この場合は数値 1 ですが、それ以外の場合もあります)。リンターはそれをキャッチしていません。