Skip to content

Commit b290c5f

Browse files
Update to support React 19 and support ESM projects (#813)
* Updating to support React 19, including necessary package updates * Adding esm export to build and changing current to explicit umd identifier * fixing accidentally commited local dev package dependency issue * fixing yarn.lock * Adding testing-library/dom to fix testing issue from library update
1 parent 2483062 commit b290c5f

File tree

11 files changed

+18452
-5438
lines changed

11 files changed

+18452
-5438
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"plugin:react-hooks/recommended",
1414
"plugin:jest/recommended"
1515
],
16-
"parser": "babel-eslint",
16+
"parser": "@babel/eslint-parser",
1717
"parserOptions": {
1818
"ecmaFeatures": {
1919
"jsx": true
File renamed without changes.

eslint.config.mjs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
2+
import react from "eslint-plugin-react";
3+
import jest from "eslint-plugin-jest";
4+
import globals from "globals";
5+
import babelParser from "@babel/eslint-parser";
6+
import path from "node:path";
7+
import { fileURLToPath } from "node:url";
8+
import js from "@eslint/js";
9+
import { FlatCompat } from "@eslint/eslintrc";
10+
11+
const __filename = fileURLToPath(import.meta.url);
12+
const __dirname = path.dirname(__filename);
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
allConfig: js.configs.all,
17+
});
18+
19+
export default [
20+
...fixupConfigRules(
21+
compat.extends(
22+
"eslint:recommended",
23+
"plugin:react/recommended",
24+
"plugin:prettier/recommended",
25+
"plugin:import/errors",
26+
"plugin:import/warnings",
27+
"plugin:jsx-a11y/recommended",
28+
"plugin:react-hooks/recommended",
29+
"plugin:jest/recommended"
30+
)
31+
),
32+
{
33+
plugins: {
34+
react: fixupPluginRules(react),
35+
jest: fixupPluginRules(jest),
36+
},
37+
38+
languageOptions: {
39+
globals: {
40+
...globals.browser,
41+
},
42+
43+
parser: babelParser,
44+
ecmaVersion: 12,
45+
sourceType: "module",
46+
47+
parserOptions: {
48+
ecmaFeatures: {
49+
jsx: true,
50+
},
51+
},
52+
},
53+
54+
settings: {
55+
react: {
56+
version: "detect",
57+
},
58+
59+
"import/resolver": {
60+
alias: {
61+
map: [["src", "./src"]],
62+
extensions: [".ts", ".js", ".jsx", ".json"],
63+
},
64+
},
65+
},
66+
67+
rules: {
68+
"react/display-name": "off",
69+
},
70+
},
71+
{
72+
files: ["**/*.js", "**/*.jsx"],
73+
74+
rules: {
75+
"prettier/prettier": [
76+
"error",
77+
{
78+
trailingComma: "es5",
79+
},
80+
],
81+
},
82+
},
83+
];

jest.config.js renamed to jest.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
"^.+\\.(js|jsx)$": "babel-jest",
88
},
99
testMatch: ["**/__tests__/**/*.js?(x)", "**/?(*.)+(spec|test).js?(x)"], // File patterns for test files
10-
setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], // Setup file to extend Jest with RTL matchers
10+
setupFilesAfterEnv: ["@testing-library/jest-dom"], // Setup file to extend Jest with RTL matchers
1111
moduleNameMapper: {
1212
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
1313
"^src/(.*)$": path.resolve(__dirname, "src/$1"), // Add the moduleNameMapper for your alias

0 commit comments

Comments
 (0)