Skip to content

Commit

Permalink
lint...
Browse files Browse the repository at this point in the history
  • Loading branch information
Raul Rosenlöcher committed Jul 31, 2018
1 parent 80a1b78 commit 2c7fa5e
Show file tree
Hide file tree
Showing 45 changed files with 172 additions and 227 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"node": true
},
"rules": {
"arrow-parens": ["off"],
"arrow-body-style": "off",
"arrow-parens": "off",
"class-methods-use-this": "off",
"comma-dangle": "off",
"compat/compat": "error",
"consistent-return": "off",
Expand All @@ -25,7 +26,9 @@
"jsx-a11y/anchor-is-valid": "off",
"no-bitwise": "off",
"no-console": "off",
"no-constant-condition": "off",
"no-continue": "off",
"no-else-return": "off",
"no-lonely-if": "off",
"no-multi-assign": "off",
"no-param-reassign": "off",
Expand Down
5 changes: 2 additions & 3 deletions app/common/store/contextReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class ContextReducer {
// .....................................................

reduce(state = ContextReducer.defaultState(), action) {
const func = ".reduce";
const func = ".reduce"; // eslint-disable-line no-unused-vars
let actionType = '???';

try {
Expand Down Expand Up @@ -65,8 +65,7 @@ export class ContextReducer {
// .....................................................

initReducer(state, action) {
const func = ".init";
//log.debug(`${this._logKey}${func} - in`);
const func = ".init"; // eslint-disable-line no-unused-vars

const {
isDevelopment, isDevtool, isProduction, isTest, isScreensaver,
Expand Down
6 changes: 3 additions & 3 deletions app/common/store/crawlerReducer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import log from 'electron-log';
import * as constants from '../constants';
import deepEquals from 'deep-equal';
import deepmerge from 'deepmerge';
import * as constants from '../constants';

// ----------------------------------------------------------------------------------

Expand Down Expand Up @@ -51,7 +51,7 @@ export class CrawlerReducer {
// .....................................................

reduce(state = CrawlerReducer.defaultState(), action) {
const func = ".reduce";
const func = ".reduce"; // eslint-disable-line no-unused-vars
let actionType = '???';

try {
Expand Down Expand Up @@ -83,7 +83,7 @@ export class CrawlerReducer {
// .....................................................

initReducer(state, action) {
const func = ".init";
const func = ".init"; // eslint-disable-line no-unused-vars

const {
batchCount, databasePath,
Expand Down
2 changes: 0 additions & 2 deletions app/common/store/mainWindowActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import * as constants from "../constants";
import {valiBoolean, valiInt} from "../utils/validate";
import * as configUtils from "../utils/fileUtils";

export const createActionInitReducer = ({
x, y, height, width,
Expand Down
5 changes: 3 additions & 2 deletions app/common/store/mainWindowReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class MainWindowReducer {
// .....................................................

reduce(state = MainWindowReducer.defaultState(), action) {
const func = ".reduce";
const func = ".reduce"; // eslint-disable-line no-unused-vars
let actionType = '???';

try {
Expand Down Expand Up @@ -62,7 +62,8 @@ export class MainWindowReducer {
// .....................................................

initReducer(state, action) {
const func = ".init";
const func = ".init"; // eslint-disable-line no-unused-vars

//log.debug(`${this._logKey}${func} - action`, action);

const {
Expand Down
2 changes: 1 addition & 1 deletion app/common/store/messageReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class MessageReducer {
// .....................................................

reduce(state = MessageReducer.defaultState(), action) {
const func = ".reduce";
const func = ".reduce"; // eslint-disable-line no-unused-vars
let actionType = '???';

try {
Expand Down
2 changes: 1 addition & 1 deletion app/common/store/rendererReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class RendererReducer {
// .....................................................

addFiles(state, action) {
const func = ".addFiles";
const func = ".addFiles"; // eslint-disable-line no-unused-vars

this.setNewDeliveryKey(action.payload.items);

Expand Down
3 changes: 1 addition & 2 deletions app/common/store/slideshowReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ export class SlideshowReducer {
// .....................................................

initReducer(state, action) {
//const func = ".init";
//log.debug(`${this._logKey}${func} - in`);
const func = ".init"; // eslint-disable-line no-unused-vars

const {
autoPlay,
Expand Down
7 changes: 3 additions & 4 deletions app/common/store/storeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const _logKey = "storeManager";
export class StoreManager {

constructor(myself, targets) {
const func = ".constructor";

this._logKey = `${_logKey}(${myself})`;
this._myself = myself;
Expand Down Expand Up @@ -146,7 +145,7 @@ export class StoreManager {

// ........................................................

hookActionWasDispatched(action) {
hookActionWasDispatched(action) { // eslint-disable-line no-unused-vars
// has to be overridden by sub classes
}

Expand Down Expand Up @@ -229,8 +228,8 @@ export class StoreManager {
// ........................................................
// progress

get workerState() {
return this.state.worker;
get progressState() {
return this.state.progress;
}

// ........................................................
Expand Down
4 changes: 2 additions & 2 deletions app/common/store/systemReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class SystemReducer {
// .....................................................

reduce(state = SystemReducer.defaultState(), action) {
const func = ".reduce";
const func = ".reduce"; // eslint-disable-line no-unused-vars
let actionType = '???';

try {
Expand All @@ -57,7 +57,7 @@ export class SystemReducer {
// .....................................................

initReducer(state, action) {
const func = ".init";
const func = ".init"; // eslint-disable-line no-unused-vars
//log.debug(`${this._logKey}${func} - in`);

const {
Expand Down
13 changes: 8 additions & 5 deletions app/main/mainOps.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,19 @@ export function copyMeta2Clipboard() {
if (meta.file) delete meta.file;
if (meta.filename) delete meta.filename;

const keys = Object.keys(meta);

let maxLengthKey = 8;
for (const key in meta) {
const l = key.length;

for (let i = 0; i < keys.length; i++) {
const l = keys[i].length;
if (maxLengthKey < l)
maxLengthKey = l;
}

const lines = [];
for (let key in meta) {
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const line = `${key.padEnd(maxLengthKey)} : ${meta[key]}\n`;
lines.push(line);
}
Expand All @@ -398,8 +401,8 @@ export function copyMeta2Clipboard() {
const date = new Date(currentItem.meta.time).toLocaleString();

let text = `${'file'.padEnd(maxLengthKey)} : ${currentItem.file}\n`;
text = text + `${'date'.padEnd(maxLengthKey)} : ${date}\n`;
text = text + lines.join('');
text += `${'date'.padEnd(maxLengthKey)} : ${date}\n`;
text += lines.join('');

clipboard.writeText(text);

Expand Down
2 changes: 1 addition & 1 deletion app/main/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function checkAndCorrectMainWindowBounds(settings, screenSize) {

resetBounds = false;

} while (false); // eslint-disable-line no-constant-condition
} while (false);

if (resetBounds) {
/* eslint-disable no-param-reassign */
Expand Down
29 changes: 15 additions & 14 deletions app/renderer/containers/MessageDialog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import {connect} from "react-redux";
import log from 'electron-log';
import { Button, Dialog, Intent, Icon} from '@blueprintjs/core';
import { Button, Dialog, Icon} from '@blueprintjs/core';
import * as actionsMsg from "../../common/store/messageActions";
import * as constants from "../../common/constants";

Expand Down Expand Up @@ -55,15 +54,15 @@ class MessageDialog extends React.Component {
switch (message.msgType) {
case constants.MSG_TYPE_ERROR:
title = "Error";
icon = <Icon icon="error" color="red"/>;
icon = <Icon icon="error" color="red" />;
break;
case constants.MSG_TYPE_WARNING:
title = "Warning";
icon = <Icon icon="error" color="yellow"/>;
icon = <Icon icon="error" color="yellow" />;
break;
default: // MSG_TYPE_INFO
title = "Info";
icon = <Icon icon="info-sign"/>;
icon = <Icon icon="info-sign" />;
break;
}

Expand All @@ -84,15 +83,17 @@ class MessageDialog extends React.Component {
<div className="pt-dialog-footer">
<div className="pt-dialog-footer-actions">

<table className={cssTableClass}><tbody>
<tr>
<td>{showMore && `(${props.messages.length - 1} more messages)`}</td>
<td>
{showMore && <Button onClick={this.onCloseAll} text="Close all" />}
<Button onClick={this.onNext} text={showMore ? "Next" : "Close"} />
</td>
</tr>
</tbody></table>
<table className={cssTableClass}>
<tbody>
<tr>
<td>{showMore && `(${props.messages.length - 1} more messages)`}</td>
<td>
{showMore && <Button onClick={this.onCloseAll} text="Close all" />}
<Button onClick={this.onNext} text={showMore ? "Next" : "Close"} />
</td>
</tr>
</tbody>
</table>
</div>
</div>
</Dialog>
Expand Down
54 changes: 45 additions & 9 deletions app/renderer/containers/aboutOverlay.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import {connect} from "react-redux";
import log from 'electron-log';
import { Button } from '@blueprintjs/core';
Expand All @@ -15,23 +16,38 @@ const _logKey = "aboutOverlay";

class AboutOverlay extends React.Component {

static onClick() {
onClick() {
ops.openUrl(constants.APP_URL);
}

static onClose() {
onClose() {
const action = rendererActions.createActionAboutClose();
storeManager.dispatchGlobal(action);
}

onUrlKeyDown(event) {
if(event.keyCode === 13)
this.onClick()
}

render() {
const func = '.render';

try {
return (

<div className={"popover-dialog"}>
<h3>about <a className="popover-link" onClick={this.onClick}>{constants.APP_TITLE}</a></h3>
<div className="popover-dialog">
<h3>about
<a
role="link"
tabIndex={0}
className="popover-link"
onClick={this.onClick}
onKeyDown={this.onUrlKeyDown}
>
{constants.APP_TITLE}
</a>
</h3>

<p>
written by {constants.APP_CREATOR}
Expand All @@ -40,16 +56,28 @@ class AboutOverlay extends React.Component {
<table className="popover-table">
<tbody>

<tr><td>{constants.APP_TITLE} website</td><td><a className="popover-link" onClick={AboutOverlay.onClick}>{constants.APP_URL}</a></td></tr>
<tr><td>{constants.APP_TITLE} version</td><td>{constants.APP_VERSION}</td></tr>

<tr><td>electron version</td><td>{this.props.versionElectron}</td></tr>
<tr>
<td>{constants.APP_TITLE} website</td>
<td>
<a
role="link"
tabIndex={0}
className="popover-link"
onKeyDown={this.onUrlKeyDown}
onClick={AboutOverlay.onClick}
>
{constants.APP_URL}
</a>
</td>
</tr>
<tr><td>{constants.APP_TITLE} version</td><td>{constants.APP_VERSION}</td></tr>
<tr><td>electron version</td><td>{this.props.versionElectron}</td></tr>

</tbody>
</table>

<p />
<Button className="popover-button" onClick={AboutOverlay.onClose}>Close</Button>
<Button role="button" tabIndex={0} className="popover-button" onClick={AboutOverlay.onClose}>Close</Button>
</div>
);

Expand All @@ -64,6 +92,14 @@ class AboutOverlay extends React.Component {

// ----------------------------------------------------------------------------------

AboutOverlay.propTypes = {
versionElectron: PropTypes.string
};

AboutOverlay.defaultProps = {
versionElectron: '?.?.?',
};

const mapStateToProps = state => ({
versionElectron: state.context.versionElectron,
});
Expand Down
Loading

0 comments on commit 2c7fa5e

Please sign in to comment.