[英]What's the difference between $('x > y'), $('y', 'x'), and $('x y')?
[英]JSCS error: X and Y should have at most 2 line(s) between them at
; 和$ rootScope之間應在app / scripts / services / betslipfactory.js之間最多包含2行:
131 | } 132 | $rootScope.copyLineStatus += '</div>'; 133 | }); ---------------------^ 134 | 135 |
找到1個代碼樣式錯誤!
那是我要到這里的錯誤
_.each(status.selections, function(selection) {
$rootScope.copyLineStatus += '<div class="well">';
$rootScope.copyLineStatus += '<strong>' + selection.teamName + ' </strong>';
if (selection.lineChange) {
$rootScope.copyLineStatus += '<div class="row">';
$rootScope.copyLineStatus += '<div class="col-md-12">';
$rootScope.copyLineStatus += '<strong>Lines:</strong>';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '<div class="row">';
$rootScope.copyLineStatus += '<div class="col-md-6">';
$rootScope.copyLineStatus += '<strong>Before</strong>';
$rootScope.copyLineStatus += '<div>' + selection.oldSpread + '(' + selection.oldMoneyLine + ')';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '<div class="col-md-6">';
$rootScope.copyLineStatus += '<strong>Current</strong>';
$rootScope.copyLineStatus += '<div>' + selection.newSpread + '(' + selection.newMoneyLine + ')';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '</div>';
}
if (selection.timeChange) {
$rootScope.copyLineStatus += '<div class="row">';
$rootScope.copyLineStatus += '<div class="col-md-6">';
$rootScope.copyLineStatus += '<strong>Previous Time:</strong>';
$rootScope.copyLineStatus += '<div>' + selection.oldDate + '</div>';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '<div class="col-md-6">';
$rootScope.copyLineStatus += '<strong>Current Time:</strong>';
$rootScope.copyLineStatus += '<div>' + selection.newDate + '</div>';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '</div>';
}
if (selection.statusChange) {
$rootScope.copyLineStatus += '<div class="row">';
$rootScope.copyLineStatus += '<div class="col-md-6">';
$rootScope.copyLineStatus += '<strong>Old Status:</strong>';
$rootScope.copyLineStatus += '<div>' + selection.oldStatus + '</div>';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '<div class="col-md-6">';
$rootScope.copyLineStatus += '<strong>New Status:</strong>';
$rootScope.copyLineStatus += '<div>' + selection.newStatus + '</div>';
$rootScope.copyLineStatus += '</div>';
$rootScope.copyLineStatus += '</div>';
}
if (selection.pitchingChangeThis) {
$rootScope.copyLineStatus += '<div class="row">';
$rootScope.copyLineStatus += '<div class="col-md-12">';
$rootScope.copyLineStatus += '<strong>New Pitcher On Your Team:</strong>';
$rootScope.copyLineStatus += '<div>' + selection.newPlayerNameThis + '</div>';
$rootScope.copyLineStatus += '</div>';
}
if (selection.pitchingChangeOther) {
$rootScope.copyLineStatus += '<div class="row">';
$rootScope.copyLineStatus += '<div class="col-md-12">';
$rootScope.copyLineStatus += '<strong>New Pitcher On The Other Team:</strong>';
$rootScope.copyLineStatus += '<div>' + selection.newPlayerNameOther + '</div>';
$rootScope.copyLineStatus += '</div>';
}
$rootScope.copyLineStatus += '</div>'; //closing the '<div .well>' tag...
});
//HERE IS THE ERROR ^
這與OP的要求略有不同,但可能會為其他人尋找該錯誤:
如果您希望能夠有多個換行符來分隔代碼,以提高可讀性,則可以從.jscsrc文件中刪除此行。 請注意,您不能將其設置為false,因為它是true或需要刪除。
"disallowMultipleLineBreaks": true
盡管這為您提供了更大的靈活性,但這也意味着您可能需要在整個開發團隊中應用通用方法以保持一致。
好吧,您可能在兩個空白行之間:
$rootScope.copyLineStatus += '</div>'; //closing the '<div .well>' tag...
});
和下一行代碼。
在控制台中運行:
jscs "myfile.js" --fix
您也可以將其指向目錄或文件列表。 查看文檔以獲取更多信息
有一個名為SublimeJSCSFormatter的puglin應該為您執行此操作。 雖然從未使用過。
只需按CTRL+ALT+L
或CMD+ALT+L
(在Mac中)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.