简体   繁体   English

保留最大嵌套括号规则

[英]eslint maximum nested parentheses rule

Is there any eslint rule that would prevent someone from doing this const result = bar(baz()); 是否有任何禁止他人执行此const result = bar(baz()); eslint规则const result = bar(baz());

I would prefer const a = baz(); const result = bar(a); 我更喜欢const a = baz(); const result = bar(a); const a = baz(); const result = bar(a);

Ideally I could configure maximum nesting, so maybe 1 nesting is okay but more than that is not foo(bar(baz())) 理想情况下,我可以配置最大嵌套,因此也许1个嵌套是可以的,但是不超过foo(bar(baz()))

I don't see any existing eslint rule or plugin specifically for the case you mention. 对于您提到的情况,我没有看到任何现有的eslint规则或插件。 The closest one I can find is for a subset of the behavior applying only to nested callbacks: max-nested-callbacks . 我能找到的最接近的是仅适用于嵌套回调的行为子集: max-nested-callbacks You could write your own plugin . 您可以编写自己的插件

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

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