Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] An apostrophe in a comment breaks formatting #228

Closed
andrewtimberlake opened this issue Jan 12, 2024 · 1 comment
Closed

[Bug] An apostrophe in a comment breaks formatting #228

andrewtimberlake opened this issue Jan 12, 2024 · 1 comment

Comments

@andrewtimberlake
Copy link

🐞 Describe the Bug

If an apostrophe (’) is in a comment, the formatter fails to format

πŸ”¬ Minimal Reproduction

import Component from '@glimmer/component';
import { action } from '@ember/object';
import { on } from '@ember/modifier';

interface TestComponentSignature {
  Element: HTMLDivElement;
  Args: {};
  Blocks: {
    default: [];
  };
}

export default class TestComponent extends Component<TestComponentSignature> {
  // Don’t use a real apostrophe or prettier will break
  @action
  testAction() {
    console.log('test action');
  }

  <template>
  <button type="button" {{on "click" this.testAction}}>
  {{yield}}
  </button>
  </template>
}

πŸ˜• Actual Behavior

["ERROR" - 08:43:55] Error formatting document.
["ERROR" - 08:43:55] failed to process all templates, 1 remaining
Error: failed to process all templates, 1 remaining
    at convertAst (file:///Users/andrew/dev/bbff/editor/node_modules/prettier-plugin-ember-template-tag/dist/prettier-plugin-ember-template-tag.js:70060:11)
    at Object.parse (file:///Users/andrew/dev/bbff/editor/node_modules/prettier-plugin-ember-template-tag/dist/prettier-plugin-ember-template-tag.js:70079:5)
    at async parse (file:///Users/andrew/dev/bbff/editor/node_modules/prettier/index.mjs:19362:11)
    at async coreFormat (file:///Users/andrew/dev/bbff/editor/node_modules/prettier/index.mjs:20683:7)
    at async formatWithCursor (file:///Users/andrew/dev/bbff/editor/node_modules/prettier/index.mjs:20885:14)
    at async Module.format2 (file:///Users/andrew/dev/bbff/editor/node_modules/prettier/index.mjs:24517:25)
["INFO" - 08:43:55] Formatting completed in 3ms.

πŸ€” Expected Behavior

The document should format

🌍 Environment

  • prettier-plugin-ember-template-tag version: 2.0.0
  • ember-template-imports version (if applicable): 3.4.2
  • content-tag version (if applicable): 1.2.2
  • eslint-plugin-ember version (if applicable): 11.12.0

βž• Additional Context

None

@gitKrystan
Copy link
Collaborator

Thanks for the report. I believe this is a duplicate of #191 as ’ is three bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants