-
Notifications
You must be signed in to change notification settings - Fork 32
Support for running on templates in JS files #167
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
Comments
Should support the following import locations: import hbs from 'htmlbars-inline-precompile';
import hbs from 'ember-cli-htmlbars-inline-precompile';
import { hbs } from 'ember-cli-htmlbars'; (Note that the actual local name is completely up to the app, and does not need to be Should also support the following call signatures of hbs`{{stuff-here blah="derp"}}`;
hbs('{{stuff-here blah="derp"}}');
hbs('{{stuff-here blah="derp"}}', { moduleName: 'app-name/templates/foo.hbs' }); |
I wasn't aware that this is formally not supported. Running the codemod with a RegExp that matches JavaScript files works quiet well. If run the codemod on the huge test suite of Ember Bootstrap and it has worked quiet well. This commit is mostly done by the codemod: ember-bootstrap/ember-bootstrap@ae598bc But there are some problems which causes files to be skipped:
I haven't noticed any wrong conversion. It has either skipped the file or provided correct conversion. In some rare edge cases the conversion was incomplete and missing some yielded blocks. Update: All syntax errors were caused by Update 2: The SummaryWhile running the codemod on rendering tests is not official supported it works quite well. It either does it job as expected or fails and skips the file. Such failures seem to be caused by |
hi @lifeart , i will update the code and publish it this weekend :) |
I haven't been able to get this to work in our test files, but I would love for that to be possible! |
@ajcolter I believe you need to specify the
I saw a few parsing errors that I will open separate issues for. But to confirm @jelhan's findings, the migration worked for the majority of cases. |
I found some of these stragglers with this regular expression: \{\{#((?!if)(?!unless)(?!each)(?!with)(?!let)(?!link-to)[\s\S])+ I found more with this, but it also finds expected substitutions used in templates, so it means combing through a lot of false positives and I may have missed some invocations: [^=]\{\{#?((?!if)(?!unless)(?!each)(?!with)(?!let)(?!link-to)(?!\/if)(?!else)(?!\/each)[\s\S])+ The ListPagination test was missed by the codemod due to parsing errors caused by the presence of < and > characters elsewhere in the file, as described by @jelhan here: ember-codemods/ember-angle-brackets-codemod#167 (comment) I thought Toggle was missed because it’s part of ember-composable-helpers, but when I removed that and ran the codemod again, it only converted the integration test and ignored the two templates where it’s used. Adding toggle to a disallowed list in .template-lintrc.js doesn’t produce errors for those invocations 😞
I found some of these stragglers with this regular expression: \{\{#((?!if)(?!unless)(?!each)(?!with)(?!let)(?!link-to)[\s\S])+ I found more with this, but it also finds expected substitutions used in templates, so it means combing through a lot of false positives and I may have missed some invocations: [^=]\{\{#?((?!if)(?!unless)(?!each)(?!with)(?!let)(?!link-to)(?!\/if)(?!else)(?!\/each)[\s\S])+ The ListPagination test was missed by the codemod due to parsing errors caused by the presence of < and > characters elsewhere in the file, as described by @jelhan here: ember-codemods/ember-angle-brackets-codemod#167 (comment) I thought Toggle was missed because it’s part of ember-composable-helpers, but when I removed that and ran the codemod again, it only converted the integration test and ignored the two templates where it’s used. Adding toggle to a disallowed list in .template-lintrc.js doesn’t produce errors for those invocations 😞
Example:
The text was updated successfully, but these errors were encountered: