[英]JSCS error: X and Y should have at most 2 line(s) between them at
;
; and $rootScope should have at most 2 line(s) between them at app/scripts/services/betslipfactory.js :
和$ rootScope之间应在app / scripts / services / betslipfactory.js之间最多包含2行:
131 | } 132 | $rootScope.copyLineStatus += '</div>'; 133 | }); ---------------------^ 134 | 135 |
1 code style errors found!
找到1个代码样式错误!
that is the error I am getting here 那是我要到这里的错误
_.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 ^
This is a little aside from what the OP was after but may serve others that look for this error: 这与OP的要求略有不同,但可能会为其他人寻找该错误:
If you want to be able to have multiple line breaks to space out your code for a bit more readability, you can remove this line from your .jscsrc file. 如果您希望能够有多个换行符来分隔代码,以提高可读性,则可以从.jscsrc文件中删除此行。 Note that you cannot set this to false as it's either true or needs to be removed.
请注意,您不能将其设置为false,因为它是true或需要删除。
"disallowMultipleLineBreaks": true
While this gives you more flexibility, that also means you may need to apply a common approach across your development team to stay consistent. 尽管这为您提供了更大的灵活性,但这也意味着您可能需要在整个开发团队中应用通用方法以保持一致。
well, you probably have 2 blank lines between: 好吧,您可能在两个空白行之间:
$rootScope.copyLineStatus += '</div>'; //closing the '<div .well>' tag...
});
and the next line of code. 和下一行代码。
In the console run: 在控制台中运行:
jscs "myfile.js" --fix
You can also point it to a directory or a list of files. 您也可以将其指向目录或文件列表。 Check the documentation for more info
查看文档以获取更多信息
There's a puglin called SublimeJSCSFormatter that should do that for you. 有一个名为SublimeJSCSFormatter的puglin应该为您执行此操作。 Never used it though.
虽然从未使用过。
Just press CTRL+ALT+L
or CMD+ALT+L
(in mac) 只需按
CTRL+ALT+L
或CMD+ALT+L
(在Mac中)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.