参考资料
规范细则
-
使用两个空格进行缩进。
eslint: indent
function hello (name) {
console.log('hi', name)
}
-
要使用分号
eslint: semi
window.alert('hi') // ✗ avoid
window.alert('hi'); // ✓ ok
-
函数声明时括号与函数名间不加空格。
eslint: space-before-function-paren
function name (arg) { ... } // ✗ avoid
function name(arg) { ... } // ✓ ok
run(function () { ... }) // ✗ avoid
run(function() { ... }) // ✓ ok