我改变了我的编码风格
function getParams(entity) {
"use strict";
var accountID = store.getItem('AccountID'),
switch (entity) {
case "Topic":
Run Code Online (Sandbox Code Playgroud)
至
function getParams(entity)
{
"use strict";
var accountID = store.getItem('AccountID'),
switch (entity)
{
case "Topic":
Run Code Online (Sandbox Code Playgroud)
现在我得到任何jslint错误,例如:
警告6 JS Lint:预期')'和'{'之间只有一个空格.警告9 JS Lint:第9栏预期'var',而不是第5列.
我检查了选项,但找不到任何与行位置有关的取消选择.如果有的话,我可以将它添加到我的文件顶部吗?
因为这个原因,建议在JavaScript中将开括号放在同一行上:
function foo()
{
return
{
a: 'foo'
}
}
foo().a // error
Run Code Online (Sandbox Code Playgroud)
这不是一个建议而是一个解决方案,但如果没有新的行,就无法在评论中解释.