Skip to content

Commit 9056260

Browse files
authored
update dependencies (#1606)
* update most dependencies to latest version, added support for node 18 * large migration commit - migrate to material ui 5 - emotion ui was added as per mui recommendations (https://mui.com/material-ui/getting-started/installation/) - @material-ui/core, @material-ui/icons, @material-ui/lab removed - replaced with @mui/material, @mui/icons-material, @mui/lab - migrate to react router 6 - update and remove unused dev dependencies - redux-devtools-extension was deprecated in favor of @redux-devtools/extension - babel-eslint was deprecated in favor of @babel/eslint-parser - enzyme was removed as it was unused - fixed linter errors from updating eslint - many were fixed with `npm run lint:fixed` - manual fixes applied to Blog.jsx - `default-param-last`, `no-restricted-exports`, and `react/jsx-no-constructed-context-values` converted to warnings - react-day-picker was not updated due to breaking style changes * update readme * remove routechange.jsx * remove date-fns * revert date fns changes * update react-markdown to latest version compatible with react 17 * remove more unused dev dependencies Note: `npx depcheck` incorrectly indicates `eslint-import-resolver-node` and `eslint-import-resolver-node` as unused * update to latest react 17 * update workflow to use node 18
1 parent dabe776 commit 9056260

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+14346
-20178
lines changed

.eslintrc.js

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,58 @@ module.exports = {
44
es6: true,
55
node: true,
66
},
7-
extends: ["airbnb", "eslint:recommended", "plugin:react/recommended"],
7+
extends: ['airbnb', 'eslint:recommended', 'plugin:react/recommended'],
88
globals: {
9-
Atomics: "readonly",
10-
SharedArrayBuffer: "readonly",
9+
Atomics: 'readonly',
10+
SharedArrayBuffer: 'readonly',
1111
},
12-
parser: "babel-eslint",
12+
parser: '@babel/eslint-parser',
1313
parserOptions: {
1414
ecmaFeatures: {
1515
jsx: true,
1616
},
1717
ecmaVersion: 2018,
18-
sourceType: "module",
18+
sourceType: 'module',
1919
},
2020
settings: {
21-
"import/extensions": [".js", ".jsx"],
22-
"import/resolver": {
21+
'import/extensions': ['.js', '.jsx'],
22+
'import/resolver': {
2323
node: {},
24-
webpack: "webpack.config.js",
24+
webpack: 'webpack.config.js',
2525
},
2626
},
27-
plugins: ["react", "react-hooks"],
27+
plugins: ['react', 'react-hooks'],
2828
rules: {
29-
"linebreak-style": "off",
30-
"react-hooks/rules-of-hooks": "error",
31-
"react-hooks/exhaustive-deps": "warn",
32-
"arrow-parens": ["error", "as-needed"],
29+
'linebreak-style': 'off',
30+
'react-hooks/rules-of-hooks': 'error',
31+
'react-hooks/exhaustive-deps': 'warn',
32+
'arrow-parens': ['error', 'as-needed'],
3333
indent: [
34-
"error",
34+
'error',
3535
2,
3636
{
3737
SwitchCase: 1,
38-
MemberExpression: "off",
39-
ignoredNodes: ["TemplateLiteral"],
38+
MemberExpression: 'off',
39+
ignoredNodes: ['TemplateLiteral'],
4040
},
4141
],
42-
"template-curly-spacing": "off",
43-
"jsx-a11y/no-noninteractive-tabindex": [
44-
"error",
42+
'template-curly-spacing': 'off',
43+
'jsx-a11y/no-noninteractive-tabindex': [
44+
'error',
4545
{
4646
tags: [],
47-
roles: ["tabpanel"],
47+
roles: ['tabpanel'],
4848
},
4949
],
50-
"jsx-a11y/label-has-associated-control": [ 2, {
51-
"labelComponents": ["label"],
52-
"labelAttributes": ["htmlFor"],
53-
"controlComponents": ["input"]
50+
'jsx-a11y/label-has-associated-control': [2, {
51+
labelComponents: ['label'],
52+
labelAttributes: ['htmlFor'],
53+
controlComponents: ['input'],
5454
}],
55-
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }],
55+
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
56+
57+
'default-param-last': 'warn',
58+
'no-restricted-exports': 'warn',
59+
'react/jsx-no-constructed-context-values': 'warn',
5660
},
5761
};

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
# with:
2525
# python-version: '2.x'
2626

27-
- name: Use Node.js 12.x
27+
- name: Use Node.js 18.x
2828
uses: actions/setup-node@v3
2929
with:
30-
node-version: '12.x'
30+
node-version: '18.x'
3131

3232
- name: Install Packages
3333
run: npm ci

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ venv/
3939

4040
# archive
4141
/archive/aws/API\ Responses/*
42+
43+
.DS_Store

App.jsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@ import { getMetadataRequest } from '@reducers/metadata';
66

77
import Header from '@components/Header';
88
import Footer from '@components/Footer';
9-
import Routes from './Routes';
10-
import RouteChange from './components/main/util/RouteChange';
9+
import AppRoutes from './Routes';
1110

12-
const App = ({ getMetadata }) => {
11+
function App({ getMetadata }) {
1312
useEffect(() => {
1413
getMetadata();
1514
});
1615

1716
return (
1817
<HashRouter>
1918
<Header />
20-
<Routes />
19+
<AppRoutes />
2120
<Footer />
22-
<RouteChange />
2321
</HashRouter>
2422
);
25-
};
23+
}
2624

2725
const mapDispatchToProps = dispatch => ({
2826
getMetadata: () => dispatch(getMetadataRequest()),

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Our mission is to create a user-friendly platform for anyone interested in explo
2727
* React.js
2828
* Duckdb-wasm
2929
* Redux
30-
* Material-UI 4.x
30+
* Material-UI 5.x
3131

3232
### Data Analysis
3333

@@ -45,9 +45,9 @@ Our mission is to create a user-friendly platform for anyone interested in explo
4545

4646
## Quick Start
4747
* Ensure that node version manager (nvm) is installed (e.g. follow a [tutorial](https://heynode.com/tutorial/install-nodejs-locally-nvm/))
48-
* Run `nvm install lts/erbium` (on windows `nvm install erbium`)
49-
* Run `nvm use lts/erbium` (on windows `nvm use erbium`)
50-
* confirm you are using Node 12 by running `node -v` (e.g. `Now using node v12.22.12 (npm v6.14.16)`)
48+
* Run `nvm install lts/hydrogen` (on windows `nvm install hydrogen`)
49+
* Run `nvm use lts/hydrogen` (on windows `nvm use hydrogen`)
50+
* confirm you are using Node 18 by running `node -v` (e.g. `Now using node v18.7.0 (npm v8.9.2)`)
5151
* clone the repo
5252
* cd 311-data/
5353
* cp .example.env .env

Routes.jsx

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from 'react';
22
import {
3-
Switch, Route, Redirect, useLocation,
3+
Routes, Route, Navigate, useLocation,
44
} from 'react-router-dom';
5-
import { ThemeProvider } from '@material-ui/core/styles';
6-
import Paper from '@material-ui/core/Paper';
7-
import Box from '@material-ui/core/Box';
5+
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
6+
import Paper from '@mui/material/Paper';
7+
import Box from '@mui/material/Box';
88
import queryString from 'query-string';
99
import theme, { darkTheme } from '@theme/theme';
1010
import Desktop from '@components/main/Desktop';
@@ -17,42 +17,44 @@ import Research from '@components/main/Research';
1717
import Contact from '@components/contact/Contact';
1818
import ContentBottom from '@components/common/ContentBottom';
1919

20-
export default function Routes() {
20+
export default function AppRoutes() {
2121
const { pathname, search } = useLocation();
2222
const values = queryString.parse(search);
2323

2424
return (
2525
<>
2626
{/* Dark Theme - Map. */}
27-
<ThemeProvider theme={darkTheme}>
28-
<Paper elevation={0}>
29-
<Box visibility={pathname !== '/map' ? 'hidden' : 'visible'}>
30-
<Desktop initialState={values} />
31-
</Box>
32-
</Paper>
33-
</ThemeProvider>
27+
<StyledEngineProvider injectFirst>
28+
<ThemeProvider theme={darkTheme}>
29+
<Paper elevation={0}>
30+
<Box visibility={pathname !== '/map' ? 'hidden' : 'visible'}>
31+
<Desktop initialState={values} />
32+
</Box>
33+
</Paper>
34+
</ThemeProvider>
35+
</StyledEngineProvider>
3436

3537
{/* Default theme - Everything else. */}
36-
<ThemeProvider theme={theme}>
37-
<Paper elevation={0}>
38-
<Switch>
39-
<Route path="/dashboard-overview" component={DashboardOverview} />
40-
<Route
41-
path="/dashboard-comparison"
42-
component={DashboardComparison}
43-
/>
44-
<Route path="/privacy" component={Privacy} />
45-
<Route path="/faqs" component={Faqs} />
46-
<Route path="/research" component={Research} />
47-
<Route path="/about" component={About} />
48-
<Route path="/contact" component={Contact} />
49-
<Route path="/">
50-
<Redirect to={`map${search}`} />
51-
</Route>
52-
</Switch>
53-
<ContentBottom />
54-
</Paper>
55-
</ThemeProvider>
38+
<StyledEngineProvider injectFirst>
39+
<ThemeProvider theme={theme}>
40+
<Paper elevation={0}>
41+
<Routes>
42+
<Route path="/dashboard-overview" element={<DashboardOverview />} />
43+
<Route
44+
path="/dashboard-comparison"
45+
element={<DashboardComparison />}
46+
/>
47+
<Route path="/privacy" element={<Privacy />} />
48+
<Route path="/faqs" element={<Faqs />} />
49+
<Route path="/research" element={<Research />} />
50+
<Route path="/about" element={<About />} />
51+
<Route path="/contact" element={<Contact />} />
52+
<Route path="/" element={<Navigate to={`map${search}`} />} />
53+
</Routes>
54+
<ContentBottom />
55+
</Paper>
56+
</ThemeProvider>
57+
</StyledEngineProvider>
5658
</>
5759
);
5860
}

