Fix empty line in block with EmptyStatement (#1375)
* Fix empty line in block with EmptyStatement * Update code per reviewmaster
parent
7a8380772d
commit
d0e8976af8
|
@ -3428,7 +3428,7 @@ function isFirstStatement(path) {
|
||||||
function isLastStatement(path) {
|
function isLastStatement(path) {
|
||||||
const parent = path.getParentNode();
|
const parent = path.getParentNode();
|
||||||
const node = path.getValue();
|
const node = path.getValue();
|
||||||
const body = parent.body;
|
const body = parent.body.filter(stmt => stmt.type !== "EmptyStatement");
|
||||||
return body && body[body.length - 1] === node;
|
return body && body[body.length - 1] === node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,3 +21,17 @@ do;
|
||||||
while (1);
|
while (1);
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`no-newline.js 1`] = `
|
||||||
|
if (a) {
|
||||||
|
b;
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
if (a) {
|
||||||
|
b;
|
||||||
|
}
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
if (a) {
|
||||||
|
b;
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
Loading…
Reference in New Issue