no-multiple-empty-lines

禁止多个空行

一些该规则报告的问题可以通过 --fix 命令行选项 自动修复

一些开发人员更喜欢删除多个空行,而另一些开发人员则认为这有助于提高可读性。空格对于分隔代码的逻辑部分很有用,但多余的空格会占用更多的屏幕。

规则详情

此规则旨在减少阅读代码时所需的滚动。超过最大空行数时会发出警告。

选项

此规则有一个对象选项:

    UaXitxJIgHffLcYTMOc6a93VjDd8uMPngqDpig+dQRm5aXVoxwkAi1tqW7zjMrb7ZXdXwPGfA85Dl0BCnfTpyet9UCf19Lts0gtIcedubGk7xGudhr+wA3H2Qe3s6c9ws/oI5X4vGJIGu7aMaTJI0e2KQpHUNSEKhiFegJHdPyydELbYGhUX3t9480M/AEiXaegchDmP4RE4ss1hBUO/S2aPb7po7g6VujsRLGiy7BvlLurtXtU6xEG3ugzokhcfEAIyR/tndvrFIaPIQJVnZlGI7fSA1pnFMErxdD0ou8+h59VbwpPNETW9dm5U1y8GHUeC+Knimnr3b8f3xEED7wsxjHg4gfau2w8y2GsvvLxIZ+gBGw1tLuKfeJm04Nng

max

vGUxWBhIHkIwFaCplge82/dSLl+xgR4P5wY7J2DJ0ZXKlZBqZIe4lcMIgCf7HvBJ7u+97+ofOCWqZyi7rY+Mmv5LN6txJIRaYehAVUx0DEA=

/*eslint no-multiple-empty-lines: "error"*/

var foo = 5;

var bar = 3;

vGUxWBhIHkIwFaCplge82/dSLl+xgR4P5wY7J2DJ0ZXKlZBqZIe4lcMIgCf7HvBJ51qC5w/K68eFxIdCBqSo6zmAeE+ZVhfkg2TCaePwajc=

/*eslint no-multiple-empty-lines: "error"*/

var foo = 5;

var bar = 3;

maxEOF

qVCMgjR5tKUNSBmRY5fDOTa0xJnT002Ja9Hu1VP1mi+tpWF17JOe2kK96g34vRsxzY4gWBCqK3KKVAOTXcvkURJXH7Y4+Fgd1fYsz7FXog9358j8WRg+p+whzHEV8X9z

/*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 0 }]*/

var foo = 5;

var bar = 3;

qVCMgjR5tKUNSBmRY5fDOTa0xJnT002Ja9Hu1VP1mi+tpWF17JOe2kK96g34vRsxFyt75pWiUTv5IhHy+laaygI+9ZV4pqr2Pi7RMhg86rkwzKg+58moF3tLuocF5ML9

/*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 0 }]*/

var foo = 5;

var bar = 3;

wQmVXiKwvxGciY7NLt2vVwbeZIoX5HG0WWVSUAbT5mjRuRyVVpfd4o2KyYIz3cY+brBIEzrDR4Mak+t2xrPPijrhuekyWB2UvLYn/gmA35blKYBOqT9BKUka3FJkr9BzlzASsTXfC6FqjsbXPetq9P1Wgxx/1ehLbiNCKzDzO5zffEAF1q2dQVR2X5AbqDyvvNSs8f8zKghjVeAHSGYrKfBcNU1zSKWQ7Sby8upLuRdVyg8bdYOw6ASdxyLftG5eNJ8aPbkIfmqTMZxDdRvSWEB+x7ideU40J1IrudA1JHMvOAJQa4xu9VCT7TTFSucv9Ydt4ylBM3+fifbGzys8GTj08sptO28hxYmndn0GXQLOWNqvDKzfbVjgElspMcF1xODAutkF9XoSdh/g0ANvWJwhQvccDjbW3VAzOQCroBx2Ws+RLhpzisyxxMIKya0VNdQG23u9lioevl7pV2sIpg==

oGsc4xw4IIfQwiPwxDLT5YnT/dE2B0cv4U1qywHAO67V+H2bAjPK8KXxSB3uoo1p

1    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 0 }]*/⏎
2    ⏎
3    var foo = 5;⏎
4    ⏎
5    ⏎
6    var bar = 3;⏎
7    ⏎
8

Qk/EKZu7Fk5hlfnRFKrQOCFIXjPeNKQmOyVqDBuD/9c=

1    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 0 }]*/⏎
2    ⏎
3    var foo = 5;⏎
4    ⏎
5    ⏎
6    var bar = 3;⏎
7

maxBOF

qVCMgjR5tKUNSBmRY5fDOTa0xJnT002Ja9Hu1VP1mi9ma+U+DlUSBaI8OMaMR/3BsPjllq+mqf5YsVfQTPIwVAJvuKrgAU2uSrdG67vjXS48MefJ+QEMGMC5hpB26uQo

/*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1 }]*/

var foo = 5;

var bar = 3;

qVCMgjR5tKUNSBmRY5fDOTa0xJnT002Ja9Hu1VP1mi9ma+U+DlUSBaI8OMaMR/3BHx7uFa4txqvU+dZH7gIGfY6591zLnEkvmr+6FBUrrbycGd81XzprEDH1qdfS+xMM

/*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1}]*/

var foo = 5;

var bar = 3;

何时不使用

dvppF/nq3GR2SuN5vH7IkBcWXoWWfpEoQaEahpYq5kqagwGqBjSLYvXl5SHpA4rs00egyg6HsgC2lv2avukn0w==