Skip to content

Commit ac6425a

Browse files
committed
chore: upgrade typescript and eslint
1 parent 44a28ea commit ac6425a

8 files changed

Lines changed: 2141 additions & 948 deletions

File tree

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = {
4646

4747
/* typescript-eslint rules */
4848
"@typescript-eslint/adjacent-overload-signatures": "off",
49-
"@typescript-eslint/ban-types": [
49+
"@typescript-eslint/no-restricted-types": [
5050
"error",
5151
{
5252
types: {
@@ -70,7 +70,7 @@ module.exports = {
7070
"@typescript-eslint/no-inferrable-types": "off",
7171
"@typescript-eslint/no-namespace": "off",
7272
"@typescript-eslint/no-non-null-assertion": "off",
73-
"@typescript-eslint/no-throw-literal": "error",
73+
"@typescript-eslint/only-throw-error": "error",
7474
"@typescript-eslint/no-use-before-define": "off",
7575
"@typescript-eslint/no-unused-expressions": [
7676
"error",
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
import baseConfig from "./jest.config.mjs";
23

3-
const baseConfig = require("./jest.config");
4-
5-
module.exports = {
4+
export default {
65
...baseConfig,
76
moduleNameMapper: {
87
"src(.*)$": "<rootDir>/dist$1",

jest.config.js renamed to jest.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22

3-
module.exports = {
3+
export default {
44
preset: "ts-jest",
55
testEnvironment: "node",
66
transform: {

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"lint": "eslint .",
3434
"format": "prettier --write .",
3535
"test": "jest",
36-
"test-dist-skip-build": "jest --config=jest-dist.config.js",
36+
"test-dist-skip-build": "jest --config=jest-dist.config.mjs",
3737
"test-dist": "yarn build-dist && yarn test-dist-skip-build",
3838
"generate-mjml-react": "ts-node scripts/generate-mjml-react.ts",
3939
"build-mjml-react": "ts-node scripts/build-mjml-react.ts",
@@ -46,26 +46,26 @@
4646
"@semantic-release/npm": "^13.1.5",
4747
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
4848
"@types/html-minifier": "^4.0.2",
49-
"@types/jest": "^29.1.2",
50-
"@types/lodash.camelcase": "^4.3.7",
51-
"@types/lodash.kebabcase": "^4.1.7",
52-
"@types/lodash.upperfirst": "^4.3.7",
49+
"@types/jest": "^29.5.14",
50+
"@types/lodash.camelcase": "^4.3.9",
51+
"@types/lodash.kebabcase": "^4.1.9",
52+
"@types/lodash.upperfirst": "^4.3.9",
5353
"@types/mjml": "^4.7.0",
54-
"@types/node": "^18.8.2",
54+
"@types/node": "^22.19.0",
5555
"@types/react": "^18.3",
5656
"@types/react-dom": "^18.3",
57-
"@typescript-eslint/eslint-plugin": "^5.40.1",
58-
"@typescript-eslint/parser": "^5.40.1",
57+
"@typescript-eslint/eslint-plugin": "^8.59.2",
58+
"@typescript-eslint/parser": "^8.59.2",
5959
"del": "^6.0.0",
60-
"eslint": "^8.25.0",
61-
"eslint-plugin-import": "^2.26.0",
62-
"eslint-plugin-jest": "^27.1.3",
63-
"eslint-plugin-jest-dom": "^4.0.2",
64-
"eslint-plugin-react": "^7.31.10",
65-
"eslint-plugin-react-hooks": "^4.6.0",
66-
"eslint-plugin-testing-library": "^5.8.0",
60+
"eslint": "^8.57.1",
61+
"eslint-plugin-import": "^2.32.0",
62+
"eslint-plugin-jest": "^29.15.2",
63+
"eslint-plugin-jest-dom": "^5.5.0",
64+
"eslint-plugin-react": "^7.37.5",
65+
"eslint-plugin-react-hooks": "^7.1.1",
66+
"eslint-plugin-testing-library": "^7.16.2",
6767
"husky": "^8.0.0",
68-
"jest": "^29.0.3",
68+
"jest": "^29.7.0",
6969
"lodash.camelcase": "^4.3.0",
7070
"lodash.upperfirst": "^4.3.1",
7171
"mjml": "^4.15.3",
@@ -74,9 +74,9 @@
7474
"react": "^18.3",
7575
"react-dom": "^18.3",
7676
"semantic-release": "^24.0.0",
77-
"ts-jest": "^29.0.3",
78-
"ts-node": "^10.3.0",
79-
"typescript": "4.5.5"
77+
"ts-jest": "^29.4.9",
78+
"ts-node": "^10.9.2",
79+
"typescript": "5.9.3"
8080
},
8181
"peerDependencies": {
8282
"mjml": "^4.13.0",

scripts/generate-mjml-react.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
*
66
* usage `node --require ts-node/register scripts/generate-mjml-react.ts`
77
*/
8+
import * as childProcess from "child_process";
89
import * as del from "del";
910
import * as fs from "fs";
1011
import camelCase from "lodash.camelcase";
1112
import upperFirst from "lodash.upperfirst";
13+
// @ts-expect-error - no types available for mjml-preset-core
14+
import * as presetCore from "mjml-preset-core";
1215
import * as path from "path";
1316

1417
import { getPropTypeFromMjmlAttributeType } from "./generate-mjml-react-utils/getPropTypeFromMjmlAttributeType";
@@ -32,8 +35,8 @@ export interface IMjmlComponent {
3235
endingTag?: true;
3336
}
3437

35-
const PRESET_CORE_COMPONENTS: Array<IMjmlComponent> =
36-
require("mjml-preset-core").components;
38+
const PRESET_CORE_COMPONENTS: Array<IMjmlComponent> = presetCore.components;
39+
3740
const OTHER_SUPPORTED_COMPONENTS = [
3841
"mjml",
3942
"mj-all",
@@ -281,6 +284,6 @@ ${gitAttributes}
281284
`
282285
);
283286

284-
require("child_process").execSync(
287+
childProcess.execSync(
285288
`yarn prettier --write ${GENERATED_MJML_FILES} ${MJML_INDEX_FILE} ${MAIN_INDEX_FILE}`
286289
);

test/generate-mjml-react/getPropTypeFromMjmlAttributeType.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// import camelCase from "lodash.camelcase";
22
import _ from "lodash";
3+
// @ts-expect-error - no types available for mjml-preset-core
4+
import * as presetCore from "mjml-preset-core";
35

46
import { IMjmlComponent } from "../../scripts/generate-mjml-react";
57
import {
@@ -34,8 +36,7 @@ describe("getPropTypeFromMjmlAttributeType", () => {
3436
);
3537

3638
describe("use CSSProperties for useful mjml types", () => {
37-
const presetCoreComponents: Array<IMjmlComponent> =
38-
require("mjml-preset-core").components;
39+
const presetCoreComponents: Array<IMjmlComponent> = presetCore.components;
3940

4041
const allMjmlTypesGroupedByAttribute = presetCoreComponents.reduce(
4142
(map, component) => {

tsconfig-base.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"noFallthroughCasesInSwitch": true,
2121
"useUnknownInCatchVariables": false,
2222
"useDefineForClassFields": false,
23-
"resolveJsonModule": true
23+
"resolveJsonModule": true,
24+
"skipLibCheck": true
2425
},
2526

2627
"include": ["src/**/*", "src/**/*.json"],

0 commit comments

Comments
 (0)