Skip to content

Commit 1e13a5e

Browse files
authored
Merge pull request #8937 from marmelab/upgrade-ts5
Upgrade to TS 5
2 parents 5089337 + 8b9ac2f commit 1e13a5e

33 files changed

Lines changed: 2659 additions & 3464 deletions

File tree

.eslintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
12
{
23
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"warnOnUnsupportedTypeScriptVersion": false
6+
},
37
"extends": ["react-app", "plugin:prettier/recommended"],
48
"plugins": [
59
"@typescript-eslint",

cypress/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const cypress = require('cypress');
22
const server = require('./server');
33

4-
return server.start().then(listeningServer => {
4+
server.start().then(listeningServer => {
55
// kick off a cypress run
66
return cypress
77
.run({

examples/crm/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
"@testing-library/react": "^11.1.0",
2727
"@testing-library/user-event": "^12.1.10",
2828
"@types/faker": "^5.1.7",
29-
"@types/jest": "^26.0.19",
29+
"@types/jest": "^29.5.2",
3030
"@types/lodash": "~4.14.168",
3131
"@types/react": "^17.0.20",
3232
"@types/react-beautiful-dnd": "^13.0.0",
3333
"@types/react-dom": "^17.0.9",
3434
"@vitejs/plugin-react": "^2.2.0",
3535
"source-map-explorer": "^2.0.0",
36-
"typescript": "^4.4.0",
36+
"typescript": "^5.1.3",
3737
"vite": "^3.2.0",
3838
"web-vitals": "^1.0.1"
3939
},

examples/data-generator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"cross-env": "^5.2.0",
2222
"ra-core": "^4.11.4",
2323
"rimraf": "^3.0.2",
24-
"typescript": "^4.4.0"
24+
"typescript": "^5.1.3"
2525
},
2626
"peerDependencies": {
2727
"ra-core": "^4.0.0"

examples/demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@
4545
},
4646
"devDependencies": {
4747
"@types/fetch-mock": "^7.3.2",
48-
"@types/jest": "^26.0.19",
48+
"@types/jest": "^29.5.2",
4949
"@types/node": "^12.12.14",
5050
"@types/prop-types": "^15.6.0",
5151
"@types/react": "^17.0.20",
5252
"@types/react-dom": "^17.0.9",
5353
"@vitejs/plugin-react": "^2.2.0",
5454
"rewire": "^5.0.0",
5555
"source-map-explorer": "^2.0.0",
56-
"typescript": "^4.4.0",
56+
"typescript": "^5.1.3",
5757
"vite": "^3.2.0"
5858
}
5959
}

examples/no-code/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"devDependencies": {
1919
"@vitejs/plugin-react": "^2.2.0",
20-
"typescript": "^4.4.0",
20+
"typescript": "^5.1.3",
2121
"vite": "^3.2.0"
2222
},
2323
"gitHead": "6eb0f6fcbe3ba237b507f3506d230b3445c0a764"

examples/simple/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@hookform/devtools": "^4.0.2",
3636
"@vitejs/plugin-react": "^2.2.0",
3737
"react-app-polyfill": "^1.0.4",
38-
"typescript": "^4.4.0",
38+
"typescript": "^5.1.3",
3939
"vite": "^3.2.0"
4040
}
4141
}

examples/tutorial/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@types/react": "^18.0.22",
1919
"@types/react-dom": "^18.0.7",
2020
"@vitejs/plugin-react": "^2.2.0",
21-
"typescript": "^4.6.4",
21+
"typescript": "^5.1.3",
2222
"vite": "^3.2.0"
2323
}
2424
}

jest.config.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ const fs = require('fs');
33

