1
0
mirror of https://github.com/BoostIo/Boostnote synced 2026-01-04 12:39:17 +00:00

fixed eslint warnings

This commit is contained in:
Maurits Lourens
2017-11-24 17:00:03 +01:00
parent 626175b2b8
commit 3fbc749395
72 changed files with 410 additions and 436 deletions

View File

@@ -56,7 +56,7 @@ class NoteDetail extends React.Component {
}
selectPriorSnippet () {
let { note } = this.props
const { note } = this.props
if (note.type === 'SNIPPET_NOTE' && note.snippets.length > 1) {
this.setState({
snippetIndex: (this.state.snippetIndex + note.snippets.length - 1) % note.snippets.length
@@ -65,7 +65,7 @@ class NoteDetail extends React.Component {
}
selectNextSnippet () {
let { note } = this.props
const { note } = this.props
if (note.type === 'SNIPPET_NOTE' && note.snippets.length > 1) {
this.setState({
snippetIndex: (this.state.snippetIndex + 1) % note.snippets.length
@@ -74,7 +74,7 @@ class NoteDetail extends React.Component {
}
saveToClipboard () {
let { note } = this.props
const { note } = this.props
if (note.type === 'MARKDOWN_NOTE') {
clipboard.writeText(note.content)
@@ -95,7 +95,7 @@ class NoteDetail extends React.Component {
}
render () {
let { note, config } = this.props
const { note, config } = this.props
if (note == null) {
return (
<div styleName='root' />
@@ -110,8 +110,8 @@ class NoteDetail extends React.Component {
const storage = findStorage(note.storage)
if (note.type === 'SNIPPET_NOTE') {
let tabList = note.snippets.map((snippet, index) => {
let isActive = this.state.snippetIndex === index
const tabList = note.snippets.map((snippet, index) => {
const isActive = this.state.snippetIndex === index
return <div styleName={isActive
? 'tabList-item--active'
: 'tabList-item'
@@ -131,8 +131,8 @@ class NoteDetail extends React.Component {
</div>
})
let viewList = note.snippets.map((snippet, index) => {
let isActive = this.state.snippetIndex === index
const viewList = note.snippets.map((snippet, index) => {
const isActive = this.state.snippetIndex === index
let syntax = CodeMirror.findModeByName(pass(snippet.mode))
if (syntax == null) syntax = CodeMirror.findModeByName('Plain Text')

View File

@@ -18,18 +18,18 @@ class NoteList extends React.Component {
}
componentDidUpdate () {
let { index } = this.props
const { index } = this.props
if (index > -1) {
let list = this.refs.root
let item = list.childNodes[index]
const list = this.refs.root
const item = list.childNodes[index]
if (item == null) return null
let overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0
const overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0
if (overflowBelow) {
list.scrollTop = item.offsetTop + item.clientHeight - list.clientHeight
}
let overflowAbove = list.scrollTop > item.offsetTop
const overflowAbove = list.scrollTop > item.offsetTop
if (overflowAbove) {
list.scrollTop = item.offsetTop
}
@@ -44,7 +44,7 @@ class NoteList extends React.Component {
}
handleScroll (e) {
let { notes } = this.props
const { notes } = this.props
if (e.target.offsetHeight + e.target.scrollTop > e.target.scrollHeight - 100 && notes.length > this.state.range * 10 + 10) {
this.setState({
@@ -54,9 +54,9 @@ class NoteList extends React.Component {
}
render () {
let { notes, index } = this.props
const { notes, index } = this.props
let notesList = notes
const notesList = notes
.slice(0, 10 + 10 * this.state.range)
.map((note, _index) => {
const isActive = (index === _index)

View File

@@ -19,18 +19,18 @@ class StorageSection extends React.Component {
}
handleHeaderClick (e) {
let { storage } = this.props
const { storage } = this.props
this.props.handleStorageButtonClick(e, storage.key)
}
handleFolderClick (e, folder) {
let { storage } = this.props
const { storage } = this.props
this.props.handleFolderButtonClick(e, storage.key, folder.key)
}
render () {
let { storage, filter } = this.props
let folderList = storage.folders
const { storage, filter } = this.props
const folderList = storage.folders
.map(folder => (
<StorageItem
key={folder.key}

View File

@@ -2,7 +2,6 @@ import React, { PropTypes } from 'react'
import ReactDOM from 'react-dom'
import { connect, Provider } from 'react-redux'
import _ from 'lodash'
import ipc from './ipcClient'
import store from './store'
import CSSModules from 'browser/lib/CSSModules'
import styles from './FinderMain.styl'
@@ -19,7 +18,7 @@ const { remote } = electron
const { Menu } = remote
function hideFinder () {
let finderWindow = remote.getCurrentWindow()
const finderWindow = remote.getCurrentWindow()
if (global.process.platform === 'win32') {
finderWindow.blur()
finderWindow.hide()
@@ -136,7 +135,7 @@ class FinderMain extends React.Component {
}
handleOnlySnippetCheckboxChange (e) {
let { filter } = this.state
const { filter } = this.state
filter.includeSnippet = e.target.checked
this.setState({
filter: filter,
@@ -147,7 +146,7 @@ class FinderMain extends React.Component {
}
handleOnlyMarkdownCheckboxChange (e) {
let { filter } = this.state
const { filter } = this.state
filter.includeMarkdown = e.target.checked
this.refs.list.resetScroll()
this.setState({
@@ -159,7 +158,7 @@ class FinderMain extends React.Component {
}
handleAllNotesButtonClick (e) {
let { filter } = this.state
const { filter } = this.state
filter.type = 'ALL'
this.refs.list.resetScroll()
this.setState({
@@ -171,7 +170,7 @@ class FinderMain extends React.Component {
}
handleStarredButtonClick (e) {
let { filter } = this.state
const { filter } = this.state
filter.type = 'STARRED'
this.refs.list.resetScroll()
this.setState({
@@ -183,7 +182,7 @@ class FinderMain extends React.Component {
}
handleStorageButtonClick (e, storage) {
let { filter } = this.state
const { filter } = this.state
filter.type = 'STORAGE'
filter.storage = storage
this.refs.list.resetScroll()
@@ -196,7 +195,7 @@ class FinderMain extends React.Component {
}
handleFolderButtonClick (e, storage, folder) {
let { filter } = this.state
const { filter } = this.state
filter.type = 'FOLDER'
filter.storage = storage
filter.folder = folder
@@ -218,12 +217,12 @@ class FinderMain extends React.Component {
}
render () {
let { data, config } = this.props
let { filter, search } = this.state
let storageList = []
for (let key in data.storageMap) {
let storage = data.storageMap[key]
let item = (
const { data, config } = this.props
const { filter, search } = this.state
const storageList = []
for (const key in data.storageMap) {
const storage = data.storageMap[key]
const item = (
<StorageSection
filter={filter}
storage={storage}
@@ -252,7 +251,7 @@ class FinderMain extends React.Component {
notes.push(data.noteMap[id])
})
} else {
for (let key in data.noteMap) {
for (const key in data.noteMap) {
notes.push(data.noteMap[key])
}
}
@@ -264,13 +263,13 @@ class FinderMain extends React.Component {
}
if (search.trim().length > 0) {
let needle = new RegExp(_.escapeRegExp(search.trim()), 'i')
const needle = new RegExp(_.escapeRegExp(search.trim()), 'i')
notes = notes.filter((note) => note.title.match(needle))
}
notes = notes
.sort((a, b) => new Date(b.updatedAt) - new Date(a.updatedAt))
let activeNote = notes[this.state.index]
const activeNote = notes[this.state.index]
this.noteCount = notes.length
return (

View File

@@ -10,7 +10,7 @@ nodeIpc.config.retry = 1500
nodeIpc.config.silent = true
function killFinder () {
let finderWindow = remote.getCurrentWindow()
const finderWindow = remote.getCurrentWindow()
finderWindow.removeAllListeners()
if (global.process.platform === 'darwin') {
// Only OSX has another app process.
@@ -21,7 +21,7 @@ function killFinder () {
}
function toggleFinder () {
let finderWindow = remote.getCurrentWindow()
const finderWindow = remote.getCurrentWindow()
if (global.process.platform === 'darwin') {
if (finderWindow.isVisible()) {
finderWindow.hide()

View File

@@ -2,7 +2,7 @@ import { combineReducers, createStore } from 'redux'
import { routerReducer } from 'react-router-redux'
import { DEFAULT_CONFIG } from 'browser/main/lib/ConfigManager'
let defaultData = {
const defaultData = {
storageMap: {},
noteMap: {},
starredSet: [],
@@ -40,12 +40,12 @@ function config (state = DEFAULT_CONFIG, action) {
return state
}
let reducer = combineReducers({
const reducer = combineReducers({
data,
config,
routing: routerReducer
})
let store = createStore(reducer)
const store = createStore(reducer)
export default store