Skip to content

Commit

Permalink
Update to support React 19 and support ESM projects (#813)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
WS-LewisScoging authored Feb 11, 2025
1 parent 2483062 commit b290c5f
Show file tree
Hide file tree
Showing 11 changed files with 18,452 additions and 5,438 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"plugin:react-hooks/recommended",
"plugin:jest/recommended"
],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
Expand Down
File renamed without changes.
83 changes: 83 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import react from "eslint-plugin-react";
import jest from "eslint-plugin-jest";
import globals from "globals";
import babelParser from "@babel/eslint-parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
...fixupConfigRules(
compat.extends(
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:jsx-a11y/recommended",
"plugin:react-hooks/recommended",
"plugin:jest/recommended"
)
),
{
plugins: {
react: fixupPluginRules(react),
jest: fixupPluginRules(jest),
},

languageOptions: {
globals: {
...globals.browser,
},

parser: babelParser,
ecmaVersion: 12,
sourceType: "module",

parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},

settings: {
react: {
version: "detect",
},

"import/resolver": {
alias: {
map: [["src", "./src"]],
extensions: [".ts", ".js", ".jsx", ".json"],
},
},
},

rules: {
"react/display-name": "off",
},
},
{
files: ["**/*.js", "**/*.jsx"],

rules: {
"prettier/prettier": [
"error",
{
trailingComma: "es5",
},
],
},
},
];
2 changes: 1 addition & 1 deletion jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
"^.+\\.(js|jsx)$": "babel-jest",
},
testMatch: ["**/__tests__/**/*.js?(x)", "**/?(*.)+(spec|test).js?(x)"], // File patterns for test files
setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], // Setup file to extend Jest with RTL matchers
setupFilesAfterEnv: ["@testing-library/jest-dom"], // Setup file to extend Jest with RTL matchers
moduleNameMapper: {
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
"^src/(.*)$": path.resolve(__dirname, "src/$1"), // Add the moduleNameMapper for your alias
Expand Down
Loading

0 comments on commit b290c5f

Please sign in to comment.