components/Dashboards/DashboardComparison.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ContentBody from '@components/common/ContentBody';
44
// import ddbh from '@utils/duckDbHelpers.js';
55
// import DbContext from '@db/DbContext';
66

7-
const DashboardComparison = () => {
7+
function DashboardComparison() {
88
const isMapLoading = useSelector(state => state.data.isMapLoading);
99

1010
if (isMapLoading) return null;
@@ -15,6 +15,6 @@ const DashboardComparison = () => {
1515
<h1>Welcome to the future of Dashboard Comparison</h1>
1616
</ContentBody>
1717
);
18-
};
18+
}
1919

2020
export default DashboardComparison;

components/Dashboards/layouts/QuadLayout.jsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { Grid } from '@material-ui/core';
3+
import { Grid } from '@mui/material';
44

5-
const QuadLayout = ({
5+
function QuadLayout({
66
quadrant1, quadrant2, quadrant3, quadrant4,
7-
}) => (
8-
<Grid container spacing={3}>
9-
<Grid item xs={12} sm={6} md={3}>
10-
{quadrant1}
7+
}) {
8+
return (
9+
<Grid container spacing={3}>
10+
<Grid item xs={12} sm={6} md={3}>
11+
{quadrant1}
12+
</Grid>
13+
<Grid item xs={12} sm={6} md={3}>
14+
{quadrant2}
15+
</Grid>
16+
<Grid item xs={12} sm={6} md={3}>
17+
{quadrant3}
18+
</Grid>
19+
<Grid item xs={12} sm={6} md={3}>
20+
{quadrant4}
21+
</Grid>
1122
</Grid>
12-
<Grid item xs={12} sm={6} md={3}>
13-
{quadrant2}
14-
</Grid>
15-
<Grid item xs={12} sm={6} md={3}>
16-
{quadrant3}
17-
</Grid>
18-
<Grid item xs={12} sm={6} md={3}>
19-
{quadrant4}
20-
</Grid>
21-
</Grid>
22-
);
23+
);
24+
}
2325

