Skip to content
Open
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
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

159 changes: 0 additions & 159 deletions .eslintrc.js

This file was deleted.

164 changes: 164 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import js from "@eslint/js";
import importPlugin from "eslint-plugin-import";
import jestPlugin from "eslint-plugin-jest";
import jestDomPlugin from "eslint-plugin-jest-dom";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import testingLibraryPlugin from "eslint-plugin-testing-library";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";

export default defineConfig([
{
name: "global ignores",
ignores: ["dist"],
},
{
files: [`**/*.{js,cjs,mjs,ts,tsx,mts}`],
},
js.configs.recommended,
tseslint.configs.recommended,
reactPlugin.configs.flat.recommended,
reactHooksPlugin.configs.flat.recommended,
{
plugins: {
import: importPlugin,
},
},
{
languageOptions: {
parserOptions: {
project: ["./tsconfig-eslint.json"],
},
},
settings: {
react: {
version: "detect",
},
},
},
{
rules: {
complexity: "error",
curly: "error",
eqeqeq: ["error", "smart"],
"no-alert": "error",
"no-console": "error",
"no-prototype-builtins": "off",
"no-unused-vars": "off",
"no-process-env": "error",

/* typescript-eslint rules */
"@typescript-eslint/adjacent-overload-signatures": "off",
"@typescript-eslint/no-restricted-types": [
"error",
{
types: {
IStringTMap: "Prefer Record<string, T>",
},
},
],
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
accessibility: "no-public",
overrides: { parameterProperties: "explicit" },
},
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/only-throw-error": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-expressions": [
"error",
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
enforceForJSX: true,
},
],
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"@typescript-eslint/no-var-requires": "off",

/* react rules */
"react/display-name": "off",
"react/jsx-curly-brace-presence": ["error", { props: "never" }],
"react/no-deprecated": "warn",
"react/no-unescaped-entities": ["error", { forbid: [">", "}"] }],
"react/prop-types": "off",
"react/no-danger": "error",
"react/self-closing-comp": "error",
"react/function-component-definition": [
"error",
{
namedComponents: "arrow-function",
},
],

/* import rules */
"import/no-unassigned-import": "error",
"import/order": "off", // Use prettier for import order formatting
},
},
{
files: ["**/?(*.)+(test).ts?(x)"],
extends: [
jestPlugin.configs["flat/recommended"],
jestPlugin.configs["flat/style"],
],
rules: {
"jest/expect-expect": [
"warn",
{
assertFunctionNames: ["expect*"],
additionalTestBlockFunctions: [],
},
],
"jest/no-standalone-expect": [
"error",
{ additionalTestBlockFunctions: ["afterEach"] },
],
},
},
{
files: ["test/**/*"],
languageOptions: {
globals: jestPlugin.environments.globals.globals,
},
rules: {
"no-undef": "off",
"@typescript-eslint/no-unused-expressions": "off",
"react/jsx-curly-brace-presence": "off",
},
},
{
files: ["**/?(*.)+(test).tsx"],
extends: [
testingLibraryPlugin.configs["flat/react"],
jestDomPlugin.configs["flat/recommended"],
],
rules: {
"testing-library/prefer-user-event": "error",
},
},
{
files: ["src/mjml/*"],
rules: {
"react/function-component-definition": "off",
},
},
]);
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build-dist": "/bin/rm -rf dist && yarn build-cjs && yarn build-esm",
"build-cjs": "tsc -p tsconfig.json",
"build-esm": "tsc -p tsconfig-esm.json",
"lint": "eslint .",
"lint": "eslint",
"format": "prettier --write .",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"test-dist-skip-build": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config=jest-dist.config.mjs",
Expand All @@ -40,31 +40,30 @@
"prepare": "husky install"
},
"devDependencies": {
"@eslint/js": "^9.39.4",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^12.0.0",
"@semantic-release/npm": "^13.1.5",
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"@types/jest": "^29.5.14",
"@types/jest": "^30.0.0",
"@types/lodash.camelcase": "^4.3.9",
"@types/lodash.kebabcase": "^4.1.9",
"@types/lodash.upperfirst": "^4.3.9",
"@types/mjml": "^5.0.0",
"@types/node": "^22.19.0",
"@types/react": "^18.3",
"@types/react-dom": "^18.3",
"@typescript-eslint/eslint-plugin": "^8.59.2",
"@typescript-eslint/parser": "^8.59.2",
"del": "^6.0.0",
"eslint": "^8.57.1",
"eslint": "^9.39.4",
"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.7.0",
"jest": "^30.4.2",
"lodash.camelcase": "^4.3.0",
"lodash.upperfirst": "^4.3.1",
"mjml": "^5.0.1",
Expand All @@ -73,9 +72,10 @@
"react": "^18.3",
"react-dom": "^18.3",
"semantic-release": "^24.0.0",
"ts-jest": "^29.4.9",
"ts-jest": "^29.4.11",
"ts-node": "^10.9.2",
"typescript": "5.9.3"
"typescript": "5.9.3",
"typescript-eslint": "^8.59.2"
},
"peerDependencies": {
"mjml": "^5.0.0",
Expand Down
Loading