From 517fd0a5685081e000fd21fc9c2bdf004d4ae039 Mon Sep 17 00:00:00 2001 From: YASHMAHAKAL Date: Fri, 10 Apr 2026 02:49:51 +0530 Subject: [PATCH 1/4] fix: restore npm run dev Signed-off-by: YASHMAHAKAL --- eslint.config.js | 54 ++++++++++++++++++++++++++++ examples/Router/index.js | 76 ++++++++++++++++++---------------------- index.html | 1 - package-lock.json | 14 ++++++++ package.json | 9 ++--- webpack.config.js | 39 +++++---------------- 6 files changed, 116 insertions(+), 77 deletions(-) create mode 100644 eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..7b8622f --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,54 @@ +const pluginReact = require('eslint-plugin-react'); +const pluginJsxA11y = require('eslint-plugin-jsx-a11y'); +const pluginReactHooks = require('eslint-plugin-react-hooks'); +const globals = require('globals'); + +module.exports = [ + { + files: ['src/**/*.{js,jsx}'], + languageOptions: { + ecmaVersion: 2020, + sourceType: 'module', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + globals: { + ...globals.browser, + ...globals.node, + ...globals.mocha, + ...globals.es2020, + }, + }, + settings: { + react: { + version: 'detect', + }, + }, + plugins: { + react: pluginReact, + 'jsx-a11y': pluginJsxA11y, + 'react-hooks': pluginReactHooks, + }, + rules: { + ...pluginJsxA11y.configs.recommended.rules, + 'no-console': 'off', + semi: 2, + 'no-undef': 2, + 'no-undef-init': 2, + 'no-tabs': 2, + 'react/self-closing-comp': 2, + 'react/no-typos': 2, + 'react/jsx-no-duplicate-props': 'warn', + 'react-hooks/rules-of-hooks': 'error', + 'react-hooks/exhaustive-deps': 'warn', + 'jsx-a11y/no-autofocus': [ + 2, + { + ignoreNonDOM: true, + }, + ], + }, + }, +]; diff --git a/examples/Router/index.js b/examples/Router/index.js index b5e9a6e..7e18176 100644 --- a/examples/Router/index.js +++ b/examples/Router/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; -import { HashRouter as Router, Route, Switch, withRouter } from 'react-router-dom'; +import { HashRouter as Router, Route, Routes, useNavigate, useLocation } from 'react-router-dom'; import { withStyles } from 'tss-react/mui'; import ExamplesGrid from './ExamplesGrid'; import examples from '../examples'; @@ -17,58 +17,52 @@ const styles = { }, }; -class Examples extends React.Component { - returnHome = () => { - this.props.history.push('/'); - }; +function Examples({ classes }) { + const navigate = useNavigate(); + const location = useLocation(); - render() { - const { classes } = this.props; + const defaultTheme = createTheme(); + const returnHomeStyle = { padding: '0px', margin: '20px 0 20px 0' }; - var returnHomeStyle = { padding: '0px', margin: '20px 0 20px 0' }; - - const defaultTheme = createTheme(); - - return ( - -
-
- - } /> - {Object.keys(examples).map((label, index) => ( - - ))} - -
- {this.props.location.pathname !== '/' && ( -
- -
- )} -
+ return ( + +
+
+ + } /> + {Object.keys(examples).map((label, index) => ( + + ))} + +
+ {location.pathname !== '/' && ( +
+ +
+ )}
-
-
- ); - } +
+
+
+ ); } -const StyledExamples = withRouter(withStyles(Examples, styles)); +const StyledExamples = withStyles(Examples, styles); function App() { return ( - + ); } + const container = document.getElementById('app-root'); const root = createRoot(container); root.render(); diff --git a/index.html b/index.html index 8b38f93..e431198 100755 --- a/index.html +++ b/index.html @@ -9,6 +9,5 @@
- diff --git a/package-lock.json b/package-lock.json index ec34eb7..e8eb8c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,6 +63,7 @@ "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^7.0.1", "eslint-webpack-plugin": "^5.0.3", + "globals": "^17.4.0", "html-webpack-plugin": "^5.6.6", "ignore-styles": "^5.0.1", "jsdom": "^29.0.1", @@ -8955,6 +8956,19 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/globals": { + "version": "17.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.4.0.tgz", + "integrity": "sha512-hjrNztw/VajQwOLsMNT1cbJiH2muO3OROCHnbehc8eY5JyD2gqz4AcMHPqgaOR59DjgUjYAYLeH699g/eWi2jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globalthis": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", diff --git a/package.json b/package.json index 09ea57a..3ac1aeb 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dist" ], "scripts": { - "dev": "cross-env NODE_ENV=development webpack-dev-server -d --progress --colors", + "dev": "cross-env NODE_ENV=development webpack-dev-server --progress --color", "test": "cross-env NODE_ENV=test mocha --require ./test/babel-register.js --extensions js,jsx test/**/*.test.js", "docs:dev": "next docs", "docs:build": "cross-env NODE_ENV=production next build docs", @@ -38,12 +38,13 @@ "homepage": "https://github.com/layer5io/mui-datatables#readme", "devDependencies": { "@babel/core": "^7.29.0", + "@babel/eslint-parser": "^7.27.1", "@babel/plugin-external-helpers": "^7.27.1", + "@babel/plugin-transform-async-to-generator": "^7.28.6", "@babel/plugin-transform-class-properties": "^7.25.9", "@babel/plugin-transform-nullish-coalescing-operator": "^7.26.6", "@babel/plugin-transform-object-rest-spread": "^7.25.9", "@babel/plugin-transform-optional-chaining": "^7.25.9", - "@babel/plugin-transform-async-to-generator": "^7.28.6", "@babel/plugin-transform-runtime": "^7.29.0", "@babel/preset-env": "^7.29.2", "@babel/preset-react": "^7.28.5", @@ -58,7 +59,6 @@ "@rollup/plugin-commonjs": "^29.0.2", "@rollup/plugin-node-resolve": "^16.0.3", "@rollup/plugin-replace": "^6.0.3", - "@babel/eslint-parser": "^7.27.1", "babel-loader": "^10.1.1", "babel-plugin-istanbul": "^7.0.1", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", @@ -68,12 +68,13 @@ "css-loader": "^7.1.4", "enzyme": "^3.11.0", "eslint": "^10.1.0", - "eslint-webpack-plugin": "^5.0.3", "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-import": "^2.32.0", "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^7.0.1", + "eslint-webpack-plugin": "^5.0.3", + "globals": "^17.4.0", "html-webpack-plugin": "^5.6.6", "ignore-styles": "^5.0.1", "jsdom": "^29.0.1", diff --git a/webpack.config.js b/webpack.config.js index fec9b0f..042c4be 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,28 +1,23 @@ const path = require('path'); const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); -const ESLintPlugin = require('eslint-webpack-plugin'); module.exports = { + mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', entry: { app: ['core-js/stable', 'regenerator-runtime/runtime', './examples/Router/index.js'], }, - stats: 'verbose', + stats: 'errors-warnings', context: __dirname, output: { filename: 'bundle.js', }, devtool: 'source-map', - resolve: { - mainFields: ['browser', 'module', 'main'], - }, devServer: { - disableHostCheck: true, + allowedHosts: 'all', host: 'localhost', hot: true, - inline: true, port: process.env.PORT || 5050, - stats: 'errors-warnings', }, module: { rules: [ @@ -31,23 +26,6 @@ module.exports = { exclude: /node_modules/, use: ['babel-loader'], }, - { - test: /\.(js|jsx)$/, - include: /node_modules\/(@mui|@emotion)\//, - use: { - loader: 'babel-loader', - options: { - presets: [ - ['@babel/preset-env', { modules: 'commonjs' }], - '@babel/preset-react', - ], - plugins: [ - '@babel/plugin-transform-optional-chaining', - '@babel/plugin-transform-nullish-coalescing-operator', - ], - }, - }, - }, { test: /\.css$/i, use: ['style-loader', 'css-loader'], @@ -55,13 +33,12 @@ module.exports = { ], }, plugins: [ - new ESLintPlugin({ extensions: ['js', 'jsx'] }), - new webpack.HotModuleReplacementPlugin(), - new webpack.NamedModulesPlugin(), + new HtmlWebpackPlugin({ + template: './index.html', + inject: true, + }), new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: JSON.stringify('development'), - }, + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), }), ], }; From 719c7173f1c190daf9877c60cf67005fc56a309f Mon Sep 17 00:00:00 2001 From: YASHMAHAKAL Date: Fri, 10 Apr 2026 03:34:24 +0530 Subject: [PATCH 2/4] reverted index.html Signed-off-by: YASHMAHAKAL --- index.html | 1 + webpack.config.js | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index e431198..8b38f93 100755 --- a/index.html +++ b/index.html @@ -9,5 +9,6 @@
+ diff --git a/webpack.config.js b/webpack.config.js index 042c4be..8279e40 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,5 @@ const path = require('path'); const webpack = require('webpack'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', @@ -14,6 +13,7 @@ module.exports = { }, devtool: 'source-map', devServer: { + static: { directory: path.resolve(__dirname) }, allowedHosts: 'all', host: 'localhost', hot: true, @@ -33,10 +33,6 @@ module.exports = { ], }, plugins: [ - new HtmlWebpackPlugin({ - template: './index.html', - inject: true, - }), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), }), From f7c2dcc3b209c83ac1396f871f844c62f22486c2 Mon Sep 17 00:00:00 2001 From: YASHMAHAKAL Date: Fri, 10 Apr 2026 03:45:43 +0530 Subject: [PATCH 3/4] deleted .eslintrc Signed-off-by: YASHMAHAKAL --- .eslintrc | 66 ------------------------------------------------ eslint.config.js | 2 +- 2 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 .eslintrc diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index fbbfab1..0000000 --- a/.eslintrc +++ /dev/null @@ -1,66 +0,0 @@ -{ - "parser": "@babel/eslint-parser", - "settings": { - "react": { - "version": "latest" - }, - "import/extensions": [ - ".js" - ], - "import/parser": "@babel/eslint-parser", - "import/resolver": { - "node": { - "extensions": [ - ".js" - ] - }, - "webpack": { - "config": "webpack.config.js" - } - } - }, - "parserOptions": { - "requireConfigFile": false, - "ecmaVersion": 6, - "sourceType": "module", - "allowImportExportEverywhere": true, - "ecmaFeatures": { - "jsx": true, - "experimentalObjectRestSpread": true - } - }, - "env": { - "es6": true, - "browser": true, - "mocha": true, - "node": true - }, - "extends": [ - "plugin:jsx-a11y/recommended" - ], - "rules": { - "no-console": "off", - "semi": 2, - "no-undef": 2, - "no-undef-init": 2, - "no-tabs": 2, - "react/self-closing-comp": 2, - "react/no-typos": 2, - "react/jsx-no-duplicate-props": "warn", - "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "warn", - "jsx-a11y/no-autofocus": [ - 2, - { - "ignoreNonDOM": true - } - ] - }, - "plugins": [ - "import", - "react", - "jsx-a11y", - "filenames", - "react-hooks" - ] -} diff --git a/eslint.config.js b/eslint.config.js index 7b8622f..dc032ff 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -23,7 +23,7 @@ module.exports = [ }, settings: { react: { - version: 'detect', + version: 'latest', }, }, plugins: { From 6ef80ea0d4eba02e8492623ce40024c6304c7b59 Mon Sep 17 00:00:00 2001 From: YASHMAHAKAL Date: Fri, 10 Apr 2026 04:06:29 +0530 Subject: [PATCH 4/4] update eslint config Signed-off-by: YASHMAHAKAL --- eslint.config.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eslint.config.js b/eslint.config.js index dc032ff..42f6a21 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -5,7 +5,10 @@ const globals = require('globals'); module.exports = [ { - files: ['src/**/*.{js,jsx}'], + ignores: ['dist/**', 'build/**', 'coverage/**', 'docs/**'], + }, + { + files: ['src/**/*.{js,jsx}', 'examples/**/*.{js,jsx}', 'test/**/*.{js,jsx}', '*.js'], languageOptions: { ecmaVersion: 2020, sourceType: 'module',