Skip to content

[Bug] Incorrect behavior when template contains aΒ #222

@HeroicEric

Description

@HeroicEric

🐞 Describe the Bug

Components are not formatted correctly when <template> contains unicode characters such as βœ“ or Β© rather than &check; or &copy;.

πŸ”¬ Minimal Reproduction

Failing test added in #221

import Component from '@glimmer/component';

export interface Signature {
  Element: HTMLElement,
  Args: {}
  Yields: []
}

/** It's a component */
class MyComponent extends Component<Signature> {
  <template>
    βœ“
  </template>
}

function hello() {
  return 'Hello';
}

function world() {
  return 'World';
}

πŸ˜• Actual Behavior

import Component from "@glimmer/component";

export interface Signature {
  Element: HTMLElement;
  Args: {};
  Yields: [];
}

/** It's a component */
class MyComponent extends Component<Signature> {
  <template>βœ“</template>
}
function hello() {
  return "Hello";
}
function world() {
  return "World";
}

Note: The newlines are removed between the helper functions.

πŸ€” Expected Behavior

import Component from "@glimmer/component";

export interface Signature {
  Element: HTMLElement;
  Args: {};
  Yields: [];
}

/** It's a component */
class MyComponent extends Component<Signature> {
  <template>βœ“</template>
}

function hello() {
  return "Hello";
}

function world() {
  return "World";
}

🌍 Environment

  • prettier-plugin-ember-template-tag version: 2.0.0
  • ember-template-imports version (if applicable): 4.0.0
  • content-tag version (if applicable): 1.2.2
  • eslint-plugin-ember version (if applicable): 12.0.0-alpha.4

βž• Additional Context

Replacing the direct symbols with the HTML entity codes like &check; fixes the formatting issue (and is preferred anyway)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions