Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Preserve new-lines after directives #2437

Closed
Tracked by #2403
MichaReiser opened this issue Apr 14, 2022 · 1 comment · Fixed by #2500
Closed
Tracked by #2403

Preserve new-lines after directives #2437

MichaReiser opened this issue Apr 14, 2022 · 1 comment · Fixed by #2500
Labels
A-Formatter Area: formatter

Comments

@MichaReiser
Copy link
Contributor

MichaReiser commented Apr 14, 2022

Prettier preserve's any empty line placed between a directive and the first statement, Rome doesn't. Playground

Input

"use strict";

function f1() {
  "use strict";
}

function f2() {
  'ngInject';
  Object.assign(this, { $log, $uibModal });
}

function f3() {

  'ngInject';

  Object.assign(this, { $log, $uibModal });

}

function f4() {
  'ngInject';
  
  "use strict"


  Object.assign(this, { $log, $uibModal });
}

Prettier

"use strict";

function f1() {
  "use strict";
}

function f2() {
  "ngInject";
  Object.assign(this, { $log, $uibModal });
}

function f3() {
  "ngInject";

  Object.assign(this, { $log, $uibModal });
}

function f4() {
  "ngInject";

  "use strict";

  Object.assign(this, { $log, $uibModal });
}

Rome

"use strict";
function f1() {
  "use strict";
}

function f2() {
  "ngInject";
  Object.assign(this, { $log, $uibModal });
}

function f3() {
  "ngInject";
  Object.assign(this, { $log, $uibModal });
}

function f4() {
  "ngInject";

  "use strict";
  Object.assign(this, { $log, $uibModal });
}

Expected

Rome's formatting to match prettier's.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants