ember-modules-codemod icon indicating copy to clipboard operation
ember-modules-codemod copied to clipboard

Replaces htmlSafe import incorrectly

Open derekwsgray opened this issue 6 years ago • 3 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

derekwsgray avatar May 02 '18 14:05 derekwsgray

Actually, @ember/template is the correct location 😄 (it moved from @ember/string to @ember/template in https://github.com/emberjs/rfcs/pull/236).

rwjblue avatar May 02 '18 15:05 rwjblue

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

derekwsgray avatar May 02 '18 15:05 derekwsgray

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.

patocallaghan avatar May 03 '18 07:05 patocallaghan