Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update react monorepo to v17 (major) #728

Merged
merged 6 commits into from
Dec 7, 2020
Merged
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
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,19 @@
"classnames": "2.2.6",
"clone-deep": "4.0.1",
"d3": "6.3.0",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.5",
"enzyme-to-json": "3.6.1",
"framer-motion": "2.9.5",
"immer": "8.0.0",
"mock-socket": "^9.0.3",
"node-sass": "4.14.1",
"prop-types": "15.7.2",
"query-string": "6.13.7",
"react": "16.14.0",
"react-dom": "16.14.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-ga": "3.3.0",
"react-redux": "7.2.2",
"react-router-dom": "5.2.0",
"react-scripts": "4.0.1",
"react-test-renderer": "16.14.0",
"react-test-renderer": "17.0.1",
"redux": "4.0.5",
"redux-devtools-extension": "2.13.8",
"redux-mock-store": "1.5.4",
Expand All @@ -92,6 +89,9 @@
"@types/react": "17.0.0",
"@types/react-dom": "17.0.0",
"eslint-config-prettier": "7.0.0",
"@wojtekmaj/enzyme-adapter-react-17": "0.1.1",
"enzyme": "3.11.0",
"enzyme-to-json": "3.6.1",
barrymcgee marked this conversation as resolved.
Show resolved Hide resolved
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jest": "24.1.3",
"eslint-plugin-jsx-a11y": "6.4.1",
Expand Down
1 change: 0 additions & 1 deletion src/app/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import cloneDeep from "clone-deep";

import defaultCharmIcon from "static/images/icons/default-charm-icon.svg";
Expand Down
1 change: 0 additions & 1 deletion src/components/App/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useSelector } from "react-redux";
import { BrowserRouter as Router, Route } from "react-router-dom";
import { QueryParamProvider } from "use-query-params";
Expand Down
1 change: 0 additions & 1 deletion src/components/App/App.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Provider } from "react-redux";
import configureStore from "redux-mock-store";
import { mount } from "enzyme";
Expand Down
2 changes: 1 addition & 1 deletion src/components/DonutChart/DonutChart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useEffect } from "react";
import { useRef, useEffect } from "react";
import * as d3 from "d3";

const DonutChart = ({ chartData }) => {
Expand Down
1 change: 0 additions & 1 deletion src/components/DonutChart/DonutChart.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { mount } from "enzyme";

import DonutChart from "./DonutChart";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ErrorBoundary/ErrorBoundary.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from "react";
import { Component } from "react";
import * as Sentry from "@sentry/browser";

export default class ErrorBoundary extends Component {
Expand Down
1 change: 0 additions & 1 deletion src/components/ErrorBoundary/ErrorBoundary.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { mount } from "enzyme";

import ErrorBoundary from "./ErrorBoundary";
Expand Down
1 change: 0 additions & 1 deletion src/components/Filter/Filter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import Button from "components/Button/Button";
import classNames from "classnames";

Expand Down
1 change: 0 additions & 1 deletion src/components/Filter/Filter.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { mount } from "enzyme";

import Filter from "./Filter";
Expand Down
2 changes: 0 additions & 2 deletions src/components/Header/Header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import "./_header.scss";

export default function Header({ children }) {
Expand Down
1 change: 0 additions & 1 deletion src/components/Header/Header.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { mount } from "enzyme";

import Header from "./Header";
Expand Down
2 changes: 1 addition & 1 deletion src/components/InfoPanel/InfoPanel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import { useState } from "react";
import { useParams } from "react-router-dom";

import Topology from "components/Topology/Topology";
Expand Down
1 change: 0 additions & 1 deletion src/components/InfoPanel/InfoPanel.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import configureStore from "redux-mock-store";
import { Provider } from "react-redux";
import { mount } from "enzyme";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout/Layout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import { useState } from "react";
import { useSelector, useStore } from "react-redux";
import { isLoggedIn, getWSControllerURL } from "app/selectors";
import Notification from "@canonical/react-components/dist/components/Notification/Notification";
Expand Down
1 change: 0 additions & 1 deletion src/components/Layout/Layout.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { BrowserRouter as Router } from "react-router-dom";
import { mount } from "enzyme";
import configureStore from "redux-mock-store";
Expand Down
2 changes: 1 addition & 1 deletion src/components/LogIn/LogIn.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from "react";
import { useEffect, useRef } from "react";
import { useDispatch, useSelector, useStore } from "react-redux";
import {
isLoggedIn,
Expand Down
1 change: 0 additions & 1 deletion src/components/LogIn/LogIn.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import configureStore from "redux-mock-store";
import { Provider } from "react-redux";
import { mount } from "enzyme";
Expand Down
1 change: 0 additions & 1 deletion src/components/Logo/Logo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useSelector } from "react-redux";

import { getConfig } from "app/selectors";
Expand Down
1 change: 0 additions & 1 deletion src/components/ModelTableList/CloudGroup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useSelector } from "react-redux";
import MainTable from "@canonical/react-components/dist/components/MainTable";
import {
Expand Down
1 change: 0 additions & 1 deletion src/components/ModelTableList/CloudGroup.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { MemoryRouter } from "react-router";
import { mount } from "enzyme";
import { Provider } from "react-redux";
Expand Down
1 change: 0 additions & 1 deletion src/components/ModelTableList/ModelTableList.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useSelector, useStore } from "react-redux";

import { getActiveUserTag, getWSControllerURL } from "app/selectors";
Expand Down
1 change: 0 additions & 1 deletion src/components/ModelTableList/ModelTableList.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import cloneDeep from "clone-deep";
import { MemoryRouter } from "react-router";
import { mount } from "enzyme";
Expand Down
1 change: 0 additions & 1 deletion src/components/ModelTableList/OwnerGroup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useSelector } from "react-redux";
import MainTable from "@canonical/react-components/dist/components/MainTable";
import { generateStatusElement, getModelStatusGroupData } from "app/utils";
Expand Down
1 change: 0 additions & 1 deletion src/components/ModelTableList/OwnerGroup.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { MemoryRouter } from "react-router";
import { mount } from "enzyme";
import { Provider } from "react-redux";
Expand Down
1 change: 0 additions & 1 deletion src/components/ModelTableList/StatusGroup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useSelector } from "react-redux";
import MainTable from "@canonical/react-components/dist/components/MainTable";

