-
Notifications
You must be signed in to change notification settings - Fork 14
Type-check blueprint files #75
base: master
Are you sure you want to change the base?
Conversation
This reply is five months late in coming, mostly because I have not made the time for thinking through the blueprints space. I apologize! Per the various discussions we’ve had around #74 and #71, I’m unsure how we should proceed. I’d like to talk through this point with some Ember CLI folks to see if we can design a better solution. In the meantime, I’ll leave it at your discretion whether you want to leave this and #74 open, or close them till we make a call (hopefully soon!). |
@simonihmig any interest in rebasing this and landing it, at least as a stopgap while we iterate toward something better? Making sure our output type-checks seems like a big win. 😅 |
tsconfig.json
Outdated
@@ -0,0 +1,33 @@ | |||
{ |
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 like having this in place; let's rename it to test.tsconfig.json
so that it doesn't get picked up on the editor side. We may want to actually migrate this repo to TS, so we need the test-specific config to be separate!
package.json
Outdated
@@ -15,6 +15,7 @@ | |||
"scripts": { | |||
"build": "ember build", | |||
"lint:js": "eslint .", | |||
"lint:blueprints": "tsc -noEmit", |
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.
Per comment on the tsconfig.json
file, we should reference the test config instead. Also there's a typo here: should be --noEmit
.
"lint:blueprints": "tsc -noEmit", | |
"lint:blueprints": "tsc test.tsconfig.json --noEmit", |
@simonihmig please, take a look at the comments form @chriskrycho! |
Sorry folks, somehow I missed the previous comments... (probably because they were posted on my birthday, and I had better things to do 😉) I just noticed that emberjs/rfcs#776 has just been merged, so we now have a way better path forward to support TS blueprints. Therefore I see little value in investing more time into this. @chriskrycho do you agree? |
@simonihmig I actually think it’s still very valuable, and I also have time to shepherd it across the line if you have time to rebase it/get it up to date. The reason it’s still valuable: while we have the ability to author blueprints in TS, we still have some design work to do in terms of what the content of those blueprints should be. That’s relatively small, and I will have the RFC written this quarter—probably in February, but we even if it’s the easiest turn-around ever on an RFC, and we land the blueprints implementations the second it merges, that would put it landing in stable Ember CLI 4.4 in June at the earliest. Soooooo if you have time, let’s get this done! |
This makes sure that files generated by the blueprints type-check correctly. As all tests use fixture files to test that the blueprints generate the correct output, we can just add a linting test that type-checks the existing static fixtures files, instead of running the blueprints and type-checking the output afterwards. To make imports not cause type errors, the appropriate typing packages have been added to `devDependencies`, and `types/index.d.ts` declares all in-app modules used in the test fixtures.
@chriskrycho I rebased this, applied your suggestions, and updated the related dependencies (e.g. latest TS). Also added the linting step to CI, which is for now allowed to fail, as there are expectedly a bunch of typing errors in the existing blueprint files. |
Excellent. I'll re-review on Monday! Thank you! |
@chriskrycho ping 😉 |
Just found this while finally (!) clearing out email. Let’s wait till we land #240 to avoid blocking that. Going to try to make that happen early this next week. Thanks for the ping! |
I can give a preview of what will happen once #240 lands. Broadly, the errors fall into these categories:
By far and away the most common errors are the two pre-rfc232 errors, looking for I've solved some of the problems already and will create a new PR with the updated fixtures and blueprints hopefully before this one lands. 14 files changed, three or so added. Here's what I've solved:
Here are the remaining complaints:
|
@simonihmig I have been testing this PR against #240, and I've had to add the following dev dependencies in addition to what you have above:
I also had to upgrade |
Thanks, @simonihmig! I think for @chriskrycho's sake, who's had to review #240 like five times now, I'll have that land and then follow up w/ a PR that adds types to the fixtures and adjusts the blueprints to match them--but that doesn't actually have any mechanism for doing the type checks. Then, I think, once that second PR lands, we can implement the type-checking mechanism you've put together here, so that That makes sense to me, how does it sound to you? |
First step in an attempt to fix #4.
For the beginning this adds a (failing) test to type-check the blueprint output. Actually fixing the output will follow over time... (at least waiting for #74 to be merged)
The test makes sure that files generated by the blueprints type-check correctly. As all tests use fixture files to test that the blueprints generate the correct output, we can just add a linting test that type-checks the existing static fixtures files, instead of running the blueprints and type-checking the output afterwards.
To make imports not cause type errors, the appropriate typing packages have been added to
devDependencies
, andtypes/index.d.ts
declares all in-app modules used in the test fixtures.Anyone here have any concerns with the approach taken here so far? @chriskrycho @mike-north