Fix ESLint error

This commit is contained in:
Yuya Ochiai
2018-06-15 22:28:50 +09:00
parent 86743fea43
commit 681572c512
5 changed files with 58 additions and 37 deletions

View File

@@ -1,24 +1,31 @@
const React = require('react');
const propTypes = require('prop-types');
const {Button, Navbar, ProgressBar} = require('react-bootstrap');
// Copyright (c) 2015-2016 Yuya Ochiai
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import propTypes from 'prop-types';
import {Button, Navbar, ProgressBar} from 'react-bootstrap';
function InstallButton(props) {
if (props.notifyOnly) {
return (<Button
bsStyle='primary'
onClick={props.onClickDownload}
>{'Download Update'}</Button>);
return (
<Button
bsStyle='primary'
onClick={props.onClickDownload}
>{'Download Update'}</Button>
);
}
return (<Button
bsStyle='primary'
onClick={props.onClickInstall}
>{'Install Update'}</Button>);
return (
<Button
bsStyle='primary'
onClick={props.onClickInstall}
>{'Install Update'}</Button>
);
}
InstallButton.propTypes = {
notifyOnly: propTypes.bool.isRequired,
onClickInstall: propTypes.func.isRequired,
onClickDownload: propTypes.func.isRequired
onClickDownload: propTypes.func.isRequired,
};
function UpdaterPage(props) {
@@ -84,7 +91,7 @@ UpdaterPage.propTypes = {
onClickDownload: propTypes.func.isRequired,
onClickReleaseNotes: propTypes.func.isRequired,
onClickRemind: propTypes.func.isRequired,
onClickSkip: propTypes.func.isRequired
onClickSkip: propTypes.func.isRequired,
};
module.exports = UpdaterPage;
export default UpdaterPage;

View File

@@ -1,9 +1,14 @@
const React = require('react');
const ReactDOM = require('react-dom');
const propTypes = require('prop-types');
const {ipcRenderer} = require('electron');
const url = require('url');
const UpdaterPage = require('./components/UpdaterPage.jsx');
// Copyright (c) 2015-2016 Yuya Ochiai
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import url from 'url';
import React from 'react';
import ReactDOM from 'react-dom';
import propTypes from 'prop-types';
import {ipcRenderer} from 'electron';
import UpdaterPage from './components/UpdaterPage.jsx';
const thisURL = url.parse(location.href, true);
const notifyOnly = thisURL.query.notifyOnly === 'true';
@@ -17,12 +22,12 @@ class UpdaterPageContainer extends React.Component {
componentDidMount() {
ipcRenderer.on('start-download', () => {
this.setState({
isDownloading: true
isDownloading: true,
});
});
ipcRenderer.on('progress', (event, progress) => {
this.setState({
progress
progress,
});
});
}
@@ -54,7 +59,7 @@ class UpdaterPageContainer extends React.Component {
UpdaterPageContainer.propTypes = {
notifyOnly: propTypes.bool,
initialState: propTypes.object
initialState: propTypes.object,
};
ReactDOM.render(

View File

@@ -25,7 +25,7 @@ import {parse as parseArgv} from 'yargs';
import {protocols} from '../electron-builder.json';
import CriticalErrorHandler from './main/CriticalErrorHandler';
import {upgradeAutoLaunch} from './main/autoLaunch';
import upgradeAutoLaunch from './main/autoLaunch';
import buildConfig from './common/config/buildConfig';
const criticalErrorHandler = new CriticalErrorHandler();

View File

@@ -1,4 +1,7 @@
const AutoLaunch = require('auto-launch');
// Copyright (c) 2015-2016 Yuya Ochiai
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import AutoLaunch from 'auto-launch';
async function upgradeAutoLaunch() {
if (process.platform === 'darwin') {
@@ -6,7 +9,7 @@ async function upgradeAutoLaunch() {
}
const appLauncher = new AutoLaunch({
name: 'Mattermost',
isHidden: true
isHidden: true,
});
const enabled = await appLauncher.isEnabled();
if (enabled) {
@@ -14,4 +17,4 @@ async function upgradeAutoLaunch() {
}
}
module.exports = {upgradeAutoLaunch};
export default upgradeAutoLaunch;

View File

@@ -1,8 +1,14 @@
const {app, BrowserWindow, dialog, ipcMain, shell} = require('electron');
const fs = require('fs');
const path = require('path');
const {autoUpdater} = require('electron-updater');
const semver = require('semver');
// Copyright (c) 2015-2016 Yuya Ochiai
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import fs from 'fs';
import path from 'path';
import {app, BrowserWindow, dialog, ipcMain, shell} from 'electron';
import {autoUpdater} from 'electron-updater';
import semver from 'semver';
const INTERVAL_48_HOURS_IN_MS = 172800000; // 48 * 60 * 60 * 1000 [ms]
@@ -28,7 +34,7 @@ function createUpdaterModal(parentWindow, options) {
width: windowWidth,
height: windowHeight,
resizable: false,
autoHideMenuBar: true
autoHideMenuBar: true,
};
if (process.platform === 'linux') {
windowOptions.icon = options.linuxAppIcon;
@@ -87,7 +93,7 @@ function initialize(appState, mainWindow, notifyOnly = false) {
if (isUpdateApplicable(new Date(), appState.skippedVersion, info)) {
updaterModal = createUpdaterModal(mainWindow, {
linuxAppIcon: path.join(assetsDir, 'appicon.png'),
notifyOnly
notifyOnly,
});
updaterModal.on('closed', () => {
updaterModal = null;
@@ -123,7 +129,7 @@ function initialize(appState, mainWindow, notifyOnly = false) {
type: 'info',
buttons: ['Close'],
title: 'Your Desktop App is up to date',
message: 'You have the latest version of the Mattermost Desktop App.'
message: 'You have the latest version of the Mattermost Desktop App.',
}, () => {}); // eslint-disable-line no-empty-function
}
setTimeout(() => {
@@ -169,10 +175,10 @@ function loadConfig(file) {
return new AutoUpdaterConfig(file);
}
module.exports = {
export default {
INTERVAL_48_HOURS_IN_MS,
checkForUpdates,
shouldCheckForUpdatesOnStart,
initialize,
loadConfig
loadConfig,
};