打破 lambda 表达式箭头的 TsLint 规则名称是什么?
What is the TsLint rule name for breaking lambda expression arrow?
我使用了这样带有断箭头的语法。
const result = data.map( _
=> this.reallyLongExpressionSoBreakingArrowMakesSense(_));
然后我注意到 TsLint 标记了该地点并给了我以下信息。
Line terminator not permitted before arrow. (ts1200)
我在我的 tslint.json 中没有找到类似的东西,所以我去 the docs 看看实际名称是什么。据我所知,没有任何对应的消息。
- 消息对应的TsLint规则是什么?
- 消息后括号中的ts1200有什么意义?
As contributors said,此行为未修复:
I think it's unlikely anyone is using this syntax, since it's much
harder to read, but if it breaks apps then it might not be worth
fixing.
However, the problem I ran into when I tried to fix this was that it's
a real pain to work on the token-level in the checker. So I wonder if
the benefit of the idea is actually worth the cost.
更新:
尽量让它们_ =>
在同一行,但是在下一行调用你的方法:
const result = data.map( _ =>
this.reallyLongExpressionSoBreakingArrowMakesSense(_));
我通过将粗箭头和表达式推到一行来解决这个问题
我使用了这样带有断箭头的语法。
const result = data.map( _
=> this.reallyLongExpressionSoBreakingArrowMakesSense(_));
然后我注意到 TsLint 标记了该地点并给了我以下信息。
Line terminator not permitted before arrow. (ts1200)
我在我的 tslint.json 中没有找到类似的东西,所以我去 the docs 看看实际名称是什么。据我所知,没有任何对应的消息。
- 消息对应的TsLint规则是什么?
- 消息后括号中的ts1200有什么意义?
As contributors said,此行为未修复:
I think it's unlikely anyone is using this syntax, since it's much harder to read, but if it breaks apps then it might not be worth fixing.
However, the problem I ran into when I tried to fix this was that it's a real pain to work on the token-level in the checker. So I wonder if the benefit of the idea is actually worth the cost.
更新:
尽量让它们_ =>
在同一行,但是在下一行调用你的方法:
const result = data.map( _ =>
this.reallyLongExpressionSoBreakingArrowMakesSense(_));
我通过将粗箭头和表达式推到一行来解决这个问题