-
Notifications
You must be signed in to change notification settings - Fork 142
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
Fix the template-tag codemod #2091
Fix the template-tag codemod #2091
Conversation
import QUnit from 'qunit'; | ||
import { join } from 'path'; | ||
|
||
const { module: Qmodule, test } = QUnit; | ||
|
||
appScenarios |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appScenarios no longer includes release
.only('release') | ||
.map('template-tag-codemod', project => { | ||
project.mergeFiles({ | ||
app: { | ||
components: { | ||
'face.hbs': `<h1> this is a gjs file</h1>`, | ||
'daft.hbs': `<button {{on 'click' @onClick}}>click me</button>`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a file that we'd expect to generate an import
if (ember_template_compiler.type === 'not_found') { | ||
throw 'This will not ever be true'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message was too confident, so I changed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was correct for the previous version :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe if someone always remembered to have ember-source installed.
An error message should at least say what went wrong :p
I've seen many errors logged that the original author thought could never happen.
There are no absolute truths.
(including this statement?)
😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember putting that in soley to satisfy TS, there is no case where that will be false and you'd use the template tag codemod.
because a build happens before, you'd never even reach this step if it was the case, but TS is bad to know that. so the statement stands to being always true in the 3.x context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Soley to satisfy TS
TS knows what it's talking about -- because I ran in to this error, and it ended up being a helpful debugging tip. Type errors aren't abount knowing the "current state of your runtime", they help you with migrations, updates, etc -- provide more meaningful information, and give you a chance to provide more context in the failure cases (such as what happened here when I tried to run the codemod in main).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's an argument to be made that the code mod code should never really make it to main, my whole point was to get that to help people on stable and part of the upgrade to main would be run the code mod if you haven't already. so intent stays true to that should never be true
Closing this since #2101 opted to not include the codemod in main (since it was only ever written to work in main) |
On main