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

Prettier's whitespace stripping can cause issues #45

Closed
GavinJoyce opened this issue Apr 26, 2019 · 2 comments
Closed

Prettier's whitespace stripping can cause issues #45

GavinJoyce opened this issue Apr 26, 2019 · 2 comments

Comments

@GavinJoyce
Copy link
Collaborator

With the following input (from a component which renders some example JavaScript for human consumption):

someFunction({
  {{#unless installationIsAnonymous}}
    console.log("hi");
  {{/unless}}
});

Prettier seems to reformat it into:

someFunction({
{#unless installationIsAnonymous}}    console.log("hi");
{{/unless}}});

Which then fails the idempotent test:

SyntaxError: Parse error on line 3:
    ...log("hi");{{/unless}}});
    ----------------------^
    Expecting 'CLOSE', got 'CLOSE_UNESCAPED' (3:0)
      1 | someFunction({
      2 | {{#unless installationIsAnonymous}}    console.log("hi");
    > 3 | {{/unless}}});. Please report this in https://github.com/rajasegar/ember-angle-brackets-codemod/issues
@GavinJoyce
Copy link
Collaborator Author

Having a way for an app to mark some hbs as ignored might be a simple way around what's likely a long tail of similar issues

@Turbo87
Copy link
Collaborator

Turbo87 commented Oct 1, 2019

resolved by #97

@Turbo87 Turbo87 closed this as completed Oct 1, 2019
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