Which rule is used for converting this code
JavaScript
x
6
1
function sayHello() {
2
3
console.log("Hello world!");
4
5
}
6
into
JavaScript
1
4
1
function sayHello() {
2
console.log("Hello world!"); // No empty lines at the end and beginning
3
}
4
?
Advertisement
Answer
There’s a rule for blocks: padded-blocks
.
If enabled, an option is:
“blocks” require or disallow padding within block statements, function bodies, and class static blocks
There doesn’t look to be a configurable option for functions in particular.
You’ll want the config option:
JavaScript
1
2
1
[2, 'never']
2
or
JavaScript
1
2
1
[2, { blocks: 'never' }]
2