ember-angle-brackets-codemod icon indicating copy to clipboard operation
ember-angle-brackets-codemod copied to clipboard

Rewrites escaped quotes to quotes (causing Template Compiler Error)

Open kategengler opened this issue 5 years ago • 8 comments

{{foo-bar "placeholder="Choose a \"thing\"..."}}

was rewritten to

<FooBar @placeholder="Choose a "thing"" />

kategengler avatar Dec 30 '19 01:12 kategengler

@kategengler nice one! I’ll try to look at it in 2019 😆. Seriously I’ll try to at least get my head wrapped around this in the next day or so.

tylerturdenpants avatar Dec 30 '19 02:12 tylerturdenpants

with input fixture like this the test fails

  let input = `
    {{foo-bar placeholder="Choose a \"thing\" here"}}
    `;

But if the input fixture has double slashes like this, the test passes.

  let input = `
    {{foo-bar placeholder="Choose a \\"thing\\" here"}}
    `;

rajasegar avatar Jan 12 '20 07:01 rajasegar

@kategengler Out of curiosity, it is recommended not to use bare strings in templates right? Aren't you folks using any template-lint rules with bare-strings rule enabled.

rajasegar avatar Jan 12 '20 07:01 rajasegar

@rajasegar no-bare-strings is not enabled by default in ember-template-lint, neither in recommended nor octane rulesets. It's an optional rule that can be enabled in apps that enforce internationalization. This doesn't apply to all apps -- I often build internal apps that are used by just a few people and so bare strings in the default language are fine.

kategengler avatar Jan 12 '20 07:01 kategengler

@kategengler Makes sense, understood.

rajasegar avatar Jan 12 '20 09:01 rajasegar

@kategengler @rajasegar there is a fix pending. It might be in the new ember-template-recast, as the root problem existed in the glimmer printer. This should be close to being finished.

tylerturdenpants avatar Jan 12 '20 10:01 tylerturdenpants

@tylerturdenpants So the fix would be to just bump ember-template-recast to a new version , I assume

rajasegar avatar Jan 12 '20 12:01 rajasegar

@rajasegar yes. I reopen a dependabot closed PR that would have down that but it looks like maybe another issue made its way through.

tylerturdenpants avatar Jan 12 '20 14:01 tylerturdenpants