Expand Down
1 change: 0 additions & 1 deletion src/components/ModelTableList/StatusGroup.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { MemoryRouter } from "react-router";
import { mount } from "enzyme";
import { Provider } from "react-redux";
Expand Down
1 change: 0 additions & 1 deletion src/components/ModelTableList/shared.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Link } from "react-router-dom";
import { extractCloudName, extractCredentialName } from "app/utils";

Expand Down
2 changes: 1 addition & 1 deletion src/components/PrimaryNav/PrimaryNav.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import { useState, useEffect } from "react";
import { useSelector } from "react-redux";
import { NavLink, useLocation } from "react-router-dom";

Expand Down
1 change: 0 additions & 1 deletion src/components/PrimaryNav/PrimaryNav.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { MemoryRouter } from "react-router-dom";
import { mount } from "enzyme";
import configureStore from "redux-mock-store";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Routes/Routes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from "react";
import { useEffect } from "react";
import { Route, Redirect, Switch, useLocation } from "react-router-dom";

import Login from "components/LogIn/LogIn";
Expand Down
1 change: 0 additions & 1 deletion src/components/Routes/TestRoute.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Route } from "react-router-dom";

import { paths } from "./Routes";
Expand Down
1 change: 0 additions & 1 deletion src/components/SlidePanel/SlidePanel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import classnames from "classnames";
import Spinner from "@canonical/react-components/dist/components/Spinner";

Expand Down
1 change: 0 additions & 1 deletion src/components/SlidePanel/SlidePanel.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { shallow, mount } from "enzyme";

import SlidePanel from "./SlidePanel";
Expand Down
2 changes: 1 addition & 1 deletion src/components/StatusStrip/StatusStrip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import { useState, useEffect } from "react";
import { pluralize } from "app/utils";

import "./_status-strip.scss";
Expand Down
1 change: 0 additions & 1 deletion src/components/StatusStrip/StatusStrip.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { mount } from "enzyme";

import StatusStrip from "./StatusStrip";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Topology/Topology.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useEffect } from "react";
import { useRef, useEffect } from "react";
import * as d3 from "d3";

import { generateIconPath } from "app/utils";
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserMenu/UserMenu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from "react";
import { useEffect } from "react";
import { useSelector, useDispatch, useStore } from "react-redux";
import { Link, NavLink } from "react-router-dom";
import classNames from "classnames";
Expand Down
1 change: 0 additions & 1 deletion src/components/UserMenu/UserMenu.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { BrowserRouter as Router } from "react-router-dom";
import configureStore from "redux-mock-store";
import { Provider } from "react-redux";
Expand Down
2 changes: 1 addition & 1 deletion src/components/WebCLI/Output.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useRef, useState } from "react";
import { useEffect, useMemo, useRef, useState } from "react";

