Skip to content

Commit 63433ab

Browse files
committed
chore: update babel config and tsconfig and add codemod utils and typescript jscodeshift package
1 parent 5207d59 commit 63433ab

File tree

3 files changed

+62
-7
lines changed

3 files changed

+62
-7
lines changed

Diff for: package.json

+14-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"jscodeshift": "jscodeshift"
1212
},
1313
"dependencies": {
14+
"@codemod.com/codemod-utils": "^1.0.0",
15+
"@types/jscodeshift": "^0.12.0",
1416
"chalk": "^2.4.2",
1517
"eslint": "^6.6.0",
1618
"execa": "^3.2.0",
@@ -22,7 +24,10 @@
2224
},
2325
"jest": {
2426
"globals": {
25-
"baseDir": "../"
27+
"baseDir": "../",
28+
"ts-jest": {
29+
"tsconfig": "./tsconfig.codemod.json"
30+
}
2631
},
2732
"testEnvironment": "node",
2833
"roots": [
@@ -32,13 +37,20 @@
3237
"transform": {
3338
"^.+\\.jsx?$": "babel-jest",
3439
"^.+\\.tsx?$": "ts-jest"
35-
}
40+
},
41+
"transformIgnorePatterns": [
42+
"/node_modules/(?!@codemod\\.com/codemod-utils)/.+\\.js$"
43+
],
44+
"moduleFileExtensions": ["js", "ts", "tsx", "jsx"],
45+
"extensionsToTreatAsEsm": [".ts", ".tsx", ".js", ".jsx"]
3646
},
3747
"devDependencies": {
3848
"@babel/core": "^7.6.4",
3949
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
4050
"@babel/preset-env": "^7.6.3",
51+
"@jest/globals": "^29.7.0",
4152
"@types/jest": "^24.9.0",
53+
"@types/node": "^22.12.0",
4254
"@typescript-eslint/parser": "^7.8.0",
4355
"babel-eslint": "^10.0.3",
4456
"babel-jest": "^24.9.0",

Diff for: tsconfig.codemod.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"composite": true,
5+
"moduleResolution": "node",
6+
"module": "NodeNext",
7+
"target": "ES2015",
8+
"lib": ["ESNext", "DOM"],
9+
"skipLibCheck": true,
10+
"esModuleInterop": true,
11+
"resolveJsonModule": true,
12+
"allowSyntheticDefaultImports": true,
13+
"isolatedModules": true,
14+
"jsx": "react-jsx",
15+
"useDefineForClassFields": true,
16+
"noFallthroughCasesInSwitch": true,
17+
"noUnusedLocals": false,
18+
"noUnusedParameters": false,
19+
"preserveWatchOutput": true,
20+
"strict": true,
21+
"strictNullChecks": true,
22+
"incremental": true,
23+
"noUncheckedIndexedAccess": true,
24+
"noPropertyAccessFromIndexSignature": false,
25+
"allowJs": true,
26+
"outDir": "./dist",
27+
"rootDir": "./transforms",
28+
"moduleDetection": "auto"
29+
},
30+
"include": [
31+
"./transforms/**/*.codemod.ts",
32+
"./transforms/**/*.codemod.js",
33+
"./transforms/**/*.codemod.tsx",
34+
"./transforms/**/*.codemod.jsx"
35+
],
36+
"exclude": ["node_modules", "./dist/**/*"],
37+
"ts-node": {
38+
"transpileOnly": true
39+
}
40+
}

Diff for: tsconfig.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
2-
"compilerOptions": {
3-
"moduleDetection": "force",
4-
"target": "ES2015"
5-
}
6-
}
2+
"compilerOptions": {
3+
"moduleDetection": "force",
4+
"target": "ES2015"
5+
},
6+
"references": [
7+
{ "path": "./tsconfig.codemod.json" }
8+
]
9+
}

0 commit comments

Comments
 (0)