Skip to content

Commit

Permalink
feat: log component warn only for invalid case
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeart committed Jan 9, 2019
1 parent 64121d8 commit 18730f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ class TemplateImportProcessor extends BroccoliFilter {
const warnPrefix = 'ember-template-component-import: ';
const abstractWarn = `${warnPrefix} Allowed import variable names - CamelCased strings, like: FooBar, TomDale`;
const componentWarn = `${warnPrefix}Warning! "${localName}" is not allowed as Variable name for Template import`;
this._console.log(componentWarn);
const warn = isLocalNameValid ? '' : `
{{log '${componentWarn}'}}
{{log '${abstractWarn}'}}
<pre data-test-name="${localName}">${componentWarn}</pre>
<pre data-test-global-warn="${localName}">${abstractWarn}</pre>
`;
if (!isLocalNameValid) {
this._console.log(componentWarn);
}
return `${warn}{{#let (component '${ importPath }') as |${ localName }|}}`;
}).join('');
let footer = imports.map(() => `{{/let}}`).join('');
Expand Down

0 comments on commit 18730f2

Please sign in to comment.