繁体   English   中英

用链式方法缩进

[英]Eslint indent with chained methods

如何将eslint配置为:

Promise.all(promises)
.then(() => {
  myExampleFunction()
})

代替:

Promise.all(promises)
    .then(() => {
      myExampleFunction()
    })

我们正在使用以下eslint软件包:

"eslint": "4.12.0",
"eslint-plugin-promise": "3.6.0",
"eslint-plugin-react": "7.5.1",
"eslint-plugin-react-native": "3.2.0",

您可以根据文档将MemberExpression设置为0

“将MemberExpression设置为0的2个空格的缩进将使带有0个空格的多行属性链缩进。” - 缩进-规则

作为内联注释/*eslint indent: ["error", 2, { "MemberExpression": 0 }]*/

在.eslintrc中的"rules": {"indent": ["error", 2, { "MemberExpression": 0 }]}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM