gitKrystan / prettier-plugin-ember-template-tag

A prettier plugin for formatting Ember template tags
MIT License
22 stars 12 forks source link

Print template tags on separate lines for "default" templates #35

Closed gitKrystan closed 1 year ago

gitKrystan commented 1 year ago

Default exports and top-level class templates should always print template tags on newlines, even if they could fit on the same line.

import Component from '@glimmer/component';

const what = <template>as const</template>;

export const who = <template>exported const</template>;

<template>
  default export
</template>

class MyComponent extends Component {
  <template>
    Class Level
  </template>
}

A similar convention is used by Prettier for printing functions.

e.g. const add = (a, b) => a + b; is allowed to print on one line but the following would always print with the braces on theri own line:

function add(a, b) {
  return a + b;
}