Preserve lines after directives (#2070)
Looks like we were only doing it at the top level, we should do it everywhere. Fixes #2067
This commit is contained in:
1 parent
d062961ccf
commit
f399e90bc2
3 files changed
+62
No files matched your search
@@ -713,6 +713,11 @@ function genericPrintNoParens(path, options, print, args) {
|
||||
if (hasDirectives) {
|
||||
path.each(childPath => {
|
||||
parts.push(indent(concat([hardline, print(childPath), semi])));
|
||||
if (
|
||||
util.isNextLineEmpty(options.originalText, childPath.getValue())
|
||||
) {
|
||||
parts.push(hardline);
|
||||
}
|
||||
}, "directives");
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,26 @@ exports[`test.js 1`] = `
|
||||
function fn() {
|
||||
"use strict";
|
||||
}
|
||||
|
||||
function f() {
|
||||
'ngInject';
|
||||
Object.assign(this, { $log, $uibModal });
|
||||
}
|
||||
|
||||
function f() {
|
||||
|
||||
'ngInject';
|
||||
|
||||
Object.assign(this, { $log, $uibModal });
|
||||
|
||||
}
|
||||
|
||||
function f() {
|
||||
'ngInject';
|
||||
|
||||
|
||||
Object.assign(this, { $log, $uibModal });
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
"use strict";
|
||||
|
||||
@@ -137,4 +157,21 @@ function fn() {
|
||||
"use strict";
|
||||
}
|
||||
|
||||
function f() {
|
||||
"ngInject";
|
||||
Object.assign(this, { $log, $uibModal });
|
||||
}
|
||||
|
||||
function f() {
|
||||
"ngInject";
|
||||
|
||||
Object.assign(this, { $log, $uibModal });
|
||||
}
|
||||
|
||||
function f() {
|
||||
"ngInject";
|
||||
|
||||
Object.assign(this, { $log, $uibModal });
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -3,3 +3,23 @@
|
||||
function fn() {
|
||||
"use strict";
|
||||
}
|
||||
|
||||
function f() {
|
||||
'ngInject';
|
||||
Object.assign(this, { $log, $uibModal });
|
||||
}
|
||||
|
||||
function f() {
|
||||
|
||||
'ngInject';
|
||||
|
||||
Object.assign(this, { $log, $uibModal });
|
||||
|
||||
}
|
||||
|
||||
function f() {
|
||||
'ngInject';
|
||||
|
||||
|
||||
Object.assign(this, { $log, $uibModal });
|
||||
}
|
||||
Reference in new issue
Block a user