简体   繁体   English

Eslint - function 主体没有空的第一行和最后一行

[英]Eslint - No empty first and last lines for function bodies

Which rule is used for converting this code使用哪个规则转换此代码

function sayHello() {

   console.log("Hello world!");

}

into进入

function sayHello() {
   console.log("Hello world!"); // No empty lines at the end and beginning
}

? ?

There's a rule for blocks: padded-blocks .块有一个规则: padded-blocks

If enabled, an option is:如果启用,一个选项是:

"blocks" require or disallow padding within block statements, function bodies, and class static blocks “块”要求或不允许在块语句、function 主体和 class static 块中填充

There doesn't look to be a configurable option for functions in particular.特别是功能似乎没有可配置的选项。

You'll want the config option:您将需要配置选项:

[2, 'never']

or或者

[2, { blocks: 'never' }]

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

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