Add .js extensions to internal imports#218
Merged
captbaritone merged 1 commit intomainfrom Mar 10, 2026
Merged
Conversation
✅ Deploy Preview for grats ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
3 tasks
144c29d to
4bbad7f
Compare
captbaritone
commented
Mar 10, 2026
src/tsPlugin/initTsPlugin.ts
Outdated
| @@ -1,8 +1,9 @@ | |||
| import { version as gratsTsVersion } from "typescript"; | |||
| // @ts-ignore — typescript/lib/tsserverlibrary is the standard entry point for TS plugins | |||
Owner
Author
There was a problem hiding this comment.
This is no good. I think this means TS is any typed? This diff makes not changes that should require this. what's going on?
captbaritone
commented
Mar 10, 2026
src/tsPlugin/initTsPlugin.ts
Outdated
| >) { | ||
| const x = info.languageService[k]; | ||
| // @ts-expect-error | ||
| // @ts-ignore — dynamic proxy setup |
Owner
Author
There was a problem hiding this comment.
What is going on that thsi should change in this diff?
captbaritone
commented
Mar 10, 2026
package.json
Outdated
| "prettier": "^3.6.2", | ||
| "process": "^0.11.10", | ||
| "ts-node": "^10.9.2" | ||
| "ts-node": "^10.9.2", |
Owner
Author
There was a problem hiding this comment.
If we're moving to tsx we should be able to drop ts-node right?
captbaritone
commented
Mar 10, 2026
tsconfig.json
Outdated
| "node_modules", | ||
| "dist", | ||
| "src/tests/fixtures", | ||
| "src/tests/integrationFixtures", |
Owner
Author
There was a problem hiding this comment.
Why not migrate integrationFixtures as well?
captbaritone
commented
Mar 10, 2026
| "resolveJsonModule": true, | ||
| "strictPropertyInitialization": true, | ||
| "module": "nodenext", | ||
| "moduleResolution": "nodenext", |
Owner
Author
There was a problem hiding this comment.
Are these needed to support the move to new extensions?
Switch to `module: nodenext` / `moduleResolution: nodenext` in tsconfig.json and add explicit `.js` extensions to all relative import paths. This is required by Node.js ESM resolution and is also valid for CJS, making this a non-breaking preparatory change. Also switches test/profile scripts from ts-node to tsx, which has better support for nodenext module resolution.
4bbad7f to
3da3d3e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
module: nodenext/moduleResolution: nodenextin tsconfig.json.jsextensions to all relative import paths insrc/andscripts/.jsto deep graphql-js imports (graphql/language/parser→graphql/language/parser.js)ts-nodetotsx(better nodenext support)src/tests/integrationFixturesto tsconfig excludeslibfromes2017toes2020With
module: nodenextbut no"type": "module"in package.json, TypeScript still emits CJS. The.jsextensions resolve correctly in CJS, making this a safe non-breaking preparatory change for ESM.Part 1 of 5 — split from #217
Test plan
pnpm run buildpassespnpm run testpassespnpm run lintpasses