如何在开头括号出现的同一列上强制执行函数的右括号/括号
E.g
// throws error
app.get('/', function (req, response) {
}); // bracket/parentheses is *not on same* column as opening
// this is valid
app.get('/', function (req, response) {
}); // bracket/parentheses is on *same* column as opening
答案 0 :(得分:0)
indent rule涵盖了您正在寻找的内容,但如果您只想查看这一个案例,那就太过分了。尝试将以下内容粘贴到online demo中以查看它给出的错误:
/* eslint indent: 2 */
// throws error
app.get('/', function (req, response) {
}); // bracket/parentheses is *not on same* column as opening
// this is valid
app.get('/', function (req, response) {
}); // bracket/parentheses is on *same* column as opening
重要的部分是开头的/* eslint indent: 2 */
评论。它使用默认设置启用缩进规则,默认设置恰好是四个空格,但规则是可配置的。