From 3e844019534912609e38cb546fa3e2b57f7279f6 Mon Sep 17 00:00:00 2001 From: E-Liang Tan Date: Sat, 31 Oct 2020 10:11:39 +0800 Subject: [PATCH] Upgrade to React 17 and new JSX transform (#2935) --- website/.eslintrc.js | 3 + website/babel.config.js | 11 +- website/package.json | 8 +- website/scripts/test.js | 2 +- website/src/__mocks__/svgMock.tsx | 2 - website/src/entry/App.tsx | 2 +- website/src/entry/export/TimetableOnly.tsx | 4 +- website/src/entry/export/main.tsx | 4 +- website/src/entry/main.tsx | 1 - website/src/utils/react.test.tsx | 8 +- website/src/views/AppShell.tsx | 2 +- .../src/views/components/ColorPicker.test.tsx | 1 - website/src/views/components/ColorPicker.tsx | 4 +- website/src/views/components/ExternalLink.tsx | 19 +-- .../views/components/LinkModuleCodes.test.tsx | 1 - website/src/views/components/Online.test.tsx | 1 - website/src/views/components/RandomKawaii.tsx | 2 +- .../src/views/components/ScrollToTop.test.tsx | 1 - website/src/views/components/ScrollToTop.tsx | 4 +- .../src/views/components/SearchBox.test.tsx | 1 - .../views/components/SearchkitSearchBox.tsx | 1 - .../src/views/components/SemesterBadge.tsx | 2 +- website/src/views/components/Title.tsx | 2 +- .../src/views/components/Tooltip/Tooltip.tsx | 2 +- .../src/views/components/Tooltip/index.tsx | 2 +- .../components/disqus/CommentCount.test.tsx | 1 - .../views/components/disqus/CommentCount.tsx | 3 +- .../components/disqus/DisqusComments.tsx | 4 +- .../views/components/filters/CheckboxItem.tsx | 2 +- .../filters/CheckboxItemFilter.test.tsx | 1 - .../components/filters/CheckboxItemFilter.tsx | 2 +- .../components/filters/ChecklistFilter.tsx | 4 +- .../filters/DropdownListFilters.test.tsx | 1 - .../filters/DropdownListFilters.tsx | 3 +- .../components/filters/FilterContainer.tsx | 2 +- .../views/components/icons/weather.test.ts | 2 +- .../src/views/components/map/ArrivalTimes.tsx | 4 +- website/src/views/components/map/BusStops.tsx | 4 +- .../src/views/components/map/ExpandMap.tsx | 4 +- .../src/views/components/map/LocationMap.tsx | 2 +- .../src/views/components/map/MapContext.ts | 4 +- .../components/map/withVenueLocations.tsx | 2 +- .../module-info/AddModuleDropdown.test.tsx | 1 - .../module-info/AddModuleDropdown.tsx | 4 +- .../module-info/ModuleExamClash.test.tsx | 1 - .../module-info/ModuleSemesterInfo.tsx | 4 +- .../module-info/ModuleWorkload.test.tsx | 1 - .../components/module-info/SemesterPicker.tsx | 4 +- .../components/notfications/Announcements.tsx | 2 +- .../notfications/HacktoberfestBanner.tsx | 4 +- .../views/components/searchkit/Pagination.tsx | 2 +- .../SemesterSwitcher.test.tsx | 1 - .../semester-switcher/SemesterSwitcher.tsx | 4 +- .../ContributeContainer.tsx | 8 +- .../contribute/ContributeContainer/index.tsx | 2 - .../views/contribute/UnmappedVenues.test.tsx | 1 - .../src/views/contribute/UnmappedVenues.tsx | 4 +- .../src/views/errors/ModuleFinderApiError.tsx | 2 +- .../src/views/errors/ModuleFinderNoHits.tsx | 2 +- .../views/errors/ModuleNotFoundPage.test.tsx | 1 - .../src/views/errors/ModuleNotFoundPage.tsx | 4 +- website/src/views/errors/Warning.test.tsx | 1 - website/src/views/hooks/useCurrentTime.tsx | 8 +- .../src/views/hooks/useGlobalDebugValue.ts | 6 +- website/src/views/layout/Footer.test.tsx | 1 - website/src/views/layout/GlobalSearch.tsx | 8 +- .../layout/GlobalSearchContainer.test.tsx | 1 - .../views/layout/GlobalSearchContainer.tsx | 4 +- website/src/views/layout/Navtabs.test.tsx | 1 - website/src/views/layout/NoFooter.tsx | 2 +- .../modules/ModuleArchiveContainer.test.tsx | 1 - .../ModuleFinderContainer.tsx | 2 +- .../modules/ModuleFinderContainer/index.tsx | 1 - .../src/views/modules/ModuleFinderItem.tsx | 2 +- .../views/modules/ModuleFinderPager.test.tsx | 1 - .../modules/ModuleFinderPagerButton.test.tsx | 1 - .../views/modules/ModuleFinderPagerButton.tsx | 2 +- .../src/views/modules/ModuleFinderSidebar.tsx | 11 +- .../modules/ModulePageContainer.test.tsx | 1 - .../views/modules/ModulePageContent.test.tsx | 1 - .../src/views/modules/ModulePageContent.tsx | 4 +- website/src/views/modules/ModuleTree.test.tsx | 1 - website/src/views/modules/ReportError.tsx | 15 +- website/src/views/planner/AddModule.tsx | 2 +- website/src/views/planner/ModuleMenu.tsx | 4 +- .../PlannerContainer/PlannerContainer.tsx | 4 +- .../views/planner/PlannerContainer/index.tsx | 1 - website/src/views/planner/PlannerModule.tsx | 6 +- .../src/views/planner/PlannerModuleSelect.tsx | 4 +- website/src/views/planner/PlannerYear.tsx | 4 +- website/src/views/settings/BetaToggle.tsx | 4 +- website/src/views/settings/RefreshPrompt.tsx | 6 +- .../src/views/settings/SettingsContainer.tsx | 8 +- website/src/views/static/TeamContainer.tsx | 2 +- website/src/views/tetris/ScrollingNumber.tsx | 6 +- .../tetris/TetrisGame.integration.test.tsx | 1 - website/src/views/tetris/TetrisGame.tsx | 6 +- .../src/views/timetable/ExamCalendar.test.tsx | 1 - website/src/views/timetable/ExamCalendar.tsx | 4 +- website/src/views/timetable/ExamWeek.test.tsx | 1 - website/src/views/timetable/ExamWeek.tsx | 2 +- website/src/views/timetable/ExportMenu.tsx | 4 +- .../views/timetable/ModuleTombstone.test.tsx | 1 - .../views/timetable/ModulesSelect.test.tsx | 1 - website/src/views/timetable/ModulesSelect.tsx | 4 +- .../timetable/ModulesSelectContainer.tsx | 4 +- .../views/timetable/ShareTimetable.test.tsx | 1 - .../views/timetable/TimetableCell.test.tsx | 1 - website/src/views/timetable/TimetableCell.tsx | 2 +- .../timetable/TimetableContainer.test.tsx | 1 - .../views/timetable/TimetableContainer.tsx | 4 +- .../timetable/TimetableModuleTable.test.tsx | 1 - website/src/views/today/DayHeader.test.tsx | 1 - website/src/views/today/EmptyLessonGroup.tsx | 2 +- .../today/EventMapInline/EventMapInline.tsx | 2 +- .../TodayContainer/TodayContainer.test.tsx | 1 - .../src/views/today/TodayContainer/index.tsx | 1 - .../venues/VenueLocation/FeedbackModal.tsx | 4 +- .../venues/VenueLocation/VenueLocation.tsx | 4 +- .../src/views/venues/VenuesContainer.test.tsx | 1 - website/src/views/venues/VenuesContainer.tsx | 4 +- website/tsconfig.json | 2 +- website/yarn.lock | 147 ++++++++++-------- 123 files changed, 254 insertions(+), 267 deletions(-) diff --git a/website/.eslintrc.js b/website/.eslintrc.js index c6b0782e65..f5b6ff24a0 100644 --- a/website/.eslintrc.js +++ b/website/.eslintrc.js @@ -83,6 +83,9 @@ module.exports = { 'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks 'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies + // Unnecessary with JSX transform + 'react/react-in-jsx-scope': 'off', + // TODO: Replace divs with buttons, but remove all button styling. 'jsx-a11y/no-static-element-interactions': 'off', diff --git a/website/babel.config.js b/website/babel.config.js index 8ac8929a75..6ed687ebcf 100644 --- a/website/babel.config.js +++ b/website/babel.config.js @@ -21,7 +21,16 @@ module.exports = (api) => { exclude: ['transform-typeof-symbol'], }, ], - ['@babel/preset-react', { development: !IS_PROD }], + [ + '@babel/preset-react', + { + development: !IS_PROD, + // Enable JSX transform + // TODO: Remove in Babel 8, when this will be the default option + // See: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#manual-babel-setup + runtime: 'automatic', + }, + ], ]; const plugins = [ diff --git a/website/package.json b/website/package.json index ac15dae8e7..fc325033f5 100644 --- a/website/package.json +++ b/website/package.json @@ -34,7 +34,7 @@ "@babel/preset-env": "7.12.1", "@babel/preset-react": "7.12.1", "@babel/preset-typescript": "7.12.1", - "@hot-loader/react-dom": "16.14.0", + "@hot-loader/react-dom": "17.0.0", "@packtracker/webpack-plugin": "2.3.0", "@svgr/webpack": "5.4.0", "@types/classnames": "2.2.11", @@ -62,6 +62,7 @@ "@types/webpack-env": "1.15.3", "@typescript-eslint/eslint-plugin": "4.6.0", "@typescript-eslint/parser": "4.6.0", + "@wojtekmaj/enzyme-adapter-react-17": "0.2.0", "babel-jest": "26.5.2", "babel-loader": "8.1.0", "babel-plugin-dynamic-import-node": "2.3.3", @@ -78,7 +79,6 @@ "css-loader": "3.6.0", "cssnano": "4.1.10", "enzyme": "3.11.0", - "enzyme-adapter-react-16": "1.15.5", "enzyme-to-json": "3.6.1", "eslint": "7.12.1", "eslint-config-airbnb": "18.2.0", @@ -151,9 +151,9 @@ "no-scroll": "2.1.1", "nusmoderator": "3.0.0", "query-string": "5.0.0", - "react": "16.14.0", + "react": "17.0.1", "react-beautiful-dnd": "13.0.0", - "react-dom": "16.14.0", + "react-dom": "17.0.1", "react-feather": "2.0.8", "react-helmet": "6.1.0", "react-hot-loader": "4.13.0", diff --git a/website/scripts/test.js b/website/scripts/test.js index a6452a0f72..4244857212 100644 --- a/website/scripts/test.js +++ b/website/scripts/test.js @@ -1,6 +1,6 @@ const { configure } = require('enzyme'); const { setAutoFreeze } = require('immer'); -const Adapter = require('enzyme-adapter-react-16'); +const Adapter = require('@wojtekmaj/enzyme-adapter-react-17'); configure({ adapter: new Adapter() }); diff --git a/website/src/__mocks__/svgMock.tsx b/website/src/__mocks__/svgMock.tsx index f97b8f4557..ef93a55695 100644 --- a/website/src/__mocks__/svgMock.tsx +++ b/website/src/__mocks__/svgMock.tsx @@ -1,3 +1 @@ -import * as React from 'react'; - module.exports = () => ; diff --git a/website/src/entry/App.tsx b/website/src/entry/App.tsx index dbb6bc3475..6f6d1b1320 100644 --- a/website/src/entry/App.tsx +++ b/website/src/entry/App.tsx @@ -2,7 +2,7 @@ import { Store } from 'redux'; import { State } from 'types/state'; import { Persistor } from 'storage/persistReducer'; -import React from 'react'; +import * as React from 'react'; import { hot } from 'react-hot-loader/root'; import { BrowserRouter as Router } from 'react-router-dom'; import { Provider } from 'react-redux'; diff --git a/website/src/entry/export/TimetableOnly.tsx b/website/src/entry/export/TimetableOnly.tsx index a9105074d8..03f8dcfca6 100644 --- a/website/src/entry/export/TimetableOnly.tsx +++ b/website/src/entry/export/TimetableOnly.tsx @@ -1,5 +1,5 @@ import { Store } from 'redux'; -import * as React from 'react'; +import { Component } from 'react'; import { MemoryRouter } from 'react-router-dom'; import { Provider } from 'react-redux'; @@ -20,7 +20,7 @@ type State = { colors: ColorMapping; }; -export default class TimetableOnly extends React.Component { +export default class TimetableOnly extends Component { state = { semester: 1, timetable: {}, diff --git a/website/src/entry/export/main.tsx b/website/src/entry/export/main.tsx index ad83db1e3d..50780d26ae 100644 --- a/website/src/entry/export/main.tsx +++ b/website/src/entry/export/main.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { createRef } from 'react'; import ReactDOM from 'react-dom'; import { Store } from 'redux'; @@ -27,7 +27,7 @@ const { store } = configureStore(); window.store = store; // For Puppeteer to import data -const timetableRef = React.createRef(); +const timetableRef = createRef(); window.setData = function setData(modules, data, callback) { const { semester, timetable, colors } = data; diff --git a/website/src/entry/main.tsx b/website/src/entry/main.tsx index eb146b829c..5d6499d04a 100644 --- a/website/src/entry/main.tsx +++ b/website/src/entry/main.tsx @@ -6,7 +6,6 @@ import 'bootstrapping/sentry'; // See: https://github.com/zloirock/core-js/issues/579#issuecomment-504325213 import 'core-js/es/promise/finally'; -import React from 'react'; import ReactDOM from 'react-dom'; import ReactModal from 'react-modal'; diff --git a/website/src/utils/react.test.tsx b/website/src/utils/react.test.tsx index 97d87b3f95..00eb86d9ea 100644 --- a/website/src/utils/react.test.tsx +++ b/website/src/utils/react.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { Component, PureComponent } from 'react'; import { render } from 'enzyme'; import { highlight, wrapComponentName, Counter } from './react'; @@ -32,9 +32,9 @@ describe(highlight, () => { describe('wrapComponentName()', () => { /* eslint-disable react/prefer-stateless-function */ - class TestComponent extends React.Component {} - class TestPureComponent extends React.PureComponent {} - class TestComponentWithDisplayName extends React.Component { + class TestComponent extends Component {} + class TestPureComponent extends PureComponent {} + class TestComponentWithDisplayName extends Component { static displayName = 'TestComponentName'; } const FunctionalComponent = () => null; diff --git a/website/src/views/AppShell.tsx b/website/src/views/AppShell.tsx index 4e67b5d66e..7dd461e1fb 100644 --- a/website/src/views/AppShell.tsx +++ b/website/src/views/AppShell.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { SemTimetableConfig, TimetableConfig } from 'types/timetables'; import { ModuleList, NotificationOptions } from 'types/reducers'; import { Semester } from 'types/modules'; diff --git a/website/src/views/components/ColorPicker.test.tsx b/website/src/views/components/ColorPicker.test.tsx index 0788d62729..d4dfe6724e 100644 --- a/website/src/views/components/ColorPicker.test.tsx +++ b/website/src/views/components/ColorPicker.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { mount, ReactWrapper } from 'enzyme'; import ColorPicker from 'views/components/ColorPicker'; import { ColorIndex } from 'types/timetables'; diff --git a/website/src/views/components/ColorPicker.tsx b/website/src/views/components/ColorPicker.tsx index 9742ee022b..12e5f5efc5 100644 --- a/website/src/views/components/ColorPicker.tsx +++ b/website/src/views/components/ColorPicker.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { memo } from 'react'; import classnames from 'classnames'; import Downshift, { ChildrenFunction } from 'downshift'; import _ from 'lodash'; @@ -20,7 +20,7 @@ type Props = { * * For use in places like changing module colors */ -const ColorPicker = React.memo((props) => { +const ColorPicker = memo((props) => { const renderColorPicker: ChildrenFunction = ({ getToggleButtonProps, getItemProps, diff --git a/website/src/views/components/ExternalLink.tsx b/website/src/views/components/ExternalLink.tsx index 48d3de0f47..3c2f9336b8 100644 --- a/website/src/views/components/ExternalLink.tsx +++ b/website/src/views/components/ExternalLink.tsx @@ -1,15 +1,16 @@ -import React, { ReactNode } from 'react'; +import { AnchorHTMLAttributes, forwardRef, ReactNode } from 'react'; -type Props = React.AnchorHTMLAttributes & { href: string; children: ReactNode }; +type Props = AnchorHTMLAttributes & { + href: string; + children: ReactNode; +}; // Renders an anchor tag that safely opens href in a new tab or window. // See https://mathiasbynens.github.io/rel-noopener/ -const ExternalLink = React.forwardRef( - ({ children, ...otherProps }, ref) => ( - - {children} - - ), -); +const ExternalLink = forwardRef(({ children, ...otherProps }, ref) => ( + + {children} + +)); export default ExternalLink; diff --git a/website/src/views/components/LinkModuleCodes.test.tsx b/website/src/views/components/LinkModuleCodes.test.tsx index 043eacb549..7960399e34 100644 --- a/website/src/views/components/LinkModuleCodes.test.tsx +++ b/website/src/views/components/LinkModuleCodes.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { MemoryRouter } from 'react-router-dom'; import { mount } from 'enzyme'; import { entries } from 'lodash'; diff --git a/website/src/views/components/Online.test.tsx b/website/src/views/components/Online.test.tsx index 4c2619edd4..5b4bbaac06 100644 --- a/website/src/views/components/Online.test.tsx +++ b/website/src/views/components/Online.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import { OnlineComponent } from './Online'; diff --git a/website/src/views/components/RandomKawaii.tsx b/website/src/views/components/RandomKawaii.tsx index 956e037b8b..3e28704d51 100644 --- a/website/src/views/components/RandomKawaii.tsx +++ b/website/src/views/components/RandomKawaii.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { sample } from 'lodash'; import { SpeechBubble, Mug, Browser, Ghost, KawaiiMood, KawaiiProps } from 'react-kawaii'; diff --git a/website/src/views/components/ScrollToTop.test.tsx b/website/src/views/components/ScrollToTop.test.tsx index e7c60119b6..40db9094df 100644 --- a/website/src/views/components/ScrollToTop.test.tsx +++ b/website/src/views/components/ScrollToTop.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { MemoryRouter } from 'react-router-dom'; import { mount, ReactWrapper } from 'enzyme'; import mockDom from 'test-utils/mockDom'; diff --git a/website/src/views/components/ScrollToTop.tsx b/website/src/views/components/ScrollToTop.tsx index 104ed4ef61..c9c49b9313 100644 --- a/website/src/views/components/ScrollToTop.tsx +++ b/website/src/views/components/ScrollToTop.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { Component } from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; import { scrollToHash } from 'utils/react'; @@ -12,7 +12,7 @@ function scrollToTop() { window.scrollTo(0, 0); } -export class ScrollToTopComponent extends React.Component { +export class ScrollToTopComponent extends Component { static defaultProps = { onComponentDidMount: false, onPathChange: false, diff --git a/website/src/views/components/SearchBox.test.tsx b/website/src/views/components/SearchBox.test.tsx index f9a81e2b61..6268718b23 100644 --- a/website/src/views/components/SearchBox.test.tsx +++ b/website/src/views/components/SearchBox.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import SearchBox from './SearchBox'; diff --git a/website/src/views/components/SearchkitSearchBox.tsx b/website/src/views/components/SearchkitSearchBox.tsx index 8a1b623514..0df5e4a548 100644 --- a/website/src/views/components/SearchkitSearchBox.tsx +++ b/website/src/views/components/SearchkitSearchBox.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { QueryAccessor, SearchkitComponent, diff --git a/website/src/views/components/SemesterBadge.tsx b/website/src/views/components/SemesterBadge.tsx index 32cc7e12ee..ecefa2b11c 100644 --- a/website/src/views/components/SemesterBadge.tsx +++ b/website/src/views/components/SemesterBadge.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import classnames from 'classnames'; import config from 'config'; import { Semester } from 'types/modules'; diff --git a/website/src/views/components/Title.tsx b/website/src/views/components/Title.tsx index 3d009a491b..b5b3bacd8f 100644 --- a/website/src/views/components/Title.tsx +++ b/website/src/views/components/Title.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { Helmet } from 'react-helmet'; import config from 'config'; diff --git a/website/src/views/components/Tooltip/Tooltip.tsx b/website/src/views/components/Tooltip/Tooltip.tsx index 1544e2fcec..74128376df 100644 --- a/website/src/views/components/Tooltip/Tooltip.tsx +++ b/website/src/views/components/Tooltip/Tooltip.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import Tippy, { TippyProps, TippySingleton, TippySingletonProps } from '@tippy.js/react'; import { animateFill } from 'tippy.js'; // eslint-disable-line import/no-extraneous-dependencies diff --git a/website/src/views/components/Tooltip/index.tsx b/website/src/views/components/Tooltip/index.tsx index c5f015bfef..0db8b7c30f 100644 --- a/website/src/views/components/Tooltip/index.tsx +++ b/website/src/views/components/Tooltip/index.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { retryImport } from 'utils/error'; diff --git a/website/src/views/components/disqus/CommentCount.test.tsx b/website/src/views/components/disqus/CommentCount.test.tsx index 833db3261b..441cc6d6ab 100644 --- a/website/src/views/components/disqus/CommentCount.test.tsx +++ b/website/src/views/components/disqus/CommentCount.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { mount } from 'enzyme'; import insertScript from 'utils/insertScript'; import { CommentCountComponent } from './CommentCount'; diff --git a/website/src/views/components/disqus/CommentCount.tsx b/website/src/views/components/disqus/CommentCount.tsx index c39924d1f9..3876af90d4 100644 --- a/website/src/views/components/disqus/CommentCount.tsx +++ b/website/src/views/components/disqus/CommentCount.tsx @@ -1,4 +1,5 @@ -import React, { useEffect } from 'react'; +import * as React from 'react'; +import { useEffect } from 'react'; import { connect } from 'react-redux'; import config from 'config'; diff --git a/website/src/views/components/disqus/DisqusComments.tsx b/website/src/views/components/disqus/DisqusComments.tsx index e59e70bda9..5407ef7364 100644 --- a/website/src/views/components/disqus/DisqusComments.tsx +++ b/website/src/views/components/disqus/DisqusComments.tsx @@ -1,5 +1,5 @@ import { DisqusConfig } from 'types/views'; -import * as React from 'react'; +import { PureComponent } from 'react'; import classnames from 'classnames'; import { connect } from 'react-redux'; @@ -26,7 +26,7 @@ type State = { const SCRIPT_ID = 'dsq-embed-scr'; -class DisqusComments extends React.PureComponent { +class DisqusComments extends PureComponent { state = { allowDisqus: false, }; diff --git a/website/src/views/components/filters/CheckboxItem.tsx b/website/src/views/components/filters/CheckboxItem.tsx index fb6e73fcd3..1f339091a2 100644 --- a/website/src/views/components/filters/CheckboxItem.tsx +++ b/website/src/views/components/filters/CheckboxItem.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import classnames from 'classnames'; import { NBSP } from 'utils/react'; import styles from './styles.scss'; diff --git a/website/src/views/components/filters/CheckboxItemFilter.test.tsx b/website/src/views/components/filters/CheckboxItemFilter.test.tsx index a670941992..61606c8eac 100644 --- a/website/src/views/components/filters/CheckboxItemFilter.test.tsx +++ b/website/src/views/components/filters/CheckboxItemFilter.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { mount } from 'enzyme'; import { SearchkitManager } from 'searchkit'; diff --git a/website/src/views/components/filters/CheckboxItemFilter.tsx b/website/src/views/components/filters/CheckboxItemFilter.tsx index a6a43cb925..bf1f5a0c15 100644 --- a/website/src/views/components/filters/CheckboxItemFilter.tsx +++ b/website/src/views/components/filters/CheckboxItemFilter.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { CheckboxFilterAccessor, SearchkitComponent, SearchkitComponentProps } from 'searchkit'; import { ElasticSearchFilter } from 'types/vendor/elastic-search'; diff --git a/website/src/views/components/filters/ChecklistFilter.tsx b/website/src/views/components/filters/ChecklistFilter.tsx index 500506021a..6cd39b36b8 100644 --- a/website/src/views/components/filters/ChecklistFilter.tsx +++ b/website/src/views/components/filters/ChecklistFilter.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { memo } from 'react'; import { ElasticSearchFilter } from 'types/vendor/elastic-search'; import FilterContainer from './FilterContainer'; @@ -17,7 +17,7 @@ interface ChecklistFilterProps { disabled?: boolean; } -const ChecklistFilter = React.memo( +const ChecklistFilter = memo( ({ title, items, disabled = false, showCount = true }) => { return ( diff --git a/website/src/views/components/filters/DropdownListFilters.test.tsx b/website/src/views/components/filters/DropdownListFilters.test.tsx index 09244abe17..8ddb91e18f 100644 --- a/website/src/views/components/filters/DropdownListFilters.test.tsx +++ b/website/src/views/components/filters/DropdownListFilters.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { mount } from 'enzyme'; import { RefinementItem } from 'types/views'; diff --git a/website/src/views/components/filters/DropdownListFilters.tsx b/website/src/views/components/filters/DropdownListFilters.tsx index aeb7a3a606..4388dc16fe 100644 --- a/website/src/views/components/filters/DropdownListFilters.tsx +++ b/website/src/views/components/filters/DropdownListFilters.tsx @@ -1,4 +1,5 @@ -import React, { useState, useRef } from 'react'; +import * as React from 'react'; +import { useState, useRef } from 'react'; import Downshift, { DownshiftState, StateChangeOptions } from 'downshift'; import { ListProps } from 'searchkit'; import classnames from 'classnames'; diff --git a/website/src/views/components/filters/FilterContainer.tsx b/website/src/views/components/filters/FilterContainer.tsx index 35b04f16cc..b99c868588 100644 --- a/website/src/views/components/filters/FilterContainer.tsx +++ b/website/src/views/components/filters/FilterContainer.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { PanelProps } from 'searchkit'; import styles from './styles.scss'; diff --git a/website/src/views/components/icons/weather.test.ts b/website/src/views/components/icons/weather.test.ts index eb613179c9..e87eb89a32 100644 --- a/website/src/views/components/icons/weather.test.ts +++ b/website/src/views/components/icons/weather.test.ts @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import Cloudy from 'img/weather/cloudy.svg'; import Rain from 'img/weather/rain.svg'; diff --git a/website/src/views/components/map/ArrivalTimes.tsx b/website/src/views/components/map/ArrivalTimes.tsx index 225c7cb943..ba73d4cd97 100644 --- a/website/src/views/components/map/ArrivalTimes.tsx +++ b/website/src/views/components/map/ArrivalTimes.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { memo } from 'react'; import classnames from 'classnames'; import { entries, sortBy } from 'lodash'; @@ -46,7 +46,7 @@ function fixRouteName(name: string) { return name.replace(/\s?\(/, ' ('); } -export const ArrivalTimes = React.memo((props: Props) => { +export const ArrivalTimes = memo((props: Props) => { if (props.error) { return ( <> diff --git a/website/src/views/components/map/BusStops.tsx b/website/src/views/components/map/BusStops.tsx index 95e7573a60..38e26df1a7 100644 --- a/website/src/views/components/map/BusStops.tsx +++ b/website/src/views/components/map/BusStops.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { DivIcon, DragEndEvent } from 'leaflet'; import { Marker, Popup } from 'react-leaflet'; import classnames from 'classnames'; @@ -39,7 +39,7 @@ busStops.forEach((stop: BusStop) => { /** * Displays bus stop routes as markers, and timings in a popup when they are clicked */ -export default class BusStops extends React.PureComponent { +export default class BusStops extends PureComponent { constructor(props: Props) { super(props); diff --git a/website/src/views/components/map/ExpandMap.tsx b/website/src/views/components/map/ExpandMap.tsx index 60f2c5e268..5f5486c6bb 100644 --- a/website/src/views/components/map/ExpandMap.tsx +++ b/website/src/views/components/map/ExpandMap.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { PureComponent } from 'react'; import { withLeaflet, ContextProps } from 'react-leaflet'; import Control from 'react-leaflet-control'; import { Maximize, Minimize } from 'react-feather'; @@ -9,7 +9,7 @@ type Props = ContextProps & { readonly onToggleExpand: (boolean: boolean) => void; }; -class ExpandMap extends React.PureComponent { +class ExpandMap extends PureComponent { componentDidUpdate() { if (this.props.leaflet && this.props.leaflet.map) { const { map } = this.props.leaflet; diff --git a/website/src/views/components/map/LocationMap.tsx b/website/src/views/components/map/LocationMap.tsx index 532e797847..5559e1ea45 100644 --- a/website/src/views/components/map/LocationMap.tsx +++ b/website/src/views/components/map/LocationMap.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { Map as LeafletMap } from 'leaflet'; import { Map, Marker, TileLayer, Polygon, Tooltip } from 'react-leaflet'; import { GestureHandling } from 'leaflet-gesture-handling'; diff --git a/website/src/views/components/map/MapContext.ts b/website/src/views/components/map/MapContext.ts index 37f29de305..32859896cb 100644 --- a/website/src/views/components/map/MapContext.ts +++ b/website/src/views/components/map/MapContext.ts @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { createContext } from 'react'; type MapContextValue = Readonly<{ toggleMapExpanded: (boolean: boolean) => void; @@ -13,6 +13,6 @@ const defaultValue: MapContextValue = { }, }; -const MapContext = React.createContext(defaultValue); +const MapContext = createContext(defaultValue); export default MapContext; diff --git a/website/src/views/components/map/withVenueLocations.tsx b/website/src/views/components/map/withVenueLocations.tsx index c716bcc39f..a2fd58d01f 100644 --- a/website/src/views/components/map/withVenueLocations.tsx +++ b/website/src/views/components/map/withVenueLocations.tsx @@ -1,4 +1,4 @@ -import React, { ComponentType } from 'react'; +import { ComponentType } from 'react'; import Loadable, { LoadingComponentProps } from 'react-loadable'; import { VenueLocationMap } from 'types/venues'; diff --git a/website/src/views/components/module-info/AddModuleDropdown.test.tsx b/website/src/views/components/module-info/AddModuleDropdown.test.tsx index 11f7354171..9246bbdeda 100644 --- a/website/src/views/components/module-info/AddModuleDropdown.test.tsx +++ b/website/src/views/components/module-info/AddModuleDropdown.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { mount } from 'enzyme'; import { TimetableConfig } from 'types/timetables'; diff --git a/website/src/views/components/module-info/AddModuleDropdown.tsx b/website/src/views/components/module-info/AddModuleDropdown.tsx index 72019b1df9..6992030149 100644 --- a/website/src/views/components/module-info/AddModuleDropdown.tsx +++ b/website/src/views/components/module-info/AddModuleDropdown.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { PureComponent } from 'react'; import Downshift from 'downshift'; import classnames from 'classnames'; import { connect } from 'react-redux'; @@ -36,7 +36,7 @@ function isModuleOnTimetable( return !!get(timetables, [String(semester), module.moduleCode]); } -export class AddModuleDropdownComponent extends React.PureComponent { +export class AddModuleDropdownComponent extends PureComponent { static getDerivedStateFromProps(nextProps: Props, prevState: State) { const { timetables, module } = nextProps; const { loading } = prevState; diff --git a/website/src/views/components/module-info/ModuleExamClash.test.tsx b/website/src/views/components/module-info/ModuleExamClash.test.tsx index 5952422226..e6770cd880 100644 --- a/website/src/views/components/module-info/ModuleExamClash.test.tsx +++ b/website/src/views/components/module-info/ModuleExamClash.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import { Module, ModuleCode } from 'types/modules'; diff --git a/website/src/views/components/module-info/ModuleSemesterInfo.tsx b/website/src/views/components/module-info/ModuleSemesterInfo.tsx index f048badf8b..a101dc61ce 100644 --- a/website/src/views/components/module-info/ModuleSemesterInfo.tsx +++ b/website/src/views/components/module-info/ModuleSemesterInfo.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { Component } from 'react'; import { ModuleCode, Semester, SemesterDataCondensed } from 'types/modules'; @@ -17,7 +17,7 @@ type State = { selected: Semester; }; -export default class ModuleSemesterInfo extends React.Component { +export default class ModuleSemesterInfo extends Component { constructor(props: Props) { super(props); diff --git a/website/src/views/components/module-info/ModuleWorkload.test.tsx b/website/src/views/components/module-info/ModuleWorkload.test.tsx index d173968e54..feaaa6b590 100644 --- a/website/src/views/components/module-info/ModuleWorkload.test.tsx +++ b/website/src/views/components/module-info/ModuleWorkload.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow, ShallowWrapper } from 'enzyme'; import _ from 'lodash'; diff --git a/website/src/views/components/module-info/SemesterPicker.tsx b/website/src/views/components/module-info/SemesterPicker.tsx index 82c24ad4a9..edaccdecca 100644 --- a/website/src/views/components/module-info/SemesterPicker.tsx +++ b/website/src/views/components/module-info/SemesterPicker.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { memo } from 'react'; import { each } from 'lodash'; import { Semester } from 'types/modules'; @@ -18,7 +18,7 @@ type Props = { onSelectSemester: (semester: Semester) => void; }; -const SemesterPicker = React.memo( +const SemesterPicker = memo( ({ semesters, showDisabled = false, diff --git a/website/src/views/components/notfications/Announcements.tsx b/website/src/views/components/notfications/Announcements.tsx index 5636e376a9..560de19eaf 100644 --- a/website/src/views/components/notfications/Announcements.tsx +++ b/website/src/views/components/notfications/Announcements.tsx @@ -1,4 +1,4 @@ -import React, { memo, useState, useCallback } from 'react'; +import { memo, useState, useCallback } from 'react'; import classnames from 'classnames'; import { Sun } from 'react-feather'; diff --git a/website/src/views/components/notfications/HacktoberfestBanner.tsx b/website/src/views/components/notfications/HacktoberfestBanner.tsx index 2a8cb472ce..27af3a5703 100644 --- a/website/src/views/components/notfications/HacktoberfestBanner.tsx +++ b/website/src/views/components/notfications/HacktoberfestBanner.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import classnames from 'classnames'; import { Link } from 'react-router-dom'; @@ -16,7 +16,7 @@ type State = { const today = new Date(); -export default class HacktoberfestBanner extends React.PureComponent { +export default class HacktoberfestBanner extends PureComponent { state: State = { isOpen: !storage.getItem(HACKTOBERFEST) && (today.getMonth() === 9 || today.getMonth() === 10), }; diff --git a/website/src/views/components/searchkit/Pagination.tsx b/website/src/views/components/searchkit/Pagination.tsx index 5fbb4ab4bb..009c09372c 100644 --- a/website/src/views/components/searchkit/Pagination.tsx +++ b/website/src/views/components/searchkit/Pagination.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { PaginationAccessor, SearchkitComponent, SearchkitComponentProps } from 'searchkit'; import { clamp, get } from 'lodash'; diff --git a/website/src/views/components/semester-switcher/SemesterSwitcher.test.tsx b/website/src/views/components/semester-switcher/SemesterSwitcher.test.tsx index eb9c43bb82..844ad05443 100644 --- a/website/src/views/components/semester-switcher/SemesterSwitcher.test.tsx +++ b/website/src/views/components/semester-switcher/SemesterSwitcher.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import SemesterSwitcher from './SemesterSwitcher'; diff --git a/website/src/views/components/semester-switcher/SemesterSwitcher.tsx b/website/src/views/components/semester-switcher/SemesterSwitcher.tsx index 2316921d08..473249921b 100644 --- a/website/src/views/components/semester-switcher/SemesterSwitcher.tsx +++ b/website/src/views/components/semester-switcher/SemesterSwitcher.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { memo } from 'react'; import { ChevronLeft, ChevronRight } from 'react-feather'; import type { Semester } from 'types/modules'; @@ -13,7 +13,7 @@ type Props = { onSelectSemester: (newSemester: Semester) => void; }; -const SemesterSwitcher = React.memo(({ readOnly, semester, onSelectSemester }) => { +const SemesterSwitcher = memo(({ readOnly, semester, onSelectSemester }) => { const switchSemester = (offset: number) => { const newSemester: Semester = semester + offset; if (!isValidSemester(newSemester)) { diff --git a/website/src/views/contribute/ContributeContainer/ContributeContainer.tsx b/website/src/views/contribute/ContributeContainer/ContributeContainer.tsx index 92d11a6ee9..aedd416239 100644 --- a/website/src/views/contribute/ContributeContainer/ContributeContainer.tsx +++ b/website/src/views/contribute/ContributeContainer/ContributeContainer.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { memo, Fragment } from 'react'; import { connect } from 'react-redux'; import classnames from 'classnames'; import { Link } from 'react-router-dom'; @@ -43,7 +43,7 @@ type Props = { toggleBetaTesting: () => void; }; -const ContributeContainer = React.memo(({ modules, beta, ...props }) => ( +const ContributeContainer = memo(({ modules, beta, ...props }) => (
Contribute @@ -79,7 +79,7 @@ const ContributeContainer = React.memo(({ modules, beta, ...props }) => (
{map(modules, (moduleCondensed, semester) => ( - +

{config.semesterNames[semester]}

{moduleCondensed.map(({ moduleCode, title }) => ( @@ -93,7 +93,7 @@ const ContributeContainer = React.memo(({ modules, beta, ...props }) => ( ))}
-
+ ))}
diff --git a/website/src/views/contribute/ContributeContainer/index.tsx b/website/src/views/contribute/ContributeContainer/index.tsx index 147ebc620e..4a2cb6e819 100644 --- a/website/src/views/contribute/ContributeContainer/index.tsx +++ b/website/src/views/contribute/ContributeContainer/index.tsx @@ -1,5 +1,3 @@ -import * as React from 'react'; - import Loadable, { LoadingComponentProps } from 'react-loadable'; import LoadingSpinner from 'views/components/LoadingSpinner'; diff --git a/website/src/views/contribute/UnmappedVenues.test.tsx b/website/src/views/contribute/UnmappedVenues.test.tsx index a3539baafe..ce2749be9a 100644 --- a/website/src/views/contribute/UnmappedVenues.test.tsx +++ b/website/src/views/contribute/UnmappedVenues.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import { VenueLocationMap } from 'types/venues'; import { UnmappedVenuesComponent } from './UnmappedVenues'; diff --git a/website/src/views/contribute/UnmappedVenues.tsx b/website/src/views/contribute/UnmappedVenues.tsx index 1bca88c1dc..af72b4207b 100644 --- a/website/src/views/contribute/UnmappedVenues.tsx +++ b/website/src/views/contribute/UnmappedVenues.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import classnames from 'classnames'; import { partition } from 'lodash'; @@ -20,7 +20,7 @@ type State = { readonly expanded: boolean; }; -export class UnmappedVenuesComponent extends React.PureComponent { +export class UnmappedVenuesComponent extends PureComponent { state = { expanded: false, }; diff --git a/website/src/views/errors/ModuleFinderApiError.tsx b/website/src/views/errors/ModuleFinderApiError.tsx index 0a77dcf490..d06d412947 100644 --- a/website/src/views/errors/ModuleFinderApiError.tsx +++ b/website/src/views/errors/ModuleFinderApiError.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import ApiError from './ApiError'; // Should be defined in Searchkit, but it isn't exported. diff --git a/website/src/views/errors/ModuleFinderNoHits.tsx b/website/src/views/errors/ModuleFinderNoHits.tsx index 7422db2021..1fd61b298f 100644 --- a/website/src/views/errors/ModuleFinderNoHits.tsx +++ b/website/src/views/errors/ModuleFinderNoHits.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import Omelette, { matchEgg } from 'views/components/Omelette'; import Warning from './Warning'; import styles from './ErrorPage.scss'; diff --git a/website/src/views/errors/ModuleNotFoundPage.test.tsx b/website/src/views/errors/ModuleNotFoundPage.test.tsx index 937f10772d..fba796cb91 100644 --- a/website/src/views/errors/ModuleNotFoundPage.test.tsx +++ b/website/src/views/errors/ModuleNotFoundPage.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import { Link } from 'react-router-dom'; import LoadingSpinner from 'views/components/LoadingSpinner'; diff --git a/website/src/views/errors/ModuleNotFoundPage.tsx b/website/src/views/errors/ModuleNotFoundPage.tsx index 719c5fc5d9..871755cbe1 100644 --- a/website/src/views/errors/ModuleNotFoundPage.tsx +++ b/website/src/views/errors/ModuleNotFoundPage.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { PureComponent } from 'react'; import { Link } from 'react-router-dom'; import { connect } from 'react-redux'; import classnames from 'classnames'; @@ -26,7 +26,7 @@ type Props = OwnProps & { fetchModuleArchive: (str: string) => Promise; }; -export class ModuleNotFoundPageComponent extends React.PureComponent { +export class ModuleNotFoundPageComponent extends PureComponent { componentDidMount() { Sentry.withScope(() => { Sentry.captureMessage('404 - Module Not Found'); diff --git a/website/src/views/errors/Warning.test.tsx b/website/src/views/errors/Warning.test.tsx index e09a0c7dd4..4b768c12ca 100644 --- a/website/src/views/errors/Warning.test.tsx +++ b/website/src/views/errors/Warning.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import Warning from './Warning'; diff --git a/website/src/views/hooks/useCurrentTime.tsx b/website/src/views/hooks/useCurrentTime.tsx index ecd8c0b51c..09938b6fbf 100644 --- a/website/src/views/hooks/useCurrentTime.tsx +++ b/website/src/views/hooks/useCurrentTime.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { useRef, useState, useEffect } from 'react'; import { differenceInMilliseconds } from 'date-fns'; import { forceTimer } from 'utils/debug'; @@ -11,10 +11,10 @@ function getCurrentTime() { * Hook version of withTimer */ export default function useCurrentTime(intervalInMs: number = 60 * 1000) { - const intervalId = React.useRef(); - const [time, setTime] = React.useState(getCurrentTime()); + const intervalId = useRef(); + const [time, setTime] = useState(getCurrentTime()); - React.useEffect(() => { + useEffect(() => { // Update current time every interval milliseconds intervalId.current = window.setInterval(() => { setTime(getCurrentTime()); diff --git a/website/src/views/hooks/useGlobalDebugValue.ts b/website/src/views/hooks/useGlobalDebugValue.ts index 466b9d15db..38daaa05d5 100644 --- a/website/src/views/hooks/useGlobalDebugValue.ts +++ b/website/src/views/hooks/useGlobalDebugValue.ts @@ -1,11 +1,11 @@ -import React from 'react'; +import { useState, useDebugValue } from 'react'; import { DEBUG_HOOK_NAMES } from 'types/vendor/window.d'; export default function useGlobalDebugValue(name: DEBUG_HOOK_NAMES, initialValue: T) { - const [value, setValue] = React.useState(initialValue); + const [value, setValue] = useState(initialValue); - React.useDebugValue(name); + useDebugValue(name); // eslint-disable-next-line @typescript-eslint/no-explicit-any (window as any)[name] = setValue; diff --git a/website/src/views/layout/Footer.test.tsx b/website/src/views/layout/Footer.test.tsx index 2d5cf2d31e..914a683b0b 100644 --- a/website/src/views/layout/Footer.test.tsx +++ b/website/src/views/layout/Footer.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import { FooterComponent } from 'views/layout/Footer'; diff --git a/website/src/views/layout/GlobalSearch.tsx b/website/src/views/layout/GlobalSearch.tsx index 59535c6bd7..dd487ee578 100644 --- a/website/src/views/layout/GlobalSearch.tsx +++ b/website/src/views/layout/GlobalSearch.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { Component, Fragment } from 'react'; import { omit, stubString } from 'lodash'; import Downshift, { ChildrenFunction, DownshiftState, StateChangeOptions } from 'downshift'; import classnames from 'classnames'; @@ -35,7 +35,7 @@ type State = { const PLACEHOLDER = 'Search modules & venues. Try "GER" or "LT".'; -class GlobalSearch extends React.Component { +class GlobalSearch extends Component { input: HTMLInputElement | null = null; state = { @@ -122,7 +122,7 @@ class GlobalSearch extends React.Component { // key to ensure the input element does not change during rerender, which would cause // selection to be lost const searchForm = ( - + + ); const searchResults = this.props.getResults(inputValue); diff --git a/website/src/views/layout/GlobalSearchContainer.test.tsx b/website/src/views/layout/GlobalSearchContainer.test.tsx index 945f6799ea..43cc7b5c90 100644 --- a/website/src/views/layout/GlobalSearchContainer.test.tsx +++ b/website/src/views/layout/GlobalSearchContainer.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import _ from 'lodash'; diff --git a/website/src/views/layout/GlobalSearchContainer.tsx b/website/src/views/layout/GlobalSearchContainer.tsx index bb3cfd8e07..372155b001 100644 --- a/website/src/views/layout/GlobalSearchContainer.tsx +++ b/website/src/views/layout/GlobalSearchContainer.tsx @@ -3,7 +3,7 @@ import { Venue, VenueList } from 'types/venues'; import { ModuleList } from 'types/reducers'; import { ResultType, SearchResult, VENUE_RESULT } from 'types/views'; -import * as React from 'react'; +import { Component } from 'react'; import { connect } from 'react-redux'; import { RouteComponentProps, withRouter } from 'react-router-dom'; import GlobalSearch from 'views/layout/GlobalSearch'; @@ -28,7 +28,7 @@ const RESULTS_LIMIT = 10; const LONG_LIST_LIMIT = 70; const MIN_INPUT_LENGTH = 2; -export class SearchContainerComponent extends React.Component { +export class SearchContainerComponent extends Component { componentDidMount() { this.props.fetchVenueList(); } diff --git a/website/src/views/layout/Navtabs.test.tsx b/website/src/views/layout/Navtabs.test.tsx index 1f88c75b8b..d2bb9e2d9e 100644 --- a/website/src/views/layout/Navtabs.test.tsx +++ b/website/src/views/layout/Navtabs.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import createHistory from 'test-utils/createHistory'; diff --git a/website/src/views/layout/NoFooter.tsx b/website/src/views/layout/NoFooter.tsx index 9a041b537a..a110054f8a 100644 --- a/website/src/views/layout/NoFooter.tsx +++ b/website/src/views/layout/NoFooter.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import styles from './NoFooter.scss'; /** diff --git a/website/src/views/modules/ModuleArchiveContainer.test.tsx b/website/src/views/modules/ModuleArchiveContainer.test.tsx index f33f44f3e1..dfbbf17919 100644 --- a/website/src/views/modules/ModuleArchiveContainer.test.tsx +++ b/website/src/views/modules/ModuleArchiveContainer.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow, ShallowWrapper } from 'enzyme'; import { Redirect } from 'react-router-dom'; diff --git a/website/src/views/modules/ModuleFinderContainer/ModuleFinderContainer.tsx b/website/src/views/modules/ModuleFinderContainer/ModuleFinderContainer.tsx index 2adbef8866..b0f2656790 100644 --- a/website/src/views/modules/ModuleFinderContainer/ModuleFinderContainer.tsx +++ b/website/src/views/modules/ModuleFinderContainer/ModuleFinderContainer.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { Hits, HitsStats, diff --git a/website/src/views/modules/ModuleFinderContainer/index.tsx b/website/src/views/modules/ModuleFinderContainer/index.tsx index 0c6a222cc8..f565abad8c 100644 --- a/website/src/views/modules/ModuleFinderContainer/index.tsx +++ b/website/src/views/modules/ModuleFinderContainer/index.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import Loadable, { LoadingComponentProps } from 'react-loadable'; import LoadingSpinner from 'views/components/LoadingSpinner'; diff --git a/website/src/views/modules/ModuleFinderItem.tsx b/website/src/views/modules/ModuleFinderItem.tsx index 172e21979e..bdbdebc216 100644 --- a/website/src/views/modules/ModuleFinderItem.tsx +++ b/website/src/views/modules/ModuleFinderItem.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { Link } from 'react-router-dom'; import classnames from 'classnames'; diff --git a/website/src/views/modules/ModuleFinderPager.test.tsx b/website/src/views/modules/ModuleFinderPager.test.tsx index 590a6aec2b..d24757287a 100644 --- a/website/src/views/modules/ModuleFinderPager.test.tsx +++ b/website/src/views/modules/ModuleFinderPager.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { shallow } from 'enzyme'; import { noop } from 'lodash'; import ModuleFinderPagerButton from 'views/modules/ModuleFinderPagerButton'; diff --git a/website/src/views/modules/ModuleFinderPagerButton.test.tsx b/website/src/views/modules/ModuleFinderPagerButton.test.tsx index 8ac12a7580..56170e6d87 100644 --- a/website/src/views/modules/ModuleFinderPagerButton.test.tsx +++ b/website/src/views/modules/ModuleFinderPagerButton.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { shallow } from 'enzyme'; import { noop } from 'lodash'; diff --git a/website/src/views/modules/ModuleFinderPagerButton.tsx b/website/src/views/modules/ModuleFinderPagerButton.tsx index cc741d956a..42b1a99a98 100644 --- a/website/src/views/modules/ModuleFinderPagerButton.tsx +++ b/website/src/views/modules/ModuleFinderPagerButton.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import classnames from 'classnames'; import Tooltip from 'views/components/Tooltip'; diff --git a/website/src/views/modules/ModuleFinderSidebar.tsx b/website/src/views/modules/ModuleFinderSidebar.tsx index 97c5565a05..944815e24d 100644 --- a/website/src/views/modules/ModuleFinderSidebar.tsx +++ b/website/src/views/modules/ModuleFinderSidebar.tsx @@ -1,4 +1,5 @@ -import React, { useState } from 'react'; +import * as React from 'react'; +import { memo, useState } from 'react'; import { NumericRefinementListFilter, RefinementListFilter, @@ -42,7 +43,7 @@ const EXAM_FILTER_ITEMS: FilterItem[] = [ }, ]; -const ModuleFinderSidebar: React.FC = React.memo(() => { +const ModuleFinderSidebar: React.FC = () => { const [isMenuOpen, setMenuOpen] = useState(false); return ( {
); -}); +}; -ModuleFinderSidebar.displayName = 'ModuleFinderSidebar'; - -export default ModuleFinderSidebar; +export default memo(ModuleFinderSidebar); diff --git a/website/src/views/modules/ModulePageContainer.test.tsx b/website/src/views/modules/ModulePageContainer.test.tsx index 8a736b98c4..d5587eca4e 100644 --- a/website/src/views/modules/ModulePageContainer.test.tsx +++ b/website/src/views/modules/ModulePageContainer.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow, ShallowWrapper } from 'enzyme'; import { Redirect } from 'react-router-dom'; diff --git a/website/src/views/modules/ModulePageContent.test.tsx b/website/src/views/modules/ModulePageContent.test.tsx index bb777edfa0..a9a6171bc4 100644 --- a/website/src/views/modules/ModulePageContent.test.tsx +++ b/website/src/views/modules/ModulePageContent.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import ScrollSpy from 'react-scrollspy'; import { shallow } from 'enzyme'; diff --git a/website/src/views/modules/ModulePageContent.tsx b/website/src/views/modules/ModulePageContent.tsx index 5ad3851515..f39dcdef9f 100644 --- a/website/src/views/modules/ModulePageContent.tsx +++ b/website/src/views/modules/ModulePageContent.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { Component } from 'react'; import classnames from 'classnames'; import ScrollSpy from 'react-scrollspy'; import { kebabCase, map, mapValues, values, sortBy } from 'lodash'; @@ -51,7 +51,7 @@ export const SIDE_MENU_LABELS = { export const SIDE_MENU_ITEMS = mapValues(SIDE_MENU_LABELS, kebabCase); -class ModulePageContent extends React.Component { +class ModulePageContent extends Component { state: State = { isMenuOpen: false, }; diff --git a/website/src/views/modules/ModuleTree.test.tsx b/website/src/views/modules/ModuleTree.test.tsx index bc843c1fe5..ca33b02b6d 100644 --- a/website/src/views/modules/ModuleTree.test.tsx +++ b/website/src/views/modules/ModuleTree.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { render } from 'enzyme'; import ModuleTree from './ModuleTree'; diff --git a/website/src/views/modules/ReportError.tsx b/website/src/views/modules/ReportError.tsx index bfa5071a21..0d7c9fead3 100644 --- a/website/src/views/modules/ReportError.tsx +++ b/website/src/views/modules/ReportError.tsx @@ -1,4 +1,5 @@ -import React, { FormEventHandler } from 'react'; +import * as React from 'react'; +import { FormEventHandler, memo, useCallback, useState } from 'react'; import { castArray, groupBy } from 'lodash'; import classnames from 'classnames'; import produce from 'immer'; @@ -108,9 +109,9 @@ function matchModule(module: Module) { * Module error reporting component. Posts to a serverless script that then emails the relevant * faculty / department with the issue. */ -const ReportError = React.memo(({ module }) => { - const [isOpen, setIsOpen] = React.useState(false); - const [formState, setFormState] = React.useState({ type: 'unsubmitted' }); +const ReportError = memo(({ module }) => { + const [isOpen, setIsOpen] = useState(false); + const [formState, setFormState] = useState({ type: 'unsubmitted' }); // Causes the error reporting function to email modules@nusmods.com instead. // In production, use SET_ERROR_REPORTING_DEBUG(true) to enable debug mode @@ -119,13 +120,13 @@ const ReportError = React.memo(({ module }) => { process.env.NODE_ENV !== 'production', ); - const [formData, setFormData] = React.useState(() => ({ + const [formData, setFormData] = useState(() => ({ ...retrieveContactInfo(), message: '', contactId: matchModule(module)?.id, })); - const updateFormValue = React.useCallback( + const updateFormValue = useCallback( (key: keyof ReportErrorForm): FormEventHandler => (evt) => { const newFormData = produce(formData, (draft) => { draft[key] = (evt.target as HTMLInputElement).value; @@ -141,7 +142,7 @@ const ReportError = React.memo(({ module }) => { [formData], ); - const onSubmit = React.useCallback(() => { + const onSubmit = useCallback(() => { setFormState({ type: 'submitting' }); const { name, replyTo, matricNumber, message, contactId } = formData; diff --git a/website/src/views/planner/AddModule.tsx b/website/src/views/planner/AddModule.tsx index 48f9d29a97..c95cd8bf8b 100644 --- a/website/src/views/planner/AddModule.tsx +++ b/website/src/views/planner/AddModule.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import classnames from 'classnames'; import { map } from 'lodash'; import { X as Close, Plus } from 'react-feather'; diff --git a/website/src/views/planner/ModuleMenu.tsx b/website/src/views/planner/ModuleMenu.tsx index d58b12990c..1ef7830e83 100644 --- a/website/src/views/planner/ModuleMenu.tsx +++ b/website/src/views/planner/ModuleMenu.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { memo } from 'react'; import Downshift from 'downshift'; import classnames from 'classnames'; @@ -16,7 +16,7 @@ type MenuItem = { className?: string; }; -const ModuleMenu = React.memo((props: Props) => { +const ModuleMenu = memo((props: Props) => { const menuItems: MenuItem[] = [ { label: 'Edit MC and Title', action: props.editCustomData }, { label: 'Remove', action: props.removeModule, className: 'dropdown-item-danger' }, diff --git a/website/src/views/planner/PlannerContainer/PlannerContainer.tsx b/website/src/views/planner/PlannerContainer/PlannerContainer.tsx index 2502289cc2..83ece4fa00 100644 --- a/website/src/views/planner/PlannerContainer/PlannerContainer.tsx +++ b/website/src/views/planner/PlannerContainer/PlannerContainer.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import { flatMap, flatten, sortBy, toPairs, values } from 'lodash'; import { DragDropContext, Droppable, OnDragEndResponder } from 'react-beautiful-dnd'; @@ -66,7 +66,7 @@ type State = { const TRASH_ID = 'trash'; -export class PlannerContainerComponent extends React.PureComponent { +export class PlannerContainerComponent extends PureComponent { state: State = { loading: true, showSettings: false, diff --git a/website/src/views/planner/PlannerContainer/index.tsx b/website/src/views/planner/PlannerContainer/index.tsx index 37bee2ab20..3e4b8f1b44 100644 --- a/website/src/views/planner/PlannerContainer/index.tsx +++ b/website/src/views/planner/PlannerContainer/index.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import Loadable, { LoadingComponentProps } from 'react-loadable'; import LoadingSpinner from 'views/components/LoadingSpinner'; diff --git a/website/src/views/planner/PlannerModule.tsx b/website/src/views/planner/PlannerModule.tsx index c73e56cb7c..dd873d06ed 100644 --- a/website/src/views/planner/PlannerModule.tsx +++ b/website/src/views/planner/PlannerModule.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { memo, useState } from 'react'; import { Draggable } from 'react-beautiful-dnd'; import { Link } from 'react-router-dom'; import { format } from 'date-fns'; @@ -41,8 +41,8 @@ type Props = Readonly<{ /** * Component for a single module on the planner */ -const PlannerModule = React.memo((props) => { - const [isEditingPlaceholder, setEditingPlaceholder] = React.useState(false); +const PlannerModule = memo((props) => { + const [isEditingPlaceholder, setEditingPlaceholder] = useState(false); const removeModule = () => props.removeModule(props.id); diff --git a/website/src/views/planner/PlannerModuleSelect.tsx b/website/src/views/planner/PlannerModuleSelect.tsx index 1201c6e8d9..e19abc60a8 100644 --- a/website/src/views/planner/PlannerModuleSelect.tsx +++ b/website/src/views/planner/PlannerModuleSelect.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useRef } from 'react'; +import { HTMLProps, useEffect, useMemo, useRef } from 'react'; import { connect } from 'react-redux'; import Downshift from 'downshift'; import classnames from 'classnames'; @@ -135,7 +135,7 @@ export function PlannerModuleSelectComponent({ // Static props placeholder: 'eg. CS1010S', autoFocus: true, - }) as React.HTMLProps)} + }) as HTMLProps)} /> {isOpen && ( diff --git a/website/src/views/planner/PlannerYear.tsx b/website/src/views/planner/PlannerYear.tsx index 8e52ee1f26..2825a1728c 100644 --- a/website/src/views/planner/PlannerYear.tsx +++ b/website/src/views/planner/PlannerYear.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { PureComponent } from 'react'; import classnames from 'classnames'; import { flatMap, size, sortBy, toPairs, values } from 'lodash'; @@ -26,7 +26,7 @@ type State = { readonly showSpecialSem: boolean; }; -export default class PlannerYear extends React.PureComponent { +export default class PlannerYear extends PureComponent { state = { // Always display Special Terms I and II if either one has modules showSpecialSem: this.hasSpecialTermModules(), diff --git a/website/src/views/settings/BetaToggle.tsx b/website/src/views/settings/BetaToggle.tsx index f9af6b0532..e71ce93158 100644 --- a/website/src/views/settings/BetaToggle.tsx +++ b/website/src/views/settings/BetaToggle.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { memo } from 'react'; import Toggle from 'views/components/Toggle'; import ExternalLink from 'views/components/ExternalLink'; import config from 'config'; @@ -11,7 +11,7 @@ type Props = { toggleStates: () => void; }; -const BetaToggle = React.memo((props) => { +const BetaToggle = memo((props) => { const { betaTester, toggleStates } = props; const hasTests = currentTests.length > 0; diff --git a/website/src/views/settings/RefreshPrompt.tsx b/website/src/views/settings/RefreshPrompt.tsx index 631bd08900..5fb6ebea74 100644 --- a/website/src/views/settings/RefreshPrompt.tsx +++ b/website/src/views/settings/RefreshPrompt.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { createRef, PureComponent } from 'react'; import classnames from 'classnames'; import { connect } from 'react-redux'; import { RefreshCw as Refresh } from 'react-feather'; @@ -16,10 +16,10 @@ type State = { isReloading: boolean; }; -class RefreshPrompt extends React.PureComponent { +class RefreshPrompt extends PureComponent { buttonWidth?: number; - buttonRef = React.createRef(); + buttonRef = createRef(); state = { isReloading: false, diff --git a/website/src/views/settings/SettingsContainer.tsx b/website/src/views/settings/SettingsContainer.tsx index 401759b063..c4cda2c9fe 100644 --- a/website/src/views/settings/SettingsContainer.tsx +++ b/website/src/views/settings/SettingsContainer.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { Component, Fragment } from 'react'; import { connect } from 'react-redux'; import classnames from 'classnames'; import { isEqual } from 'lodash'; @@ -63,7 +63,7 @@ type State = { allowTracking: boolean; }; -class SettingsContainer extends React.Component { +class SettingsContainer extends Component { state = { allowTracking: true, }; @@ -99,7 +99,7 @@ class SettingsContainer extends React.Component { ); return ( - +
{round.type} {round.name ? `(Round ${round.name})` : ''}
@@ -125,7 +125,7 @@ class SettingsContainer extends React.Component { -
+ ); }); } diff --git a/website/src/views/static/TeamContainer.tsx b/website/src/views/static/TeamContainer.tsx index 470ffcefcd..f7bfa52dbb 100644 --- a/website/src/views/static/TeamContainer.tsx +++ b/website/src/views/static/TeamContainer.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { Facebook, Linkedin, GitHub, Twitter } from 'react-feather'; import ExternalLink from 'views/components/ExternalLink'; diff --git a/website/src/views/tetris/ScrollingNumber.tsx b/website/src/views/tetris/ScrollingNumber.tsx index c609f5f688..2bddb70f82 100644 --- a/website/src/views/tetris/ScrollingNumber.tsx +++ b/website/src/views/tetris/ScrollingNumber.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { createElement, PureComponent } from 'react'; type Props = { children: number; @@ -17,7 +17,7 @@ type State = { * Animates a number such that it increments or decrements (spins) towards * the actual value provided as the children */ -export default class ScrollingNumber extends React.PureComponent { +export default class ScrollingNumber extends PureComponent { isAnimating = false; state = { @@ -61,6 +61,6 @@ export default class ScrollingNumber extends React.PureComponent { render() { // Children is ignored since that represents the actual value const { children, tagName, ...otherProps } = this.props; - return React.createElement(tagName, otherProps, children); + return createElement(tagName, otherProps, children); } } diff --git a/website/src/views/tetris/TetrisGame.integration.test.tsx b/website/src/views/tetris/TetrisGame.integration.test.tsx index 011bdd11ee..0c301f67a0 100644 --- a/website/src/views/tetris/TetrisGame.integration.test.tsx +++ b/website/src/views/tetris/TetrisGame.integration.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { shallow } from 'enzyme'; import _ from 'lodash'; diff --git a/website/src/views/tetris/TetrisGame.tsx b/website/src/views/tetris/TetrisGame.tsx index 0022f2c9a0..3f49e78f01 100644 --- a/website/src/views/tetris/TetrisGame.tsx +++ b/website/src/views/tetris/TetrisGame.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { createRef, PureComponent } from 'react'; import Mousetrap from 'mousetrap'; import { debounce, noop, shuffle } from 'lodash'; import classnames from 'classnames'; @@ -105,10 +105,10 @@ function renderPiece(tiles: Board) { ); } -export default class TetrisGame extends React.PureComponent { +export default class TetrisGame extends PureComponent { intervalId?: number; - gameWrapper = React.createRef(); + gameWrapper = createRef(); // Ticks are not stored as state because it only affects game logic // and not rendering diff --git a/website/src/views/timetable/ExamCalendar.test.tsx b/website/src/views/timetable/ExamCalendar.test.tsx index f73ccdfbcb..c83355b70a 100644 --- a/website/src/views/timetable/ExamCalendar.test.tsx +++ b/website/src/views/timetable/ExamCalendar.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { mount } from 'enzyme'; import _ from 'lodash'; import { Link, MemoryRouter } from 'react-router-dom'; diff --git a/website/src/views/timetable/ExamCalendar.tsx b/website/src/views/timetable/ExamCalendar.tsx index 7bf31bda7a..2992907673 100644 --- a/website/src/views/timetable/ExamCalendar.tsx +++ b/website/src/views/timetable/ExamCalendar.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { PureComponent } from 'react'; import NUSModerator from 'nusmoderator'; import { groupBy, range } from 'lodash'; import classnames from 'classnames'; @@ -30,7 +30,7 @@ export function getTimeSegment(time: string): TimeSegment { return hour === 12 || hour < 5 ? 'Afternoon' : 'Evening'; } -export default class ExamCalendar extends React.PureComponent { +export default class ExamCalendar extends PureComponent { getVisibleModules(): ModuleWithColor[] { return this.props.modules.filter((module) => !module.hiddenInTimetable); } diff --git a/website/src/views/timetable/ExamWeek.test.tsx b/website/src/views/timetable/ExamWeek.test.tsx index ed72ee6167..a7f03254e6 100644 --- a/website/src/views/timetable/ExamWeek.test.tsx +++ b/website/src/views/timetable/ExamWeek.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { mount } from 'enzyme'; import { MemoryRouter } from 'react-router-dom'; diff --git a/website/src/views/timetable/ExamWeek.tsx b/website/src/views/timetable/ExamWeek.tsx index 138c18f6b3..9e812607aa 100644 --- a/website/src/views/timetable/ExamWeek.tsx +++ b/website/src/views/timetable/ExamWeek.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { Link } from 'react-router-dom'; import { range } from 'lodash'; import { isSameDay, addDays } from 'date-fns'; diff --git a/website/src/views/timetable/ExportMenu.tsx b/website/src/views/timetable/ExportMenu.tsx index cc1481b90e..ed05af4e37 100644 --- a/website/src/views/timetable/ExportMenu.tsx +++ b/website/src/views/timetable/ExportMenu.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { PureComponent } from 'react'; import Downshift, { ChildrenFunction } from 'downshift'; import { connect } from 'react-redux'; import classnames from 'classnames'; @@ -34,7 +34,7 @@ type State = { isMacWarningOpen: boolean; }; -export class ExportMenuComponent extends React.PureComponent { +export class ExportMenuComponent extends PureComponent { state: State = { isMacWarningOpen: false, }; diff --git a/website/src/views/timetable/ModuleTombstone.test.tsx b/website/src/views/timetable/ModuleTombstone.test.tsx index c32d37204e..8febe58267 100644 --- a/website/src/views/timetable/ModuleTombstone.test.tsx +++ b/website/src/views/timetable/ModuleTombstone.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow, mount } from 'enzyme'; /* @var {Module} */ diff --git a/website/src/views/timetable/ModulesSelect.test.tsx b/website/src/views/timetable/ModulesSelect.test.tsx index 3aa13333ad..8c25874410 100644 --- a/website/src/views/timetable/ModulesSelect.test.tsx +++ b/website/src/views/timetable/ModulesSelect.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { mount, shallow } from 'enzyme'; import Downshift from 'downshift'; import Modal from 'views/components/Modal'; diff --git a/website/src/views/timetable/ModulesSelect.tsx b/website/src/views/timetable/ModulesSelect.tsx index 62619b63c3..851191e95f 100644 --- a/website/src/views/timetable/ModulesSelect.tsx +++ b/website/src/views/timetable/ModulesSelect.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { Component } from 'react'; import { omit } from 'lodash'; import Downshift, { ChildrenFunction, @@ -37,7 +37,7 @@ type State = { inputValue: string; }; -export class ModulesSelectComponent extends React.Component { +export class ModulesSelectComponent extends Component { state = { isOpen: false, inputValue: '', diff --git a/website/src/views/timetable/ModulesSelectContainer.tsx b/website/src/views/timetable/ModulesSelectContainer.tsx index 7161a3c590..4c645623ea 100644 --- a/website/src/views/timetable/ModulesSelectContainer.tsx +++ b/website/src/views/timetable/ModulesSelectContainer.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { Component } from 'react'; import { connect } from 'react-redux'; import { ModuleSelectList } from 'types/reducers'; @@ -30,7 +30,7 @@ const RESULTS_LIMIT = 500; * Container for modules select * Governs the module filtering logic and non-select related logic such as notification. */ -class ModulesSelectContainer extends React.Component { +class ModulesSelectContainer extends Component { onChange = (moduleCode: ModuleCode) => { this.props.popNotification(); this.props.addModule(this.props.semester, moduleCode); diff --git a/website/src/views/timetable/ShareTimetable.test.tsx b/website/src/views/timetable/ShareTimetable.test.tsx index c49522f222..88478e43a5 100644 --- a/website/src/views/timetable/ShareTimetable.test.tsx +++ b/website/src/views/timetable/ShareTimetable.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import axios, { AxiosResponse } from 'axios'; import { shallow, ShallowWrapper } from 'enzyme'; diff --git a/website/src/views/timetable/TimetableCell.test.tsx b/website/src/views/timetable/TimetableCell.test.tsx index 262ced106a..b958b7044b 100644 --- a/website/src/views/timetable/TimetableCell.test.tsx +++ b/website/src/views/timetable/TimetableCell.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import { ColoredLesson, HoverLesson } from 'types/timetables'; diff --git a/website/src/views/timetable/TimetableCell.tsx b/website/src/views/timetable/TimetableCell.tsx index 1833cb3547..56a9903c05 100644 --- a/website/src/views/timetable/TimetableCell.tsx +++ b/website/src/views/timetable/TimetableCell.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import classnames from 'classnames'; import { isEqual } from 'lodash'; import { addWeeks, format, parseISO } from 'date-fns'; diff --git a/website/src/views/timetable/TimetableContainer.test.tsx b/website/src/views/timetable/TimetableContainer.test.tsx index 42e53a6355..e7c461a58f 100644 --- a/website/src/views/timetable/TimetableContainer.test.tsx +++ b/website/src/views/timetable/TimetableContainer.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { Redirect } from 'react-router-dom'; import { shallow, ShallowWrapper } from 'enzyme'; import { SemTimetableConfig } from 'types/timetables'; diff --git a/website/src/views/timetable/TimetableContainer.tsx b/website/src/views/timetable/TimetableContainer.tsx index 06c2a9267a..e050b329de 100644 --- a/website/src/views/timetable/TimetableContainer.tsx +++ b/website/src/views/timetable/TimetableContainer.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { PureComponent } from 'react'; import { connect } from 'react-redux'; import { Redirect, RouteComponentProps, withRouter } from 'react-router-dom'; import classnames from 'classnames'; @@ -62,7 +62,7 @@ type State = { * - Import timetable data from query string if action is defined * - Create the UI for the user to confirm their actions */ -export class TimetableContainerComponent extends React.PureComponent { +export class TimetableContainerComponent extends PureComponent { constructor(props: Props) { super(props); diff --git a/website/src/views/timetable/TimetableModuleTable.test.tsx b/website/src/views/timetable/TimetableModuleTable.test.tsx index 47862e8c9f..b1e2557f4b 100644 --- a/website/src/views/timetable/TimetableModuleTable.test.tsx +++ b/website/src/views/timetable/TimetableModuleTable.test.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { shallow, ShallowWrapper } from 'enzyme'; import { CS1010S, CS3216, CS4243 } from '__mocks__/modules'; diff --git a/website/src/views/today/DayHeader.test.tsx b/website/src/views/today/DayHeader.test.tsx index 910df27deb..311bc99fce 100644 --- a/website/src/views/today/DayHeader.test.tsx +++ b/website/src/views/today/DayHeader.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import { daysAfter } from 'utils/timify'; import DayHeader, { HeaderDate } from './DayHeader'; diff --git a/website/src/views/today/EmptyLessonGroup.tsx b/website/src/views/today/EmptyLessonGroup.tsx index 2183fcb60d..a2b77a70ce 100644 --- a/website/src/views/today/EmptyLessonGroup.tsx +++ b/website/src/views/today/EmptyLessonGroup.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { EmptyGroupType } from 'types/views'; import BeachIcon from 'img/icons/beach.svg'; diff --git a/website/src/views/today/EventMapInline/EventMapInline.tsx b/website/src/views/today/EventMapInline/EventMapInline.tsx index dabc664fd5..cf61ade005 100644 --- a/website/src/views/today/EventMapInline/EventMapInline.tsx +++ b/website/src/views/today/EventMapInline/EventMapInline.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import classnames from 'classnames'; import { LatLngTuple, Venue, VenueLocation, VenueLocationMap } from 'types/venues'; diff --git a/website/src/views/today/TodayContainer/TodayContainer.test.tsx b/website/src/views/today/TodayContainer/TodayContainer.test.tsx index 82bb3eec9b..7d25bd6795 100644 --- a/website/src/views/today/TodayContainer/TodayContainer.test.tsx +++ b/website/src/views/today/TodayContainer/TodayContainer.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { flatten, size } from 'lodash'; import { shallow } from 'enzyme'; diff --git a/website/src/views/today/TodayContainer/index.tsx b/website/src/views/today/TodayContainer/index.tsx index 1237b2f905..904e105c06 100644 --- a/website/src/views/today/TodayContainer/index.tsx +++ b/website/src/views/today/TodayContainer/index.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import Loadable, { LoadingComponentProps } from 'react-loadable'; import LoadingSpinner from 'views/components/LoadingSpinner'; diff --git a/website/src/views/venues/VenueLocation/FeedbackModal.tsx b/website/src/views/venues/VenueLocation/FeedbackModal.tsx index a4a8e9fd42..ed78f116fa 100644 --- a/website/src/views/venues/VenueLocation/FeedbackModal.tsx +++ b/website/src/views/venues/VenueLocation/FeedbackModal.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { PureComponent } from 'react'; import classnames from 'classnames'; import { VenueLocation } from 'types/venues'; @@ -23,7 +23,7 @@ type State = { readonly page: Page; }; -export default class FeedbackModal extends React.PureComponent { +export default class FeedbackModal extends PureComponent { state: State = { page: 'menu', }; diff --git a/website/src/views/venues/VenueLocation/VenueLocation.tsx b/website/src/views/venues/VenueLocation/VenueLocation.tsx index 6fce3949a0..de9c6087fd 100644 --- a/website/src/views/venues/VenueLocation/VenueLocation.tsx +++ b/website/src/views/venues/VenueLocation/VenueLocation.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { PureComponent } from 'react'; import classnames from 'classnames'; import { LatLngTuple, VenueLocation as VenueLocationItem, VenueLocationMap } from 'types/venues'; @@ -20,7 +20,7 @@ type State = { readonly isFeedbackModalOpen: boolean; }; -export default class VenueLocation extends React.PureComponent { +export default class VenueLocation extends PureComponent { state: State = { isFeedbackModalOpen: false, }; diff --git a/website/src/views/venues/VenuesContainer.test.tsx b/website/src/views/venues/VenuesContainer.test.tsx index a214b89bca..f5bdf1f304 100644 --- a/website/src/views/venues/VenuesContainer.test.tsx +++ b/website/src/views/venues/VenuesContainer.test.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { shallow } from 'enzyme'; import qs from 'query-string'; // eslint-disable-next-line import/no-extraneous-dependencies diff --git a/website/src/views/venues/VenuesContainer.tsx b/website/src/views/venues/VenuesContainer.tsx index 24fd9e0ab8..142b100d6d 100644 --- a/website/src/views/venues/VenuesContainer.tsx +++ b/website/src/views/venues/VenuesContainer.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import { Component } from 'react'; import { RouteComponentProps, withRouter } from 'react-router-dom'; import Loadable, { LoadingComponentProps } from 'react-loadable'; import classnames from 'classnames'; @@ -60,7 +60,7 @@ type State = { const pageHead = Venues; -export class VenuesContainerComponent extends React.Component { +export class VenuesContainerComponent extends Component { history: HistoryDebouncer; constructor(props: Props) { diff --git a/website/tsconfig.json b/website/tsconfig.json index 48ade7ed87..f47d159a2c 100644 --- a/website/tsconfig.json +++ b/website/tsconfig.json @@ -10,7 +10,7 @@ ] /* Specify library files to be included in the compilation. */, "allowJs": true /* Allow javascript files to be compiled. */, // "checkJs": true, /* Report errors in .js files. */ - "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, + "jsx": "preserve" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ diff --git a/website/yarn.lock b/website/yarn.lock index 7ca89d91e2..d8a19a5072 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -2350,15 +2350,14 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@hot-loader/react-dom@16.14.0": - version "16.14.0" - resolved "https://registry.yarnpkg.com/@hot-loader/react-dom/-/react-dom-16.14.0.tgz#3cfc64e40bb78fa623e59b582b8f09dcdaad648a" - integrity sha512-EN9czvcLsMYmSDo5yRKZOAq3ZGRlDpad1gPtX0NdMMomJXcPE3yFSeFzE94X/NjOaiSVimB7LuqPYpkWVaIi4Q== +"@hot-loader/react-dom@17.0.0": + version "17.0.0" + resolved "https://registry.yarnpkg.com/@hot-loader/react-dom/-/react-dom-17.0.0.tgz#1caa41d16006833717a8443d47e8677a9610dc7c" + integrity sha512-Po7ZIrs31ruikciz6bdUM2SNbz+I0ghIVFU+T5Gg9PBm05jn1lzKKysb2XGf4ZG/5og2nbqm4olUZw/lXEE3jg== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" - prop-types "^15.6.2" - scheduler "^0.19.1" + scheduler "^0.20.0" "@istanbuljs/load-nyc-config@^1.0.0": version "1.0.0" @@ -3554,6 +3553,21 @@ "@webassemblyjs/wast-parser" "1.9.0" "@xtuc/long" "4.2.2" +"@wojtekmaj/enzyme-adapter-react-17@0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@wojtekmaj/enzyme-adapter-react-17/-/enzyme-adapter-react-17-0.2.0.tgz#cf572e1bfaadf285fb69ffcca04b853abaef332d" + integrity sha512-B1hnjjbyODZt6z0HM4lwzWDiD7nGyRTSrBnR1Y8i+netl2c7Qvhgdp/MkL4VwQfAQnZ4VHDw6s8X2jCN4fORaA== + dependencies: + enzyme-adapter-utils "^1.13.1" + enzyme-shallow-equal "^1.0.4" + has "^1.0.3" + object.assign "^4.1.0" + object.values "^1.1.1" + prop-types "^15.7.2" + react-is "^16.13.1" + react-test-renderer "^17.0.0-0" + semver "^5.7.0" + "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" @@ -6412,21 +6426,6 @@ entities@^1.1.1, entities@~1.1.1: resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== -enzyme-adapter-react-16@1.15.5: - version "1.15.5" - resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.5.tgz#7a6f0093d3edd2f7025b36e7fbf290695473ee04" - integrity sha512-33yUJGT1nHFQlbVI5qdo5Pfqvu/h4qPwi1o0a6ZZsjpiqq92a3HjynDhwd1IeED+Su60HDWV8mxJqkTnLYdGkw== - dependencies: - enzyme-adapter-utils "^1.13.1" - enzyme-shallow-equal "^1.0.4" - has "^1.0.3" - object.assign "^4.1.0" - object.values "^1.1.1" - prop-types "^15.7.2" - react-is "^16.13.1" - react-test-renderer "^16.0.0-0" - semver "^5.7.0" - enzyme-adapter-utils@^1.13.1: version "1.13.1" resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.13.1.tgz#59c1b734b0927543e3d8dc477299ec957feb312d" @@ -6552,7 +6551,24 @@ es-abstract@^1.17.0-next.1: string.prototype.trimleft "^2.1.0" string.prototype.trimright "^2.1.0" -es-abstract@^1.17.4, es-abstract@^1.17.5: +es-abstract@^1.17.4: + version "1.17.7" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.7.tgz#a4de61b2f66989fc7421676c1cb9787573ace54c" + integrity sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g== + dependencies: + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + is-callable "^1.2.2" + is-regex "^1.1.1" + object-inspect "^1.8.0" + object-keys "^1.1.1" + object.assign "^4.1.1" + string.prototype.trimend "^1.0.1" + string.prototype.trimstart "^1.0.1" + +es-abstract@^1.17.5: version "1.17.6" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.6.tgz#9142071707857b2cacc7b89ecb670316c3e2d52a" integrity sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw== @@ -6569,7 +6585,7 @@ es-abstract@^1.17.4, es-abstract@^1.17.5: string.prototype.trimend "^1.0.1" string.prototype.trimstart "^1.0.1" -es-abstract@^1.18.0-next.0: +es-abstract@^1.18.0-next.0, es-abstract@^1.18.0-next.1: version "1.18.0-next.1" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0-next.1.tgz#6e3a0a4bda717e5023ab3b8e90bec36108d22c68" integrity sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA== @@ -11238,12 +11254,12 @@ object-is@^1.0.2: integrity sha512-Epah+btZd5wrrfjkJZq1AOB9O6OxUQto45hzFd7lXGrpHPGE0W1k+426yrZV+k6NJOzLNNW/nVsmZdIWsAqoOQ== object-is@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.2.tgz#c5d2e87ff9e119f78b7a088441519e2eec1573b6" - integrity sha512-5lHCz+0uufF6wZ7CRFWJN3hp8Jqblpgve06U5CMQ3f//6iDjPr2PEo9MWCjEssDsa+UZEL4PkFpr+BMop6aKzQ== + version "1.1.3" + resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.3.tgz#2e3b9e65560137455ee3bd62aec4d90a2ea1cc81" + integrity sha512-teyqLvFWzLkq5B9ki8FVWA902UER2qkxmdA4nLf+wjOLAWgxzCWZNCxpDq9MvE8MmhWNr+I8w3BN49Vx36Y6Xg== dependencies: define-properties "^1.1.3" - es-abstract "^1.17.5" + es-abstract "^1.18.0-next.1" object-keys@^1.0.11, object-keys@^1.0.12: version "1.1.0" @@ -12825,15 +12841,14 @@ react-dev-utils@10.2.1: strip-ansi "6.0.0" text-table "0.2.0" -react-dom@16.14.0: - version "16.14.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.14.0.tgz#7ad838ec29a777fb3c75c3a190f661cf92ab8b89" - integrity sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw== +react-dom@17.0.1: + version "17.0.1" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.1.tgz#1de2560474ec9f0e334285662ede52dbc5426fc6" + integrity sha512-6eV150oJZ9U2t9svnsspTMrWNyHc6chX0KzDeAOXftRa8bNeOKTTfCJ7KorIwenkHd2xqVTBTCZd79yk/lx/Ug== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" - prop-types "^15.6.2" - scheduler "^0.19.1" + scheduler "^0.20.1" react-error-overlay@^6.0.7: version "6.0.7" @@ -12895,6 +12910,11 @@ react-is@^16.12.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== +"react-is@^16.12.0 || ^17.0.0", react-is@^17.0.1: + version "17.0.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.1.tgz#5b3531bd76a645a4c9fb6e693ed36419e3301339" + integrity sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA== + react-is@^16.13.1: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" @@ -12905,7 +12925,7 @@ react-is@^16.6.0, react-is@^16.8.6: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA== -react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.3: +react-is@^16.7.0, react-is@^16.8.1: version "16.8.3" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.3.tgz#4ad8b029c2a718fc0cfc746c8d4e1b7221e5387d" integrity sha512-Y4rC1ZJmsxxkkPuMLwvKvlL1Zfpbcu+Bf4ZigkHup3v9EfdYhAlWAaVyA19olXq2o2mGn0w+dFKvk3pVVlYcIA== @@ -12915,11 +12935,6 @@ react-is@^16.9.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb" integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== -react-is@^17.0.1: - version "17.0.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.1.tgz#5b3531bd76a645a4c9fb6e693ed36419e3301339" - integrity sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA== - react-kawaii@0.16.0: version "0.16.0" resolved "https://registry.yarnpkg.com/react-kawaii/-/react-kawaii-0.16.0.tgz#6543f82a911269b9e7a470bf5316fe3976404636" @@ -13033,6 +13048,14 @@ react-scrollspy@3.4.3: classnames "^2.2.5" prop-types "^15.5.10" +react-shallow-renderer@^16.13.1: + version "16.14.1" + resolved "https://registry.yarnpkg.com/react-shallow-renderer/-/react-shallow-renderer-16.14.1.tgz#bf0d02df8a519a558fd9b8215442efa5c840e124" + integrity sha512-rkIMcQi01/+kxiTE9D3fdS959U1g7gs+/rborw++42m1O9FAQiNI/UNRZExVUoAOprn4umcXf+pFRou8i4zuBg== + dependencies: + object-assign "^4.1.1" + react-is "^16.12.0 || ^17.0.0" + react-side-effect@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-2.1.0.tgz#1ce4a8b4445168c487ed24dab886421f74d380d3" @@ -13048,24 +13071,23 @@ react-test-renderer@16.14.0: react-is "^16.8.6" scheduler "^0.19.1" -react-test-renderer@^16.0.0-0: - version "16.8.3" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.8.3.tgz#230006af264cc46aeef94392e04747c21839e05e" - integrity sha512-rjJGYebduKNZH0k1bUivVrRLX04JfIQ0FKJLPK10TAb06XWhfi4gTobooF9K/DEFNW98iGac3OSxkfIJUN9Mdg== +react-test-renderer@^17.0.0-0: + version "17.0.1" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-17.0.1.tgz#3187e636c3063e6ae498aedf21ecf972721574c7" + integrity sha512-/dRae3mj6aObwkjCcxZPlxDFh73XZLgvwhhyON2haZGUEhiaY5EjfAdw+d/rQmlcFwdTpMXCSGVk374QbCTlrA== dependencies: object-assign "^4.1.1" - prop-types "^15.6.2" - react-is "^16.8.3" - scheduler "^0.13.3" + react-is "^17.0.1" + react-shallow-renderer "^16.13.1" + scheduler "^0.20.1" -react@16.14.0: - version "16.14.0" - resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d" - integrity sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g== +react@17.0.1: + version "17.0.1" + resolved "https://registry.yarnpkg.com/react/-/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127" + integrity sha512-lG9c9UuMHdcAexXtigOZLX8exLWkW0Ku29qPRU8uhF2R9BN96dLCt0psvzPLlHc5OWkgymP3qwTRgbnw5BKx3w== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" - prop-types "^15.6.2" read-pkg-up@^1.0.1: version "1.0.1" @@ -13825,14 +13847,6 @@ saxes@^5.0.0: dependencies: xmlchars "^2.2.0" -scheduler@^0.13.3: - version "0.13.3" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.3.tgz#bed3c5850f62ea9c716a4d781f9daeb9b2a58896" - integrity sha512-UxN5QRYWtpR1egNWzJcVLk8jlegxAugswQc984lD3kU7NuobsO37/sRfbpTdBjtnD5TBNFA2Q2oLV5+UmPSmEQ== - dependencies: - loose-envify "^1.1.0" - object-assign "^4.1.1" - scheduler@^0.19.1: version "0.19.1" resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196" @@ -13841,6 +13855,14 @@ scheduler@^0.19.1: loose-envify "^1.1.0" object-assign "^4.1.1" +scheduler@^0.20.0, scheduler@^0.20.1: + version "0.20.1" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.1.tgz#da0b907e24026b01181ecbc75efdc7f27b5a000c" + integrity sha512-LKTe+2xNJBNxu/QhHvDR14wUXHRQbVY5ZOYpOGWRzhydZUqrLb2JBvLPY7cAqFmqrWuDED0Mjk7013SZiOz6Bw== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + schema-utils@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" @@ -13944,12 +13966,7 @@ semver@7.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -semver@^5.7.0: - version "5.7.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" - integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== - -semver@^5.7.1: +semver@^5.7.0, semver@^5.7.1: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==