44
const packages = fs.readdirSync(path.resolve(__dirname, './packages'));
55
const moduleNameMapper = packages.reduce((mapper, dirName) => {
6-
const package = require(path.resolve(
6+
const pkg = require(path.resolve(
77
__dirname,
88
'./packages',
99
dirName,
1010
'package.json'
1111
));
12-
mapper[`^${package.name}(.*)$`] = path.join(
12+
mapper[`^${pkg.name}(.*)$`] = path.join(
1313
__dirname,
1414
`./packages/${dirName}/src$1`
1515
);
@@ -19,20 +19,25 @@ const moduleNameMapper = packages.reduce((mapper, dirName) => {
1919
module.exports = {
2020
globalSetup: './test-global-setup.js',
2121
setupFilesAfterEnv: ['./test-setup.js'],
22-
preset: 'ts-jest/presets/js-with-ts',
22+
testEnvironment: 'jsdom',
2323
testPathIgnorePatterns: [
2424
'/node_modules/',
2525
'/lib/',
2626
'/esm/',
2727
'/examples/simple/',
2828
],
2929
transformIgnorePatterns: [
30-
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|ts|tsx)$',
30+
'[/\\\\]node_modules[/\\\\](?!(@hookform)/).+\\.(js|jsx|mjs|ts|tsx)$',
3131
],
32-
globals: {
33-
'ts-jest': {
34-
isolatedModules: true,
35-
},
32+
transform: {
33+
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
34+
'^.+\\.[tj]sx?$': [
35+
'ts-jest',
36+
{
37+
isolatedModules: true,
38+
useESM: true,
39+
},
40+
],
3641
},
3742
moduleNameMapper,
3843
};

package.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,36 @@
3434
"@storybook/react": "^7.0.12",
3535
"@storybook/react-webpack5": "^7.0.12",
3636
"@storybook/testing-react": "^2.0.0",
37-
"@types/jest": "^26.0.19",
37+
"@types/jest": "^29.5.2",
3838
"@types/react": "^17.0.20",
39-
"@typescript-eslint/eslint-plugin": "^5.9.1",
40-
"@typescript-eslint/parser": "^5.9.1",
39+
"@typescript-eslint/eslint-plugin": "^5.60.0",
40+
"@typescript-eslint/parser": "^5.60.0",
4141
"concurrently": "^5.1.0",
4242
"cross-env": "^5.2.0",
4343
"eslint": "^8.19.0",
4444
"eslint-config-prettier": "^8.5.0",
4545
"eslint-config-react-app": "^7.0.1",
4646
"eslint-plugin-cypress": "^2.12.1",
4747
"eslint-plugin-prettier": "^4.2.1",
48+
"eslint-plugin-testing-library": "^5.11.0",
4849
"full-icu": "~1.3.1",
50+
"global-jsdom": "^9.0.1",
4951
"husky": "^2.3.0",
50-
"jest": "26.6.0",
51-
"jest-circus": "26.6.0",
52-
"jest-resolve": "26.6.0",
53-
"jest-watch-typeahead": "0.6.1",
54-
"lerna": "~5.5.2",
52+
"jest": "^29.5.0",
53+
"jest-circus": "29.5.0",
54+
"jest-environment-jsdom": "^29.5.0",
55+
"jest-resolve": "29.5.0",
56+
"jest-watch-typeahead": "2.2.2",
57+
"lerna": "~7.0.2",
5558
"lint-staged": "^13.0.3",
5659
"lolex": "~2.3.2",
5760
"prettier": "~2.1.1",
5861
"raf": "~3.4.1",
5962
"react": "^17.0.0",
6063
"react-dom": "^17.0.0",
6164
"storybook": "^7.0.12",
62-
"ts-jest": "^26.4.4",
63-
"typescript": "^4.4.0",
65+
"ts-jest": "^29.1.0",
66+
"typescript": "^5.1.3",
6467
"wait-on": "^3.2.0",
6568
"whatwg-fetch": "^3.0.0"
6669
},
@@ -75,6 +78,9 @@
7578
}
7679
},
7780
"resolutions": {
81+
"@typescript-eslint/typescript-estree": "^5.60.0",
82+
"@typescript-eslint/parser": "^5.60.0",
83+
"@typescript-eslint/eslint-plugin": "^5.60.0",
7884
"minimist": "^1.2.6",
7985
"ejs": "^3.1.7"
8086
},

0 commit comments

Comments
 (0)