2426
QuadLayout.propTypes = {
2527
quadrant1: PropTypes.element.isRequired,

components/Dashboards/widgets/TotalByDayOfWeek.jsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
import React from 'react';
22
import PropTypes from 'proptypes';
33

4-
const TotalByDayOfWeek = ({ data }) => (
5-
<>
6-
<div>Total Requests by Day of The Week</div>
7-
{
4+
function TotalByDayOfWeek({ data }) {
5+
return (
6+
<>
7+
<div>Total Requests by Day of The Week</div>
8+
{
89
// Observable code goes here
910
// https://observablehq.com/d/8236de092b1f9523#cell-237
10-
}
11-
<ul>
12-
{data?.map(request => (
13-
<li key={request.SRNumber}>{request.SRNumber}</li>
14-
))}
15-
</ul>
16-
</>
17-
);
11+
}
12+
<ul>
13+
{data?.map(request => (
14+
<li key={request.SRNumber}>{request.SRNumber}</li>
15+
))}
16+
</ul>
17+
</>
18+
);
19+
}
1820

1921
TotalByDayOfWeek.propTypes = {
2022
data: PropTypes.arrayOf(PropTypes.shape({})).isRequired,

components/DateSelector/DateRanges.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
const DateRanges = ({
4+
function DateRanges({
55
options, onSelect, dates, classes,
6-
}) => {
6+
}) {
77
function highlightIfSelected(optionDays, selectedDays) {
88
if (dates.length > 0) {
99
const [from, to, start, end] = [
@@ -38,7 +38,7 @@ const DateRanges = ({
3838
: null}
3939
</div>
4040
);
41-
};
41+
}
4242

4343
const {
4444
func, arrayOf, shape, string,

0 commit comments

Comments
 (0)