Skip to content

Commit

Permalink
Lint Fixes (#1782)
Browse files Browse the repository at this point in the history
* Lint Fixes

* Fix more lint issues
  • Loading branch information
belcherj authored Dec 17, 2019
1 parent 1b052b6 commit b7d9925
Show file tree
Hide file tree
Showing 34 changed files with 145 additions and 95 deletions.
8 changes: 4 additions & 4 deletions after_sign_hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = async function(params) {
}

if (!process.env.CIRCLE_TAG || process.env.CIRCLE_TAG.length === 0) {
console.log('Not on a tag. Skipping notarization');
console.log('Not on a tag. Skipping notarization'); // eslint-disable-line no-console
return;
}

Expand All @@ -27,7 +27,7 @@ module.exports = async function(params) {
throw new Error(`Cannot find application at: ${appPath}`);
}

console.log(`Notarizing ${appId} found at ${appPath}`);
console.log(`Notarizing ${appId} found at ${appPath}`); // eslint-disable-line no-console

try {
await electron_notarize.notarize({
Expand All @@ -38,8 +38,8 @@ module.exports = async function(params) {
ascProvider: 'AutomatticInc',
});
} catch (error) {
console.error(error);
console.error(error); // eslint-disable-line no-console
}

console.log(`Done notarizing ${appId}`);
console.log(`Done notarizing ${appId}`); // eslint-disable-line no-console
};
2 changes: 1 addition & 1 deletion desktop/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var app = require('./app')();
require('./app')();
8 changes: 4 additions & 4 deletions desktop/updater/lib/Updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Updater extends EventEmitter {
ping() {}

onDownloaded(event) {
console.log('Update downloaded');
console.log('Update downloaded'); // eslint-disable-line no-console

// electron-updater provides us with new version
if (event.version) {
Expand All @@ -32,11 +32,11 @@ class Updater extends EventEmitter {
}

onNotAvailable() {
console.log('Update is not available');
console.log('Update is not available'); // eslint-disable-line no-console
}

onError(event) {
console.log('Update error', event);
console.log('Update error', event); // eslint-disable-line no-console
}

onConfirm() {}
Expand Down Expand Up @@ -94,7 +94,7 @@ class Updater extends EventEmitter {
let text = originalText;

for (const key in macros) {
if (macros.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(macros, key)) {
text = text.replace(new RegExp(`{${key}}`, 'ig'), macros[key]);
}
}
Expand Down
7 changes: 4 additions & 3 deletions desktop/updater/manual-updater/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ManualUpdater extends Updater {

if (releaseResp.status !== 200) {
this.emit('error');
console.log(releaseResp);
console.log(releaseResp); // eslint-disable-line no-console
return;
}

Expand All @@ -58,14 +58,15 @@ class ManualUpdater extends Updater {

if (configResp.status !== 200) {
this.emit('error');
console.log(configResp);
console.log(configResp); // eslint-disable-line no-console
return;
}

const configBody = await configResp.text();
const releaseConfig = yaml.safeLoad(configBody);

if (semver.lt(app.getVersion(), releaseConfig.version)) {
// eslint-disable-next-line no-console
console.log(
'New update is available, prompting user to update to',
releaseConfig.version
Expand All @@ -79,7 +80,7 @@ class ManualUpdater extends Updater {
}
} catch (err) {
this.emit('error');
console.log(err.message);
console.log(err.message); // eslint-disable-line no-console
}
}

Expand Down
1 change: 1 addition & 0 deletions get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function readConfig() {
}
return config;
} catch (e) {
// eslint-disable-next-line no-console
console.error(
'Could not read in the required configuration file.\n' +
'This file should exist as `config.json` inside the project root directory.\n' +
Expand Down
5 changes: 5 additions & 0 deletions lib/components/boot-warning/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';

import './style';

const BootWarning = ({ children }) => (
<h3 className="boot-warning__message">{children}</h3>
);

BootWarning.propTypes = {
children: PropTypes.node.isRequired,
};

export default BootWarning;
1 change: 0 additions & 1 deletion lib/components/clipboard-button/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import ReactDom from 'react-dom';
import Clipboard from 'clipboard';

function ClipboardButton({ text }) {
Expand Down
6 changes: 6 additions & 0 deletions lib/context-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export class ContextMenu extends Component {
}
}

ContextMenu.propTypes = {
children: PropTypes.node.isRequired,
currentWindow: PropTypes.object.isRequired,
Menu: PropTypes.object.isRequired,
};

export const MenuItem = () => null;
MenuItem.displayName = 'MenuItem';

Expand Down
9 changes: 8 additions & 1 deletion lib/controls/checkbox/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';

export default function CheckboxControl({ className, ...props }) {
function CheckboxControl({ className, ...props }) {
return (
<span className={classNames('checkbox-control', className)}>
<input type="checkbox" {...props} />
Expand All @@ -11,3 +12,9 @@ export default function CheckboxControl({ className, ...props }) {
</span>
);
}

CheckboxControl.propTypes = {
className: PropTypes.string.isRequired,
};

export default CheckboxControl;
9 changes: 8 additions & 1 deletion lib/controls/toggle/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';

export default function ToggleControl({ className, ...props }) {
function ToggleControl({ className, ...props }) {
return (
<span className={classNames('toggle-control', className)}>
<input type="checkbox" {...props} />
Expand All @@ -13,3 +14,9 @@ export default function ToggleControl({ className, ...props }) {
</span>
);
}

ToggleControl.propTypes = {
className: PropTypes.string,
};

export default ToggleControl;
1 change: 0 additions & 1 deletion lib/dialogs/import/source-importer/executor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class ImportExecutor extends React.Component {
}, 200);
break;
default:
console.log(`Unrecognized status event type "${type}"`);
}
});
return thisImporter;
Expand Down
4 changes: 2 additions & 2 deletions lib/dialogs/import/source-importer/utils/test-importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { EventEmitter } from 'events';
class TestImporter extends EventEmitter {
constructor(arg) {
super();
console.log(arg);
console.log(arg); // eslint-disable-line no-console
}

importNotes(files) {
console.log(files);
console.log(files); // eslint-disable-line no-console

let count = 0;
const counter = window.setInterval(() => {
Expand Down
8 changes: 8 additions & 0 deletions lib/dialogs/radio-settings-group.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';

import CheckboxControl from '../controls/checkbox';

Expand All @@ -13,4 +14,11 @@ const RadioGroup = ({ groupSlug, slug, isEnabled, onChange }) => (
/>
);

RadioGroup.propTypes = {
groupSlug: PropTypes.string,
slug: PropTypes.string,
isEnabled: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired,
};

export default RadioGroup;
6 changes: 6 additions & 0 deletions lib/dialogs/settings-group.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ export const SettingsGroup = ({
};

SettingsGroup.propTypes = {
activeSlug: PropTypes.string,
children: PropTypes.node,
description: PropTypes.string,
learnMoreURL: PropTypes.string,
onChange: PropTypes.func,
renderer: PropTypes.func,
slug: PropTypes.string,
title: PropTypes.string,
};

export default SettingsGroup;
3 changes: 0 additions & 3 deletions lib/dialogs/settings/panels/account.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';

import PanelTitle from '../../../components/panel-title';
import SettingsGroup, { Item } from '../../settings-group';
import ToggleGroup from '../../toggle-settings-group';
import TopRightArrowIcon from '../../../icons/arrow-top-right';

import getConfig from '../../../../get-config';
import { viewExternalUrl } from '../../../utils/url-utils';

const AccountPanel = props => {
Expand Down
8 changes: 8 additions & 0 deletions lib/dialogs/toggle-settings-group.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';

import ToggleControl from '../controls/toggle';

Expand All @@ -12,4 +13,11 @@ const ToggleGroup = ({ groupSlug, slug, isEnabled, onChange }) => (
/>
);

ToggleGroup.propTypes = {
groupSlug: PropTypes.string,
slug: PropTypes.string,
isEnabled: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired,
};

export default ToggleGroup;
1 change: 1 addition & 0 deletions lib/editable-list/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class EditableList extends Component {
static displayName = 'EditableList';

static propTypes = {
className: PropTypes.string,
editing: PropTypes.bool.isRequired,
items: PropTypes.array.isRequired,
renderItem: PropTypes.func.isRequired,
Expand Down
1 change: 1 addition & 0 deletions lib/editor/css-class-wrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const CssClassWrapper = ({ children, className }) => (
);

CssClassWrapper.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string.isRequired,
};

Expand Down
1 change: 1 addition & 0 deletions lib/note-content-editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class NoteContentEditor extends Component {
content: PropTypes.shape({
text: PropTypes.string.isRequired,
hasRemoteUpdate: PropTypes.bool.isRequired,
version: PropTypes.string,
}),
filter: PropTypes.string.isRequired,
noteId: PropTypes.string,
Expand Down
2 changes: 0 additions & 2 deletions lib/note-detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { get, debounce, noop } from 'lodash';
import classNames from 'classnames';

import analytics from '../analytics';
import appState from '../flux/app-state';
import { viewExternalUrl } from '../utils/url-utils';
Expand Down
2 changes: 1 addition & 1 deletion lib/note-detail/render-to-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const renderToNode = (node, content) => {
.then(({ default: highlight }) => {
codeElements.forEach(highlight.highlightBlock);
})
.catch(console.log);
.catch();
}
});
};
Expand Down
2 changes: 2 additions & 0 deletions lib/note-info/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import filterNotes from '../utils/filter-notes';

export class NoteInfo extends Component {
static propTypes = {
isMarkdown: PropTypes.bool.isRequired,
isPinned: PropTypes.bool.isRequired,
note: PropTypes.object,
markdownEnabled: PropTypes.bool,
onPinNote: PropTypes.func.isRequired,
Expand Down
7 changes: 7 additions & 0 deletions lib/note-list/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,11 @@ const mapDispatchToProps = (dispatch, { noteBucket }) => ({
onPinNote: (note, pin) => dispatch(pinNote({ noteBucket, note, pin })),
});

NoteList.propTypes = {
hasLoaded: PropTypes.bool.isRequired,
nextNote: PropTypes.object,
prevNote: PropTypes.object,
selectedNoteContent: PropTypes.string,
};

export default connect(mapStateToProps, mapDispatchToProps)(NoteList);
8 changes: 8 additions & 0 deletions lib/search-bar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';

/**
* Internal dependencies
Expand Down Expand Up @@ -53,4 +54,11 @@ const mapDispatchToProps = (dispatch, { noteBucket, onNoteOpened }) => ({

SearchBar.displayName = 'SearchBar';

SearchBar.propTypes = {
onNewNote: PropTypes.func.isRequired,
onToggleNavigation: PropTypes.func.isRequired,
query: PropTypes.string,
showTrash: PropTypes.bool.isRequired,
};

export default connect(mapStateToProps, mapDispatchToProps)(SearchBar);
1 change: 1 addition & 0 deletions lib/search-field/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class SearchField extends Component {
static displayName = 'SearchField';

static propTypes = {
filter: PropTypes.string,
isTagSelected: PropTypes.bool.isRequired,
placeholder: PropTypes.string.isRequired,
searchFocus: PropTypes.bool.isRequired,
Expand Down
1 change: 0 additions & 1 deletion lib/state/domain/notes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { noteBucket } from './buckets';
import appState from '../../flux/app-state';
import isEmailTag from '../../utils/is-email-tag';
import { createTag } from './tags';

Expand Down
6 changes: 4 additions & 2 deletions lib/state/domain/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export const renameTag = ({ tag, name: newName }) => (dispatch, getState) => {
...note,
data: {
...note.data,
tags: note.data.tags.map(tag => (tag === tagName ? name : tag)),
tags: note.data.tags.map(noteTag =>
noteTag === tagName ? name : noteTag
),
},
}))
.forEach(note => noteBucket().update(note.id, note.data));
Expand All @@ -65,7 +67,7 @@ export const trashTag = ({ tag }) => (dispatch, getState) => {
...note,
data: {
...note.data,
tags: note.data.tags.filter(tag => tag !== tagName),
tags: note.data.tags.filter(noteTag => noteTag !== tagName),
},
}))
.forEach(note => noteBucket().update(note.id, note.data));
Expand Down
1 change: 1 addition & 0 deletions lib/tag-suggestions/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class TagSuggestions extends Component {

static propTypes = {
filteredTags: PropTypes.array.isRequired,
onSearch: PropTypes.func.isRequired,
query: PropTypes.string.isRequired,
};

Expand Down
Loading

0 comments on commit b7d9925

Please sign in to comment.