Convert CommonJS exports to ES6-compatible exports

We use `export default` begrudgingly here. Ideally we'd use just `export`, though this entire SDK expects things to be exported as a default. Instead of breaking everything, we'll sacrifice our export pattern for a smaller diff - a later commit can always do the default export -> regular export conversion.
This commit is contained in:
Travis Ralston 2019-12-19 17:45:24 -07:00
parent 0b0fe92b17
commit 344dac4fb9
147 changed files with 649 additions and 620 deletions

View file

@ -1,6 +1,7 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -20,7 +21,7 @@ import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import { _t } from '../../languageHandler';
module.exports = createReactClass({
export default createReactClass({
displayName: 'CompatibilityPage',
propTypes: {
onAccept: PropTypes.func,

View file

@ -1,5 +1,6 @@
/*
Copyright 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -126,4 +127,4 @@ const FilePanel = createReactClass({
},
});
module.exports = FilePanel;
export default FilePanel;

View file

@ -308,4 +308,4 @@ const LeftPanel = createReactClass({
},
});
module.exports = LeftPanel;
export default LeftPanel;

View file

@ -1,6 +1,7 @@
/*
Copyright 2016 OpenMarket Ltd
Copyright 2019 New Vector Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -60,4 +61,4 @@ const NotificationPanel = createReactClass({
},
});
module.exports = NotificationPanel;
export default NotificationPanel;

View file

@ -38,7 +38,7 @@ function track(action) {
Analytics.trackEvent('RoomDirectory', action);
}
module.exports = createReactClass({
export default createReactClass({
displayName: 'RoomDirectory',
propTypes: {

View file

@ -1,6 +1,7 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
Copyright 2017, 2018 New Vector Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -38,7 +39,7 @@ function getUnsentMessages(room) {
});
}
module.exports = createReactClass({
export default createReactClass({
displayName: 'RoomStatusBar',
propTypes: {

View file

@ -72,7 +72,7 @@ const RoomContext = PropTypes.shape({
room: PropTypes.instanceOf(Room),
});
module.exports = createReactClass({
export default createReactClass({
displayName: 'RoomView',
propTypes: {
ConferenceHandler: PropTypes.any,

View file

@ -84,7 +84,7 @@ if (DEBUG_SCROLL) {
* offset as normal.
*/
module.exports = createReactClass({
export default createReactClass({
displayName: 'ScrollPanel',
propTypes: {

View file

@ -24,7 +24,7 @@ import { throttle } from 'lodash';
import AccessibleButton from '../../components/views/elements/AccessibleButton';
import classNames from 'classnames';
module.exports = createReactClass({
export default createReactClass({
displayName: 'SearchBox',
propTypes: {

View file

@ -1347,4 +1347,4 @@ const TimelinePanel = createReactClass({
},
});
module.exports = TimelinePanel;
export default TimelinePanel;

View file

@ -1,5 +1,6 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -22,7 +23,7 @@ const dis = require('../../dispatcher');
const filesize = require('filesize');
import { _t } from '../../languageHandler';
module.exports = createReactClass({
export default createReactClass({
displayName: 'UploadBar',
propTypes: {
room: PropTypes.object,

View file

@ -1,6 +1,7 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -23,7 +24,7 @@ import {_t} from "../../languageHandler";
import sdk from "../../index";
module.exports = createReactClass({
export default createReactClass({
displayName: 'ViewSource',
propTypes: {

View file

@ -40,7 +40,7 @@ const PHASE_EMAIL_SENT = 3;
// User has clicked the link in email and completed reset
const PHASE_DONE = 4;
module.exports = createReactClass({
export default createReactClass({
displayName: 'ForgotPassword',
propTypes: {

View file

@ -54,7 +54,7 @@ _td("General failure");
/**
* A wire component which glues together login UI components and Login logic
*/
module.exports = createReactClass({
export default createReactClass({
displayName: 'Login',
propTypes: {

View file

@ -22,7 +22,7 @@ import MatrixClientPeg from '../../../MatrixClientPeg';
import { _t } from '../../../languageHandler';
import AuthPage from "../../views/auth/AuthPage";
module.exports = createReactClass({
export default createReactClass({
displayName: 'PostRegistration',
propTypes: {

View file

@ -41,7 +41,7 @@ const PHASE_REGISTRATION = 1;
// Enable phases for registration
const PHASES_ENABLED = true;
module.exports = createReactClass({
export default createReactClass({
displayName: 'Registration',
propTypes: {