Merge pull request #5579 from matrix-org/jryans/upgrade-deps-2021-01

Upgrade deps 2021-01
This commit is contained in:
J. Ryan Stinnett 2021-01-27 14:01:47 +00:00 committed by GitHub
commit de507b80f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 2453 additions and 3987 deletions

View file

@ -22,6 +22,8 @@ module.exports = {
"files": ["src/**/*.{ts,tsx}"], "files": ["src/**/*.{ts,tsx}"],
"extends": ["matrix-org/ts"], "extends": ["matrix-org/ts"],
"rules": { "rules": {
// We're okay being explicit at the moment
"@typescript-eslint/no-empty-interface": "off",
// We disable this while we're transitioning // We disable this while we're transitioning
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
// We'd rather not do this but we do // We'd rather not do this but we do

View file

@ -54,48 +54,47 @@
"test:e2e": "./test/end-to-end-tests/run.sh --app-url http://localhost:8080" "test:e2e": "./test/end-to-end-tests/run.sh --app-url http://localhost:8080"
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.12.5",
"await-lock": "^2.0.1", "await-lock": "^2.1.0",
"blueimp-canvas-to-blob": "^3.27.0", "blueimp-canvas-to-blob": "^3.28.0",
"browser-encrypt-attachment": "^0.3.0", "browser-encrypt-attachment": "^0.3.0",
"browser-request": "^0.3.3", "browser-request": "^0.3.3",
"cheerio": "^1.0.0-rc.3", "cheerio": "^1.0.0-rc.5",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"commonmark": "^0.29.1", "commonmark": "^0.29.3",
"counterpart": "^0.18.6", "counterpart": "^0.18.6",
"diff-dom": "^4.1.6", "diff-dom": "^4.2.2",
"diff-match-patch": "^1.0.5", "diff-match-patch": "^1.0.5",
"emojibase-data": "^5.0.1", "emojibase-data": "^5.1.1",
"emojibase-regex": "^4.0.1", "emojibase-regex": "^4.1.1",
"escape-html": "^1.0.3", "escape-html": "^1.0.3",
"file-saver": "^1.3.8", "file-saver": "^2.0.5",
"filesize": "3.6.1", "filesize": "6.1.0",
"flux": "2.1.1", "flux": "2.1.1",
"focus-visible": "^5.1.0", "focus-visible": "^5.2.0",
"fuse.js": "^2.7.4",
"gfm.css": "^1.1.2", "gfm.css": "^1.1.2",
"glob-to-regexp": "^0.4.1", "glob-to-regexp": "^0.4.1",
"highlight.js": "^10.1.2", "highlight.js": "^10.5.0",
"html-entities": "^1.3.1", "html-entities": "^1.4.0",
"is-ip": "^2.0.0", "is-ip": "^3.1.0",
"katex": "^0.12.0", "katex": "^0.12.0",
"linkifyjs": "^2.1.9", "linkifyjs": "^2.1.9",
"lodash": "^4.17.19", "lodash": "^4.17.20",
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
"matrix-widget-api": "0.1.0-beta.11", "matrix-widget-api": "0.1.0-beta.11",
"minimist": "^1.2.5", "minimist": "^1.2.5",
"pako": "^1.0.11", "pako": "^2.0.3",
"parse5": "^5.1.1", "parse5": "^6.0.1",
"png-chunks-extract": "^1.0.0", "png-chunks-extract": "^1.0.0",
"project-name-generator": "^2.1.7", "project-name-generator": "^2.1.9",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"qrcode": "^1.4.4", "qrcode": "^1.4.4",
"qs": "^6.9.4", "qs": "^6.9.6",
"re-resizable": "^6.5.4", "re-resizable": "^6.9.0",
"react": "^16.13.1", "react": "^16.14.0",
"react-beautiful-dnd": "^4.0.1", "react-beautiful-dnd": "^4.0.1",
"react-dom": "^16.13.1", "react-dom": "^16.14.0",
"react-focus-lock": "^2.4.1", "react-focus-lock": "^2.5.0",
"react-transition-group": "^4.4.1", "react-transition-group": "^4.4.1",
"resize-observer-polyfill": "^1.5.1", "resize-observer-polyfill": "^1.5.1",
"rfc4648": "^1.4.0", "rfc4648": "^1.4.0",
@ -108,68 +107,71 @@
"zxcvbn": "^4.4.2" "zxcvbn": "^4.4.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.10.5", "@babel/cli": "^7.12.10",
"@babel/core": "^7.10.5", "@babel/core": "^7.12.10",
"@babel/parser": "^7.11.0", "@babel/parser": "^7.12.11",
"@babel/plugin-proposal-class-properties": "^7.10.4", "@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.10.5", "@babel/plugin-proposal-decorators": "^7.12.12",
"@babel/plugin-proposal-export-default-from": "^7.10.4", "@babel/plugin-proposal-export-default-from": "^7.12.1",
"@babel/plugin-proposal-numeric-separator": "^7.10.4", "@babel/plugin-proposal-numeric-separator": "^7.12.7",
"@babel/plugin-proposal-object-rest-spread": "^7.10.4", "@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/plugin-transform-flow-comments": "^7.10.4", "@babel/plugin-transform-flow-comments": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.10.5", "@babel/plugin-transform-runtime": "^7.12.10",
"@babel/preset-env": "^7.10.4", "@babel/preset-env": "^7.12.11",
"@babel/preset-flow": "^7.10.4", "@babel/preset-flow": "^7.12.1",
"@babel/preset-react": "^7.10.4", "@babel/preset-react": "^7.12.10",
"@babel/preset-typescript": "^7.10.4", "@babel/preset-typescript": "^7.12.7",
"@babel/register": "^7.10.5", "@babel/register": "^7.12.10",
"@babel/traverse": "^7.11.0", "@babel/traverse": "^7.12.12",
"@peculiar/webcrypto": "^1.1.3", "@peculiar/webcrypto": "^1.1.4",
"@types/classnames": "^2.2.10", "@sinonjs/fake-timers": "^7.0.2",
"@types/classnames": "^2.2.11",
"@types/counterpart": "^0.18.1", "@types/counterpart": "^0.18.1",
"@types/flux": "^3.1.9", "@types/flux": "^3.1.9",
"@types/jest": "^26.0.20", "@types/jest": "^26.0.20",
"@types/linkifyjs": "^2.1.3", "@types/linkifyjs": "^2.1.3",
"@types/lodash": "^4.14.158", "@types/lodash": "^4.14.168",
"@types/modernizr": "^3.5.3", "@types/modernizr": "^3.5.3",
"@types/node": "^12.12.51", "@types/node": "^14.14.22",
"@types/pako": "^1.0.1", "@types/pako": "^1.0.1",
"@types/qrcode": "^1.3.4", "@types/qrcode": "^1.3.5",
"@types/react": "^16.9", "@types/react": "^16.9",
"@types/react-dom": "^16.9.8", "@types/react-dom": "^16.9.10",
"@types/react-transition-group": "^4.4.0", "@types/react-transition-group": "^4.4.0",
"@types/sanitize-html": "^1.23.3", "@types/sanitize-html": "^1.27.0",
"@types/zxcvbn": "^4.4.0", "@types/zxcvbn": "^4.4.0",
"@typescript-eslint/eslint-plugin": "^3.7.0", "@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^3.7.0", "@typescript-eslint/parser": "^4.14.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-jest": "^24.9.0", "babel-jest": "^26.6.3",
"chokidar": "^3.4.1", "chokidar": "^3.5.1",
"concurrently": "^4.1.2", "concurrently": "^5.3.0",
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2", "enzyme-adapter-react-16": "^1.15.6",
"eslint": "7.5.0", "eslint": "7.18.0",
"eslint-config-matrix-org": "^0.1.2", "eslint-config-matrix-org": "^0.2.0",
"eslint-plugin-babel": "^5.3.1", "eslint-plugin-babel": "^5.3.1",
"eslint-plugin-flowtype": "^2.50.3", "eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-react": "^7.20.3", "eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^2.5.1", "eslint-plugin-react-hooks": "^4.2.0",
"glob": "^5.0.15", "glob": "^7.1.6",
"jest": "^26.5.2", "jest": "^26.6.3",
"jest-canvas-mock": "^2.3.0", "jest-canvas-mock": "^2.3.0",
"jest-environment-jsdom-sixteen": "^1.0.3", "jest-environment-jsdom-sixteen": "^1.0.3",
"lolex": "^5.1.2",
"matrix-mock-request": "^1.2.3", "matrix-mock-request": "^1.2.3",
"matrix-react-test-utils": "^0.2.2", "matrix-react-test-utils": "^0.2.2",
"olm": "https://packages.matrix.org/npm/olm/olm-3.2.1.tgz", "olm": "https://packages.matrix.org/npm/olm/olm-3.2.1.tgz",
"react-test-renderer": "^16.13.1", "react-test-renderer": "^16.14.0",
"rimraf": "^2.7.1", "rimraf": "^3.0.2",
"stylelint": "^9.10.1", "stylelint": "^13.9.0",
"stylelint-config-standard": "^18.3.0", "stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.18.0", "stylelint-scss": "^3.18.0",
"typescript": "^3.9.7", "typescript": "^4.1.3",
"walk": "^2.3.14" "walk": "^2.3.14"
}, },
"resolutions": {
"**/@types/react": "^16.14"
},
"jest": { "jest": {
"testEnvironment": "./__test-utils__/environment.js", "testEnvironment": "./__test-utils__/environment.js",
"testMatch": [ "testMatch": [

View file

@ -219,7 +219,7 @@ hr.mx_RoomView_myReadMarker {
position: relative; position: relative;
top: -1px; top: -1px;
z-index: 1; z-index: 1;
transition: width 400ms easeInSine 1s, opacity 400ms easeInSine 1s; transition: width 400ms easeinsine 1s, opacity 400ms easeinsine 1s;
width: 99%; width: 99%;
opacity: 1; opacity: 1;
} }

View file

@ -56,7 +56,7 @@ export default abstract class BasePlatform {
this.startUpdateCheck = this.startUpdateCheck.bind(this); this.startUpdateCheck = this.startUpdateCheck.bind(this);
} }
abstract async getConfig(): Promise<{}>; abstract getConfig(): Promise<{}>;
abstract getDefaultDeviceDisplayName(): string; abstract getDefaultDeviceDisplayName(): string;

View file

@ -497,7 +497,7 @@ export default class ContentMessages {
content.info.mimetype = file.type; content.info.mimetype = file.type;
} }
const prom = new Promise((resolve) => { const prom = new Promise<void>((resolve) => {
if (file.type.indexOf('image/') === 0) { if (file.type.indexOf('image/') === 0) {
content.msgtype = 'm.image'; content.msgtype = 'm.image';
infoForImageFile(matrixClient, roomId, file).then((imageInfo) => { infoForImageFile(matrixClient, roomId, file).then((imageInfo) => {

View file

@ -840,7 +840,7 @@ export default class CountlyAnalytics {
let endTime = CountlyAnalytics.getTimestamp(); let endTime = CountlyAnalytics.getTimestamp();
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
if (!cli.getRoom(roomId)) { if (!cli.getRoom(roomId)) {
await new Promise(resolve => { await new Promise<void>(resolve => {
const handler = (room) => { const handler = (room) => {
if (room.roomId === roomId) { if (room.roomId === roomId) {
cli.off("Room", handler); cli.off("Room", handler);
@ -880,7 +880,7 @@ export default class CountlyAnalytics {
let endTime = CountlyAnalytics.getTimestamp(); let endTime = CountlyAnalytics.getTimestamp();
if (!room.findEventById(eventId)) { if (!room.findEventById(eventId)) {
await new Promise(resolve => { await new Promise<void>(resolve => {
const handler = (ev) => { const handler = (ev) => {
if (ev.getId() === eventId) { if (ev.getId() === eventId) {
room.off("Room.localEchoUpdated", handler); room.off("Room.localEchoUpdated", handler);

View file

@ -422,6 +422,8 @@ export function bodyToHtml(content: IContent, highlights: string[], opts: IOpts
if (SettingsStore.getValue("feature_latex_maths")) { if (SettingsStore.getValue("feature_latex_maths")) {
const phtml = cheerio.load(safeBody, const phtml = cheerio.load(safeBody,
{ _useHtmlParser2: true, decodeEntities: false }) { _useHtmlParser2: true, decodeEntities: false })
// @ts-ignore - The types for `replaceWith` wrongly expect
// Cheerio instance to be returned.
phtml('div, span[data-mx-maths!=""]').replaceWith(function(i, e) { phtml('div, span[data-mx-maths!=""]').replaceWith(function(i, e) {
return katex.renderToString( return katex.renderToString(
AllHtmlEntities.decode(phtml(e).attr('data-mx-maths')), AllHtmlEntities.decode(phtml(e).attr('data-mx-maths')),

View file

@ -165,6 +165,7 @@ export default class IdentityAuthClient {
}); });
const [confirmed] = await finished; const [confirmed] = await finished;
if (confirmed) { if (confirmed) {
// eslint-disable-next-line react-hooks/rules-of-hooks
useDefaultIdentityServer(); useDefaultIdentityServer();
} else { } else {
throw new AbortedIdentityActionError( throw new AbortedIdentityActionError(

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import commonmark from 'commonmark'; import * as commonmark from 'commonmark';
import {escape} from "lodash"; import {escape} from "lodash";
const ALLOWED_HTML_TAGS = ['sub', 'sup', 'del', 'u']; const ALLOWED_HTML_TAGS = ['sub', 'sup', 'del', 'u'];

View file

@ -56,7 +56,7 @@ const LeftPanelWidget: React.FC<IProps> = ({ onResize }) => {
const [height, setHeight] = useLocalStorageState("left-panel-widget-height", INITIAL_HEIGHT); const [height, setHeight] = useLocalStorageState("left-panel-widget-height", INITIAL_HEIGHT);
const [expanded, setExpanded] = useLocalStorageState("left-panel-widget-expanded", true); const [expanded, setExpanded] = useLocalStorageState("left-panel-widget-expanded", true);
useEffect(onResize, [expanded]); useEffect(onResize, [expanded, onResize]);
const [onFocus, isActive, ref] = useRovingTabIndex(); const [onFocus, isActive, ref] = useRovingTabIndex();
const tabIndex = isActive ? 0 : -1; const tabIndex = isActive ? 0 : -1;

View file

@ -20,7 +20,6 @@ import * as React from "react";
import {_t} from '../../languageHandler'; import {_t} from '../../languageHandler';
import * as sdk from "../../index"; import * as sdk from "../../index";
import AutoHideScrollbar from './AutoHideScrollbar'; import AutoHideScrollbar from './AutoHideScrollbar';
import { ReactNode } from "react";
/** /**
* Represents a tab for the TabbedView. * Represents a tab for the TabbedView.

View file

@ -196,7 +196,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
// Validation and state updates are async, so we need to wait for them to complete // Validation and state updates are async, so we need to wait for them to complete
// first. Queue a `setState` callback and wait for it to resolve. // first. Queue a `setState` callback and wait for it to resolve.
await new Promise(resolve => this.setState({}, resolve)); await new Promise<void>(resolve => this.setState({}, resolve));
if (this.allFieldsValid()) { if (this.allFieldsValid()) {
return true; return true;

View file

@ -194,7 +194,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
// Validation and state updates are async, so we need to wait for them to complete // Validation and state updates are async, so we need to wait for them to complete
// first. Queue a `setState` callback and wait for it to resolve. // first. Queue a `setState` callback and wait for it to resolve.
await new Promise(resolve => this.setState({}, resolve)); await new Promise<void>(resolve => this.setState({}, resolve));
if (this.allFieldsValid()) { if (this.allFieldsValid()) {
return true; return true;

View file

@ -77,7 +77,7 @@ export const useWidgets = (room: Room) => {
setApps([...WidgetStore.instance.getApps(room.roomId)]); setApps([...WidgetStore.instance.getApps(room.roomId)]);
}, [room]); }, [room]);
useEffect(updateApps, [room]); useEffect(updateApps, [room, updateApps]);
useEventEmitter(WidgetStore.instance, room.roomId, updateApps); useEventEmitter(WidgetStore.instance, room.roomId, updateApps);
useEventEmitter(WidgetLayoutStore.instance, WidgetLayoutStore.emissionForRoom(room), updateApps); useEventEmitter(WidgetLayoutStore.instance, WidgetLayoutStore.emissionForRoom(room), updateApps);

View file

@ -519,7 +519,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
private async tabCompleteName(event: React.KeyboardEvent) { private async tabCompleteName(event: React.KeyboardEvent) {
try { try {
await new Promise(resolve => this.setState({showVisualBell: false}, resolve)); await new Promise<void>(resolve => this.setState({showVisualBell: false}, resolve));
const {model} = this.props; const {model} = this.props;
const caret = this.getCaret(); const caret = this.getCaret();
const position = model.positionForOffset(caret.offset, caret.atNodeEnd); const position = model.positionForOffset(caret.offset, caret.atNodeEnd);

View file

@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import React, { createRef, CSSProperties, ReactNode } from 'react'; import React, { createRef, CSSProperties } from 'react';
import dis from '../../../dispatcher/dispatcher'; import dis from '../../../dispatcher/dispatcher';
import CallHandler from '../../../CallHandler'; import CallHandler from '../../../CallHandler';
import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {MatrixClientPeg} from '../../../MatrixClientPeg';

View file

@ -235,7 +235,7 @@ export async function downloadBugReport(opts: IOpts = {}) {
let i = 0; let i = 0;
for (const [key, value] of body.entries()) { for (const [key, value] of body.entries()) {
if (key === 'compressed-log') { if (key === 'compressed-log') {
await new Promise((resolve => { await new Promise<void>((resolve => {
const reader = new FileReader(); const reader = new FileReader();
reader.addEventListener('loadend', ev => { reader.addEventListener('loadend', ev => {
tape.append(`log-${i++}.log`, new TextDecoder().decode(ev.target.result as ArrayBuffer)); tape.append(`log-${i++}.log`, new TextDecoder().decode(ev.target.result as ArrayBuffer));
@ -269,7 +269,7 @@ function uint8ToString(buf: Buffer) {
} }
function _submitReport(endpoint: string, body: FormData, progressCallback: (string) => void) { function _submitReport(endpoint: string, body: FormData, progressCallback: (string) => void) {
return new Promise((resolve, reject) => { return new Promise<void>((resolve, reject) => {
const req = new XMLHttpRequest(); const req = new XMLHttpRequest();
req.open("POST", endpoint); req.open("POST", endpoint);
req.timeout = 5 * 60 * 1000; req.timeout = 5 * 60 * 1000;

View file

@ -43,7 +43,7 @@ export abstract class AsyncStoreWithClient<T extends Object> extends AsyncStore<
})(dispatcher); })(dispatcher);
} }
protected get matrixClient(): MatrixClient { get matrixClient(): MatrixClient {
return this.readyStore.mxClient; return this.readyStore.mxClient;
} }
@ -55,7 +55,7 @@ export abstract class AsyncStoreWithClient<T extends Object> extends AsyncStore<
// Default implementation is to do nothing. // Default implementation is to do nothing.
} }
protected abstract async onAction(payload: ActionPayload); protected abstract onAction(payload: ActionPayload): Promise<void>;
protected async onDispatch(payload: ActionPayload) { protected async onDispatch(payload: ActionPayload) {
await this.onAction(payload); await this.onAction(payload);

View file

@ -89,10 +89,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
return this.algorithm.getOrderedRooms(); return this.algorithm.getOrderedRooms();
} }
public get matrixClient(): MatrixClient {
return super.matrixClient;
}
// Intended for test usage // Intended for test usage
public async resetStore() { public async resetStore() {
await this.reset(); await this.reset();

View file

@ -1,5 +1,5 @@
/* /*
Copyright 2019 New Vector Ltd Copyright 2019, 2021 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import lolex from 'lolex'; import FakeTimers from '@sinonjs/fake-timers';
import EventEmitter from 'events'; import EventEmitter from 'events';
import UserActivity from '../src/UserActivity'; import UserActivity from '../src/UserActivity';
@ -39,7 +39,7 @@ describe('UserActivity', function() {
fakeDocument = new FakeDomEventEmitter(); fakeDocument = new FakeDomEventEmitter();
userActivity = new UserActivity(fakeWindow, fakeDocument); userActivity = new UserActivity(fakeWindow, fakeDocument);
userActivity.start(); userActivity.start();
clock = lolex.install(); clock = FakeTimers.install();
}); });
afterEach(function() { afterEach(function() {

6258
yarn.lock

File diff suppressed because it is too large Load diff