ember-codemods / ember-modules-codemod

Codemod to upgrade Ember apps to JavaScript (ES6) modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Replaces htmlSafe import incorrectly

derekwsgray opened this issue · comments

The codemod inserts import { htmlSafe } from '@ember/template' but it should be from @ember/string

There is a corresponding bug in the Ember API documentation where it still lists the function under @ember/template

Actually, @ember/template is the correct location 😄 (it moved from @ember/string to @ember/template in emberjs/rfcs#236).

Guess I'm confused then - The 3.1 docs say string. And @ember/template gives me a 'module not found' at runtime. i.e. right now at 3.1.1, it only works with @ember/string

I'm also seeing this behaviour on 2.18.2, @ember/string works but @ember/template does not.

It seems the htmlSafe API docs still links to a htmlSafe within the string module within ember.js. Also the jsdoc comment for htmlSafe seems to be at odds with itself

/**
  Mark a string as safe for unescaped output with Ember templates. If you
  return HTML from a helper, use this function to
  ensure Ember's rendering layer does not escape the HTML.
  
  import { htmlSafe } from '@ember/string';
  htmlSafe('<div>someString</div>')
  
  @method htmlSafe
  @for @ember/template
  @static
  @return {Handlebars.SafeString} A string that will not be HTML escaped by Handlebars.
  @public
*/

It says @ember/string in the code example but the annotation says @for @ember/template.