Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = {

/* typescript-eslint rules */
"@typescript-eslint/adjacent-overload-signatures": "off",
"@typescript-eslint/ban-types": [
"@typescript-eslint/no-restricted-types": [
"error",
{
types: {
Expand All @@ -70,7 +70,7 @@ module.exports = {
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/only-throw-error": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-expressions": [
"error",
Expand Down
5 changes: 2 additions & 3 deletions jest-dist.config.js → jest-dist.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
import baseConfig from "./jest.config.mjs";

const baseConfig = require("./jest.config");

module.exports = {
export default {
...baseConfig,
moduleNameMapper: {
"src(.*)$": "<rootDir>/dist$1",
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js → jest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */

module.exports = {
export default {
preset: "ts-jest",
testEnvironment: "node",
transform: {
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"lint": "eslint .",
"format": "prettier --write .",
"test": "jest",
"test-dist-skip-build": "jest --config=jest-dist.config.js",
"test-dist-skip-build": "jest --config=jest-dist.config.mjs",
"test-dist": "yarn build-dist && yarn test-dist-skip-build",
"generate-mjml-react": "ts-node scripts/generate-mjml-react.ts",
"build-mjml-react": "ts-node scripts/build-mjml-react.ts",
Expand All @@ -46,26 +46,26 @@
"@semantic-release/npm": "^13.1.5",
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"@types/html-minifier": "^4.0.2",
"@types/jest": "^29.1.2",
"@types/lodash.camelcase": "^4.3.7",
"@types/lodash.kebabcase": "^4.1.7",
"@types/lodash.upperfirst": "^4.3.7",
"@types/jest": "^29.5.14",
"@types/lodash.camelcase": "^4.3.9",
"@types/lodash.kebabcase": "^4.1.9",
"@types/lodash.upperfirst": "^4.3.9",
"@types/mjml": "^4.7.0",
"@types/node": "^18.8.2",
"@types/node": "^22.19.0",
"@types/react": "^18.3",
"@types/react-dom": "^18.3",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"@typescript-eslint/eslint-plugin": "^8.59.2",
"@typescript-eslint/parser": "^8.59.2",
"del": "^6.0.0",
"eslint": "^8.25.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-jest-dom": "^4.0.2",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^5.8.0",
"eslint": "^8.57.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^29.15.2",
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-testing-library": "^7.16.2",
"husky": "^8.0.0",
"jest": "^29.0.3",
"jest": "^29.7.0",
"lodash.camelcase": "^4.3.0",
"lodash.upperfirst": "^4.3.1",
"mjml": "^4.15.3",
Expand All @@ -74,9 +74,9 @@
"react": "^18.3",
"react-dom": "^18.3",
"semantic-release": "^24.0.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.3.0",
"typescript": "4.5.5"
"ts-jest": "^29.4.9",
"ts-node": "^10.9.2",
"typescript": "5.9.3"
},
"peerDependencies": {
"mjml": "^4.13.0",
Expand Down
9 changes: 6 additions & 3 deletions scripts/generate-mjml-react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
*
* usage `node --require ts-node/register scripts/generate-mjml-react.ts`
*/
import * as childProcess from "child_process";
import * as del from "del";
import * as fs from "fs";
import camelCase from "lodash.camelcase";
import upperFirst from "lodash.upperfirst";
// @ts-expect-error - no types available for mjml-preset-core
import * as presetCore from "mjml-preset-core";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, the test passed even though it failed at this step. Will help take a quick look

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anajavi sorry for the churn, but I think it makes sense to revert back to your original implementation and use @ts-expect-error in both files and delete scripts/types/mjml-preset-core.d.ts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries. I reverted the change.

import * as path from "path";

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

const PRESET_CORE_COMPONENTS: Array<IMjmlComponent> =
require("mjml-preset-core").components;
const PRESET_CORE_COMPONENTS: Array<IMjmlComponent> = presetCore.components;

const OTHER_SUPPORTED_COMPONENTS = [
"mjml",
"mj-all",
Expand Down Expand Up @@ -281,6 +284,6 @@ ${gitAttributes}
`
);

require("child_process").execSync(
childProcess.execSync(
`yarn prettier --write ${GENERATED_MJML_FILES} ${MJML_INDEX_FILE} ${MAIN_INDEX_FILE}`
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// import camelCase from "lodash.camelcase";
import _ from "lodash";
// @ts-expect-error - no types available for mjml-preset-core
import * as presetCore from "mjml-preset-core";

import { IMjmlComponent } from "../../scripts/generate-mjml-react";
import {
Expand Down Expand Up @@ -34,8 +36,7 @@ describe("getPropTypeFromMjmlAttributeType", () => {
);

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

const allMjmlTypesGroupedByAttribute = presetCoreComponents.reduce(
(map, component) => {
Expand Down
Loading
Loading