Skip to content

Commit 72fbd70

Browse files
update
1 parent 27a389d commit 72fbd70

File tree

22 files changed

+307
-162
lines changed

22 files changed

+307
-162
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"editor.wordWrapColumn": 100,
88
"[markdown]": {
99
"editor.wordWrap": "off"
10-
}
10+
},
11+
"typescript.experimental.useTsgo": true
1112
}

package-lock.json

Lines changed: 151 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"lint": "biome lint ./",
99
"pre-commit": "node --run lint:fix; node --run type-check; node --run test",
1010
"test": "npm run test --workspaces",
11-
"type-check": "tsc"
11+
"type-check": "tsgo"
1212
},
1313
"repository": {
1414
"type": "git",
@@ -28,7 +28,7 @@
2828
"devDependencies": {
2929
"@biomejs/biome": "2.1.4",
3030
"@types/node": "^24.2.1",
31-
"typescript": "^5.9.2"
31+
"@typescript/native-preview": "^7.0.0-dev.20250825.1"
3232
},
3333
"workspaces": [
3434
"./recipes/*",

recipes/correct-ts-specifiers/src/fixtures/e2e/test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import { URL } from 'node:url';
33
import { bar } from '@dep/bar';
44
import { foo } from 'foo';
55

6-
import { Bird } from './Bird';
6+
import { Bird } from './Bird/index.ts';
77
import { Cat } from './Cat.ts';
8-
import { Dog } from '…/Dog/index.mjs';
8+
import { Dog } from '…/Dog/index.mts';
99
import { baseUrl } from '#config.js';
10-
import { qux } from './qux.js';
10+
import { qux } from './qux.js/index.ts';
1111

12-
export { Zed } from './zed';
12+
export type { Zed } from './zed.d.ts';
1313

1414
// should.js be unchanged
1515

16-
const nil = await import('./nil.js');
16+
const nil = await import('./nil.ts');
1717

1818
const bird = new Bird('Tweety');
1919
const cat = new Cat('Milo');
Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
{
2-
"extends": ["../../tsconfig.json"],
2+
"compilerOptions": {
3+
"allowImportingTsExtensions": true,
4+
"allowJs": true,
5+
"alwaysStrict": true,
6+
"baseUrl": "./",
7+
"declaration": true,
8+
"declarationMap": true,
9+
"emitDeclarationOnly": true,
10+
"lib": ["ESNext", "DOM"],
11+
"module": "NodeNext",
12+
"moduleResolution": "NodeNext",
13+
"noImplicitThis": true,
14+
"removeComments": true,
15+
"strict": true,
16+
"stripInternal": true,
17+
"target": "esnext"
18+
},
319
"include": ["./"],
420
"exclude": [
5-
"**/*.test.ts"
21+
"node_modules",
22+
"./node_modules",
23+
"**/*.fixture.mjs",
24+
"**/*.mock.mjs",
25+
"**/*.test.mjs"
626
]
727
}

recipes/create-require-from-path/src/workflow.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getNodeImportStatements } from "@nodejs/codemod-utils/ast-grep/import-statement";
22
import { getNodeRequireCalls } from "@nodejs/codemod-utils/ast-grep/require-call";
33
import type { SgRoot, Edit } from "@codemod.com/jssg-types/main";
4+
import type JS from "@codemod.com/jssg-types/langs/javascript";
45

56
/**
67
* Transform function that updates code to replace deprecated `createRequireFromPath` usage
@@ -20,7 +21,7 @@ import type { SgRoot, Edit } from "@codemod.com/jssg-types/main";
2021
*
2122
* 3. Preserves original variable names and declaration types.
2223
*/
23-
export default function transform(root: SgRoot): string | null {
24+
export default function transform(root: SgRoot<JS>): string | null {
2425
const rootNode = root.root();
2526
const edits: Edit[] = [];
2627
let hasChanges = false;

recipes/create-require-from-path/tsconfig.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

recipes/fs-access-mode-constants/src/workflow.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
import { getNodeRequireCalls } from "@nodejs/codemod-utils/ast-grep/require-call"
2+
import { getNodeImportStatements } from "@nodejs/codemod-utils/ast-grep/import-statement";
13
import type { Edit, SgRoot } from "@codemod.com/jssg-types/main";
2-
import { getNodeRequireCalls } from "@nodejs/codemod-utils/ast-grep/require-call";
34
import type Js from "@codemod.com/jssg-types/langs/javascript";
4-
import { getNodeImportStatements } from "@nodejs/codemod-utils/ast-grep/import-statement";
55

66
export default function tranform(root: SgRoot<Js>): string | null {
77
const rootNode = root.root();
88
const edits: Edit[] = [];
99

10-
// @ts-expect-error - ast-grep types are not fully compatible with JSSG types
1110
const requireStatements = getNodeRequireCalls(root, "fs");
1211

1312
for (const statement of requireStatements) {
@@ -27,7 +26,6 @@ export default function tranform(root: SgRoot<Js>): string | null {
2726
};
2827
}
2928

30-
// @ts-expect-error - ast-grep types are not fully compatible with JSSG types
3129
const importStatements = getNodeImportStatements(root, "fs");
3230
let promisesImportName = '';
3331

recipes/import-assertions-to-attributes/src/workflow.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { SgRoot, Edit } from "@codemod.com/jssg-types/main";
2+
import type Js from "@codemod.com/jssg-types/langs/javascript";
23

34
/**
45
* Transform function that converts import assertions to import attributes
@@ -11,7 +12,7 @@ import type { SgRoot, Edit } from "@codemod.com/jssg-types/main";
1112
* 1. import { something } from './module.json' with { type: 'json' };
1213
* 2. import('./module.json', { with: { type: 'json' } })
1314
*/
14-
export default async function transform(root: SgRoot): Promise<string> {
15+
export default async function transform(root: SgRoot<Js>): Promise<string> {
1516
const rootNode = root.root();
1617
const edits: Edit[] = [];
1718

recipes/import-assertions-to-attributes/tsconfig.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)