// Colors taken from the VSCode section of
// https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit
Expand Down
2 changes: 1 addition & 1 deletion src/components/WebCLI/WebCLI.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useRef, useState } from "react";
import { useEffect, useMemo, useRef, useState } from "react";

import useAnalytics from "../../hooks/useAnalytics";

Expand Down
1 change: 0 additions & 1 deletion src/components/WebCLI/WebCLI.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { mount } from "enzyme";
import { act } from "react-dom/test-utils";
import WS from "jest-websocket-mock";
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/AppsPanel/AppsPanel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo } from "react";
import { useMemo } from "react";
import { useSelector } from "react-redux";
import { getConfig } from "app/selectors";
import MainTable from "@canonical/react-components/dist/components/MainTable";
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/MachinesPanel/MachinesPanel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo, useCallback } from "react";
import { useMemo, useCallback } from "react";
import MainTable from "@canonical/react-components/dist/components/MainTable";
import cloneDeep from "clone-deep";

Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/UnitsPanel/UnitsPanel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo, useCallback } from "react";
import { useMemo, useCallback } from "react";
import MainTable from "@canonical/react-components/dist/components/MainTable";
import cloneDeep from "clone-deep";

Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import { StrictMode } from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { applyMiddleware, combineReducers, createStore } from "redux";
Expand Down Expand Up @@ -103,9 +103,9 @@ function bootstrap() {

ReactDOM.render(
<Provider store={reduxStore}>
<React.StrictMode>
<StrictMode>
<App />
</React.StrictMode>
</StrictMode>
</Provider>,
rootElement
);
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Controllers/ControllerChart/ControllerChart.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

import DonutChart from "components/DonutChart/DonutChart";

import { pluralize } from "app/utils";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { mount } from "enzyme";

import ControllerChart from "./ControllerChart";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useSelector } from "react-redux";

import {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Controllers/Controllers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import { useState } from "react";
import { useDispatch, useSelector, useStore } from "react-redux";
import { Link } from "react-router-dom";
import cloneDeep from "clone-deep";
Expand Down
1 change: 0 additions & 1 deletion src/pages/Controllers/Controllers.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import cloneDeep from "clone-deep";
import { mount } from "enzyme";
import { MemoryRouter } from "react-router";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Models/Details/ModelDetails.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useState, useCallback } from "react";
import { useEffect, useMemo, useState, useCallback } from "react";
import MainTable from "@canonical/react-components/dist/components/MainTable";
import Spinner from "@canonical/react-components/dist/components/Spinner";
import { useDispatch, useSelector, useStore } from "react-redux";
Expand Down
1 change: 0 additions & 1 deletion src/pages/Models/Details/ModelDetails.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import configureStore from "redux-mock-store";
import { Provider } from "react-redux";
import { mount } from "enzyme";
Expand Down
1 change: 0 additions & 1 deletion src/pages/Models/Details/generators.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { URL } from "@canonical/jaaslib/lib/urls";
import cloneDeep from "clone-deep";

Expand Down
1 change: 0 additions & 1 deletion src/pages/Models/Models.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { useSelector } from "react-redux";
import Spinner from "@canonical/react-components/dist/components/Spinner";

Expand Down
1 change: 0 additions & 1 deletion src/pages/Models/Models.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import configureStore from "redux-mock-store";
import { Provider } from "react-redux";
import { mount } from "enzyme";
Expand Down
1 change: 0 additions & 1 deletion src/pages/NotFound/NotFound.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Link } from "react-router-dom";

import Layout from "components/Layout/Layout";
Expand Down
1 change: 0 additions & 1 deletion src/pages/NotFound/NotFound.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import configureStore from "redux-mock-store";
import { Provider } from "react-redux";
import { mount } from "enzyme";
Expand Down
1 change: 0 additions & 1 deletion src/pages/Settings/Settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import Header from "components/Header/Header";
import Layout from "components/Layout/Layout";

Expand Down
2 changes: 1 addition & 1 deletion src/setupTests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { configure } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";

configure({ adapter: new Adapter() });

Expand Down
1 change: 0 additions & 1 deletion src/testing/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { shallow } from "enzyme";

/**
Expand Down
Loading