From 33ef54a16259439cf392fd5437d20c74d97ebabe Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Sat, 3 Feb 2018 14:16:26 +0900 Subject: [PATCH] Fix lint errors --- browser/lib/context.js | 2 +- browser/main/NoteList/index.js | 28 +++++++++---------- browser/main/SideNav/StorageItem.js | 4 +-- .../main/modals/PreferencesModal/InfoTab.js | 6 ++-- .../modals/PreferencesModal/StoragesTab.js | 2 +- browser/main/modals/PreferencesModal/index.js | 6 ++-- browser/main/store.js | 8 ++---- 7 files changed, 25 insertions(+), 31 deletions(-) diff --git a/browser/lib/context.js b/browser/lib/context.js index 417712b8..6c82e6a2 100644 --- a/browser/lib/context.js +++ b/browser/lib/context.js @@ -2,7 +2,7 @@ const { remote } = require('electron') const { Menu, MenuItem } = remote function popup (templates) { - let menu = new Menu() + const menu = new Menu() templates.forEach((item) => { menu.append(new MenuItem(item)) }) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 8adaf1a0..24799641 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -169,9 +169,8 @@ class NoteList extends React.Component { if (this.notes == null || this.notes.length === 0) { return } - let { router } = this.context - let { location } = this.props - let { selectedNoteKeys, shiftKeyDown } = this.state + let { selectedNoteKeys } = this.state + const { shiftKeyDown } = this.state let targetIndex = this.getTargetIndex() @@ -197,9 +196,8 @@ class NoteList extends React.Component { if (this.notes == null || this.notes.length === 0) { return } - let { router } = this.context - let { location } = this.props - let { selectedNoteKeys, shiftKeyDown } = this.state + let { selectedNoteKeys } = this.state + const { shiftKeyDown } = this.state let targetIndex = this.getTargetIndex() const isTargetLastNote = targetIndex === this.notes.length - 1 @@ -240,7 +238,6 @@ class NoteList extends React.Component { } handleNoteListKeyDown (e) { - const { shiftKeyDown } = this.state if (e.metaKey || e.ctrlKey) return true if (e.keyCode === 65 && !e.shiftKey) { @@ -282,7 +279,7 @@ class NoteList extends React.Component { getNotes () { const { data, params, location } = this.props - if (location.pathname.match(/\/home/) || location.pathname.match(/\alltags/)) { + if (location.pathname.match(/\/home/) || location.pathname.match(/alltags/)) { const allNotes = data.noteMap.map((note) => note) this.contextNotes = allNotes return allNotes @@ -353,9 +350,10 @@ class NoteList extends React.Component { } handleNoteClick (e, uniqueKey) { - let { router } = this.context - let { location } = this.props - let { shiftKeyDown, selectedNoteKeys } = this.state + const { router } = this.context + const { location } = this.props + let { selectedNoteKeys } = this.state + const { shiftKeyDown } = this.state if (shiftKeyDown && selectedNoteKeys.includes(uniqueKey)) { const newSelectedNoteKeys = selectedNoteKeys.filter((noteKey) => noteKey !== uniqueKey) @@ -640,9 +638,10 @@ class NoteList extends React.Component { } render () { - let { location, notes, config, dispatch } = this.props - let { selectedNoteKeys } = this.state - let sortFunc = config.sortBy === 'CREATED_AT' + const { location, config } = this.props + let { notes } = this.props + const { selectedNoteKeys } = this.state + const sortFunc = config.sortBy === 'CREATED_AT' ? sortByCreatedAt : config.sortBy === 'ALPHABETICAL' ? sortByAlphabetical @@ -687,7 +686,6 @@ class NoteList extends React.Component { config.sortBy === 'CREATED_AT' ? note.createdAt : note.updatedAt ).fromNow('D') - const key = `${note.storage}-${note.key}` if (isDefault) { return ( diff --git a/browser/main/SideNav/StorageItem.js b/browser/main/SideNav/StorageItem.js index bbf87306..5d7e6005 100644 --- a/browser/main/SideNav/StorageItem.js +++ b/browser/main/SideNav/StorageItem.js @@ -8,12 +8,10 @@ import CreateFolderModal from 'browser/main/modals/CreateFolderModal' import RenameFolderModal from 'browser/main/modals/RenameFolderModal' import dataApi from 'browser/main/lib/dataApi' import StorageItemChild from 'browser/components/StorageItem' -import eventEmitter from 'browser/main/lib/eventEmitter' import _ from 'lodash' -import * as path from 'path' const { remote } = require('electron') -const { Menu, MenuItem, dialog } = remote +const { Menu, dialog } = remote class StorageItem extends React.Component { constructor (props) { diff --git a/browser/main/modals/PreferencesModal/InfoTab.js b/browser/main/modals/PreferencesModal/InfoTab.js index ac3afb0b..48f1ea01 100644 --- a/browser/main/modals/PreferencesModal/InfoTab.js +++ b/browser/main/modals/PreferencesModal/InfoTab.js @@ -31,7 +31,7 @@ class InfoTab extends React.Component { } handleSaveButtonClick (e) { - let newConfig = { + const newConfig = { amaEnabled: this.state.config.amaEnabled } @@ -140,7 +140,7 @@ class InfoTab extends React.Component {
Analytics
Boostnote collects anonymous data for the sole purpose of improving the application, and strictly does not collect any personal information such the contents of your notes.
You can see how it works on this.handleLinkClick(e)}>GitHub.
-
+
You can choose to enable or disable this option.
this.handleConfigChange(e)} checked={this.state.config.amaEnabled} @@ -149,7 +149,7 @@ class InfoTab extends React.Component { /> Enable analytics to help improve Boostnote
-
+
{this.infoMessage()} ) diff --git a/browser/main/modals/PreferencesModal/StoragesTab.js b/browser/main/modals/PreferencesModal/StoragesTab.js index 76e69f87..f66a617e 100644 --- a/browser/main/modals/PreferencesModal/StoragesTab.js +++ b/browser/main/modals/PreferencesModal/StoragesTab.js @@ -167,7 +167,7 @@ class StoragesTab extends React.Component {
- Setting up 3rd-party cloud storage integration: + Setting up 3rd-party cloud storage integration:{' '} this.handleLinkClick(e)} >Cloud-Syncing-and-Backup diff --git a/browser/main/modals/PreferencesModal/index.js b/browser/main/modals/PreferencesModal/index.js index 228a08f4..574b5186 100644 --- a/browser/main/modals/PreferencesModal/index.js +++ b/browser/main/modals/PreferencesModal/index.js @@ -1,6 +1,5 @@ import PropTypes from 'prop-types' import React from 'react' -import ReactDOM from 'react-dom' import { connect } from 'react-redux' import HotkeyTab from './HotkeyTab' import UiTab from './UiTab' @@ -11,6 +10,7 @@ import ModalEscButton from 'browser/components/ModalEscButton' import CSSModules from 'browser/lib/CSSModules' import styles from './PreferencesModal.styl' import RealtimeNotification from 'browser/components/RealtimeNotification' +import _ from 'lodash' class Preferences extends React.Component { constructor (props) { @@ -94,8 +94,8 @@ class Preferences extends React.Component { } getContentBoundingBox () { - const node = ReactDOM.findDOMNode(this.refs.content) - return node.getBoundingClientRect() + console.log(this.refs.content.getBoundingClientRect()) + return this.refs.content.getBoundingClientRect() } haveToSaveNotif (type, message) { diff --git a/browser/main/store.js b/browser/main/store.js index 36e7850d..abd34889 100644 --- a/browser/main/store.js +++ b/browser/main/store.js @@ -355,11 +355,9 @@ function data (state = defaultDataMap(), action) { state.storageMap.set(action.storage.key, action.storage) return state case 'EXPORT_FOLDER': - { - state = Object.assign({}, state) - state.storageMap = new Map(state.storageMap) - state.storageMap.set(action.storage.key, action.storage) - } + state = Object.assign({}, state) + state.storageMap = new Map(state.storageMap) + state.storageMap.set(action.storage.key, action.storage) return state case 'DELETE_FOLDER': {