Skip to content

Commit 359f673

Browse files
authored
Merge pull request #317 from BoostIO/feature-add-esilnt-rule
Add prefer-const rule and fix code
2 parents 44dd609 + 1d3e71c commit 359f673

File tree

12 files changed

+32
-30
lines changed

12 files changed

+32
-30
lines changed

.eslintrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"extends": ["standard", "standard-jsx"],
33
"rules": {
4-
"no-useless-escape": 0
4+
"no-useless-escape": 0,
5+
"prefer-const": "warn",
6+
"no-unused-vars": "warn",
7+
"no-undef": "warn",
8+
"no-lone-blocks": "warn"
59
}
610
}

browser/components/CodeEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default class CodeEditor extends React.Component {
8686
Enter: (cm) => {
8787
const cursor = cm.getCursor()
8888
const line = cm.getLine(cursor.line)
89-
let bulletType;
89+
let bulletType
9090
if (line.trim().startsWith('- ')) {
9191
bulletType = 1 // dash
9292
} else if (line.trim().startsWith('* ')) {

browser/components/MarkdownEditor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class MarkdownEditor extends React.Component {
161161
this.renderPreview(this.props.value)
162162
}
163163

164-
handleKeyDown(e) {
164+
handleKeyDown (e) {
165165
if (this.state.status !== 'CODE') return false
166166
const keyPressed = Object.assign(this.state.keyPressed, {
167167
[e.key]: true
@@ -183,7 +183,7 @@ class MarkdownEditor extends React.Component {
183183
const currentCaret = this.refs.code.editor.getCursor()
184184
const cmDoc = this.refs.code.editor.getDoc()
185185
cmDoc.replaceRange(mdElement, currentCaret)
186-
this.refs.code.editor.setCursor({line: currentCaret.line, ch: currentCaret.ch + mdElement.length/2})
186+
this.refs.code.editor.setCursor({ line: currentCaret.line, ch: currentCaret.ch + mdElement.length / 2 })
187187
}
188188

189189
addMdBetweenWord (mdElement) {

browser/components/MarkdownPreview.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export default class MarkdownPreview extends React.Component {
152152
exportAsDocument (fileType) {
153153
const options = {
154154
filters: [
155-
{ name: 'Documents', extensions: [fileType]}
155+
{ name: 'Documents', extensions: [fileType] }
156156
],
157157
properties: ['openFile', 'createDirectory']
158158
}
@@ -333,7 +333,7 @@ export default class MarkdownPreview extends React.Component {
333333
}
334334
}
335335

336-
preventImageDroppedHandler(e) {
336+
preventImageDroppedHandler (e) {
337337
e.preventDefault()
338338
e.stopPropagation()
339339
}

browser/finder/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class FinderMain extends React.Component {
6868

6969
handleWindowBlur (e) {
7070
this.setState({
71-
search: '',
71+
search: ''
7272
})
7373
}
7474

browser/main/Detail/MarkdownNoteDetail.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,15 @@ class MarkdownNoteDetail extends React.Component {
275275
</div>
276276
<div styleName='info-right'>
277277
{(() => {
278-
const faClassName=`fa ${this.getToggleLockButton()}`
278+
const faClassName = `fa ${this.getToggleLockButton()}`
279279
const lockButtonComponent =
280280
<button styleName='control-lockButton'
281281
onFocus={(e) => this.handleFocus(e)}
282282
onMouseDown={(e) => this.handleLockButtonMouseDown(e)}
283283
>
284-
<i className={faClassName} styleName='lock-button'/>
284+
<i className={faClassName} styleName='lock-button' />
285285
<span styleName='control-lockButton-tooltip'>
286-
{this.state.isLocked ? 'Unlock' : 'Lock'}
286+
{this.state.isLocked ? 'Unlock' : 'Lock'}
287287
</span>
288288
</button>
289289
return (
@@ -293,15 +293,15 @@ class MarkdownNoteDetail extends React.Component {
293293
<button styleName='control-trashButton'
294294
onClick={(e) => this.handleContextButtonClick(e)}
295295
>
296-
<svg height="17px" id="Capa_1" style={{"enableBackground":"new 0 0 753.23 753.23"}} width="17px" version="1.1" viewBox="0 0 753.23 753.23" x="0px" y="0px" xmlSpace="preserve">
297-
<g>
298-
<g id="_x34__19_">
299-
<g>
300-
<path d="M494.308,659.077c12.993,0,23.538-10.546,23.538-23.539V353.077c0-12.993-10.545-23.539-23.538-23.539&#xA;&#x9;&#x9;&#x9;&#x9;s-23.538,10.545-23.538,23.539v282.461C470.77,648.531,481.314,659.077,494.308,659.077z M635.538,94.154h-141.23V47.077&#xA;&#x9;&#x9;&#x9;&#x9;C494.308,21.067,473.24,0,447.23,0H306c-26.01,0-47.077,21.067-47.077,47.077v47.077h-141.23&#xA;&#x9;&#x9;&#x9;&#x9;c-26.01,0-47.077,21.067-47.077,47.077v47.077c0,25.986,21.067,47.077,47.077,47.077v423.692&#xA;&#x9;&#x9;&#x9;&#x9;c0,51.996,42.157,94.153,94.154,94.153h329.539c51.996,0,94.153-42.157,94.153-94.153V235.385&#xA;&#x9;&#x9;&#x9;&#x9;c26.01,0,47.077-21.091,47.077-47.077V141.23C682.615,115.221,661.548,94.154,635.538,94.154z M306,70.615&#xA;&#x9;&#x9;&#x9;&#x9;c0-12.993,10.545-23.539,23.538-23.539h94.154c12.993,0,23.538,10.545,23.538,23.539v23.539c-22.809,0-141.23,0-141.23,0V70.615z&#xA;&#x9;&#x9;&#x9;&#x9; M588.461,659.077c0,25.986-21.066,47.076-47.076,47.076H211.846c-26.01,0-47.077-21.09-47.077-47.076V235.385h423.692V659.077z&#xA;&#x9;&#x9;&#x9;&#x9; M612,188.308H141.23c-12.993,0-23.538-10.545-23.538-23.539s10.545-23.539,23.538-23.539H612&#xA;&#x9;&#x9;&#x9;&#x9;c12.993,0,23.538,10.545,23.538,23.539S624.993,188.308,612,188.308z M258.923,659.077c12.993,0,23.539-10.546,23.539-23.539&#xA;&#x9;&#x9;&#x9;&#x9;V353.077c0-12.993-10.545-23.539-23.539-23.539s-23.539,10.545-23.539,23.539v282.461&#xA;&#x9;&#x9;&#x9;&#x9;C235.384,648.531,245.93,659.077,258.923,659.077z M376.615,659.077c12.993,0,23.538-10.546,23.538-23.539V353.077&#xA;&#x9;&#x9;&#x9;&#x9;c0-12.993-10.545-23.539-23.538-23.539s-23.539,10.545-23.539,23.539v282.461C353.077,648.531,363.622,659.077,376.615,659.077z"/>
301-
</g>
302-
</g>
303-
</g>
304-
</svg>
296+
<svg height='17px' id='Capa_1' style={{enableBackground: 'new 0 0 753.23 753.23'}} width='17px' version='1.1' viewBox='0 0 753.23 753.23' x='0px' y='0px' xmlSpace='preserve'>
297+
<g>
298+
<g id='_x34__19_'>
299+
<g>
300+
<path d='M494.308,659.077c12.993,0,23.538-10.546,23.538-23.539V353.077c0-12.993-10.545-23.539-23.538-23.539&#xA;&#x9;&#x9;&#x9;&#x9;s-23.538,10.545-23.538,23.539v282.461C470.77,648.531,481.314,659.077,494.308,659.077z M635.538,94.154h-141.23V47.077&#xA;&#x9;&#x9;&#x9;&#x9;C494.308,21.067,473.24,0,447.23,0H306c-26.01,0-47.077,21.067-47.077,47.077v47.077h-141.23&#xA;&#x9;&#x9;&#x9;&#x9;c-26.01,0-47.077,21.067-47.077,47.077v47.077c0,25.986,21.067,47.077,47.077,47.077v423.692&#xA;&#x9;&#x9;&#x9;&#x9;c0,51.996,42.157,94.153,94.154,94.153h329.539c51.996,0,94.153-42.157,94.153-94.153V235.385&#xA;&#x9;&#x9;&#x9;&#x9;c26.01,0,47.077-21.091,47.077-47.077V141.23C682.615,115.221,661.548,94.154,635.538,94.154z M306,70.615&#xA;&#x9;&#x9;&#x9;&#x9;c0-12.993,10.545-23.539,23.538-23.539h94.154c12.993,0,23.538,10.545,23.538,23.539v23.539c-22.809,0-141.23,0-141.23,0V70.615z&#xA;&#x9;&#x9;&#x9;&#x9; M588.461,659.077c0,25.986-21.066,47.076-47.076,47.076H211.846c-26.01,0-47.077-21.09-47.077-47.076V235.385h423.692V659.077z&#xA;&#x9;&#x9;&#x9;&#x9; M612,188.308H141.23c-12.993,0-23.538-10.545-23.538-23.539s10.545-23.539,23.538-23.539H612&#xA;&#x9;&#x9;&#x9;&#x9;c12.993,0,23.538,10.545,23.538,23.539S624.993,188.308,612,188.308z M258.923,659.077c12.993,0,23.539-10.546,23.539-23.539&#xA;&#x9;&#x9;&#x9;&#x9;V353.077c0-12.993-10.545-23.539-23.539-23.539s-23.539,10.545-23.539,23.539v282.461&#xA;&#x9;&#x9;&#x9;&#x9;C235.384,648.531,245.93,659.077,258.923,659.077z M376.615,659.077c12.993,0,23.538-10.546,23.538-23.539V353.077&#xA;&#x9;&#x9;&#x9;&#x9;c0-12.993-10.545-23.539-23.538-23.539s-23.539,10.545-23.539,23.539v282.461C353.077,648.531,363.622,659.077,376.615,659.077z' />
301+
</g>
302+
</g>
303+
</g>
304+
</svg>
305305
</button>
306306
</div>
307307
</div>

browser/main/Detail/SnippetNoteDetail.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,11 @@ class SnippetNoteDetail extends React.Component {
550550
<button styleName='control-trashButton'
551551
onClick={(e) => this.handleContextButtonClick(e)}
552552
>
553-
<svg height="17px" id="Capa_1" style={{"enableBackground":"new 0 0 753.23 753.23"}} width="17px" version="1.1" viewBox="0 0 753.23 753.23" x="0px" y="0px" xmlSpace="preserve">
553+
<svg height='17px' id='Capa_1' style={{enableBackground: 'new 0 0 753.23 753.23'}} width='17px' version='1.1' viewBox='0 0 753.23 753.23' x='0px' y='0px' xmlSpace='preserve'>
554554
<g>
555-
<g id="_x34__19_">
555+
<g id='_x34__19_'>
556556
<g>
557-
<path d="M494.308,659.077c12.993,0,23.538-10.546,23.538-23.539V353.077c0-12.993-10.545-23.539-23.538-23.539&#xA;&#x9;&#x9;&#x9;&#x9;s-23.538,10.545-23.538,23.539v282.461C470.77,648.531,481.314,659.077,494.308,659.077z M635.538,94.154h-141.23V47.077&#xA;&#x9;&#x9;&#x9;&#x9;C494.308,21.067,473.24,0,447.23,0H306c-26.01,0-47.077,21.067-47.077,47.077v47.077h-141.23&#xA;&#x9;&#x9;&#x9;&#x9;c-26.01,0-47.077,21.067-47.077,47.077v47.077c0,25.986,21.067,47.077,47.077,47.077v423.692&#xA;&#x9;&#x9;&#x9;&#x9;c0,51.996,42.157,94.153,94.154,94.153h329.539c51.996,0,94.153-42.157,94.153-94.153V235.385&#xA;&#x9;&#x9;&#x9;&#x9;c26.01,0,47.077-21.091,47.077-47.077V141.23C682.615,115.221,661.548,94.154,635.538,94.154z M306,70.615&#xA;&#x9;&#x9;&#x9;&#x9;c0-12.993,10.545-23.539,23.538-23.539h94.154c12.993,0,23.538,10.545,23.538,23.539v23.539c-22.809,0-141.23,0-141.23,0V70.615z&#xA;&#x9;&#x9;&#x9;&#x9; M588.461,659.077c0,25.986-21.066,47.076-47.076,47.076H211.846c-26.01,0-47.077-21.09-47.077-47.076V235.385h423.692V659.077z&#xA;&#x9;&#x9;&#x9;&#x9; M612,188.308H141.23c-12.993,0-23.538-10.545-23.538-23.539s10.545-23.539,23.538-23.539H612&#xA;&#x9;&#x9;&#x9;&#x9;c12.993,0,23.538,10.545,23.538,23.539S624.993,188.308,612,188.308z M258.923,659.077c12.993,0,23.539-10.546,23.539-23.539&#xA;&#x9;&#x9;&#x9;&#x9;V353.077c0-12.993-10.545-23.539-23.539-23.539s-23.539,10.545-23.539,23.539v282.461&#xA;&#x9;&#x9;&#x9;&#x9;C235.384,648.531,245.93,659.077,258.923,659.077z M376.615,659.077c12.993,0,23.538-10.546,23.538-23.539V353.077&#xA;&#x9;&#x9;&#x9;&#x9;c0-12.993-10.545-23.539-23.538-23.539s-23.539,10.545-23.539,23.539v282.461C353.077,648.531,363.622,659.077,376.615,659.077z"/>
557+
<path d='M494.308,659.077c12.993,0,23.538-10.546,23.538-23.539V353.077c0-12.993-10.545-23.539-23.538-23.539&#xA;&#x9;&#x9;&#x9;&#x9;s-23.538,10.545-23.538,23.539v282.461C470.77,648.531,481.314,659.077,494.308,659.077z M635.538,94.154h-141.23V47.077&#xA;&#x9;&#x9;&#x9;&#x9;C494.308,21.067,473.24,0,447.23,0H306c-26.01,0-47.077,21.067-47.077,47.077v47.077h-141.23&#xA;&#x9;&#x9;&#x9;&#x9;c-26.01,0-47.077,21.067-47.077,47.077v47.077c0,25.986,21.067,47.077,47.077,47.077v423.692&#xA;&#x9;&#x9;&#x9;&#x9;c0,51.996,42.157,94.153,94.154,94.153h329.539c51.996,0,94.153-42.157,94.153-94.153V235.385&#xA;&#x9;&#x9;&#x9;&#x9;c26.01,0,47.077-21.091,47.077-47.077V141.23C682.615,115.221,661.548,94.154,635.538,94.154z M306,70.615&#xA;&#x9;&#x9;&#x9;&#x9;c0-12.993,10.545-23.539,23.538-23.539h94.154c12.993,0,23.538,10.545,23.538,23.539v23.539c-22.809,0-141.23,0-141.23,0V70.615z&#xA;&#x9;&#x9;&#x9;&#x9; M588.461,659.077c0,25.986-21.066,47.076-47.076,47.076H211.846c-26.01,0-47.077-21.09-47.077-47.076V235.385h423.692V659.077z&#xA;&#x9;&#x9;&#x9;&#x9; M612,188.308H141.23c-12.993,0-23.538-10.545-23.538-23.539s10.545-23.539,23.538-23.539H612&#xA;&#x9;&#x9;&#x9;&#x9;c12.993,0,23.538,10.545,23.538,23.539S624.993,188.308,612,188.308z M258.923,659.077c12.993,0,23.539-10.546,23.539-23.539&#xA;&#x9;&#x9;&#x9;&#x9;V353.077c0-12.993-10.545-23.539-23.539-23.539s-23.539,10.545-23.539,23.539v282.461&#xA;&#x9;&#x9;&#x9;&#x9;C235.384,648.531,245.93,659.077,258.923,659.077z M376.615,659.077c12.993,0,23.538-10.546,23.538-23.539V353.077&#xA;&#x9;&#x9;&#x9;&#x9;c0-12.993-10.545-23.539-23.538-23.539s-23.539,10.545-23.539,23.539v282.461C353.077,648.531,363.622,659.077,376.615,659.077z' />
558558
</g>
559559
</g>
560560
</g>

browser/main/NoteList/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class NoteList extends React.Component {
318318
})
319319
}
320320

321-
alertIfSnippet() {
321+
alertIfSnippet () {
322322
let { location } = this.props
323323
const targetIndex = _.findIndex(this.notes, (note) => {
324324
return `${note.storage}-${note.key}` === location.query.key
@@ -332,7 +332,7 @@ class NoteList extends React.Component {
332332
}
333333
}
334334

335-
jumpToTop() {
335+
jumpToTop () {
336336
if (this.notes === null || this.notes.length === 0) {
337337
return
338338
}

browser/main/lib/ConfigManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const DEFAULT_CONFIG = {
1616
listStyle: 'DEFAULT', // 'DEFAULT', 'SMALL'
1717
hotkey: {
1818
toggleFinder: OSX ? 'Cmd + Alt + S' : 'Super + Alt + S',
19-
toggleMain: OSX ? 'Cmd + Alt + L' : 'Super + Alt + E',
19+
toggleMain: OSX ? 'Cmd + Alt + L' : 'Super + Alt + E'
2020
},
2121
ui: {
2222
theme: 'default',

browser/main/modals/DeleteArticleModal.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { PropTypes } from 'react'
22
import ReactDOM from 'react-dom'
3-
import store from '../store'
43

54
const electron = require('electron')
65
const ipc = electron.ipcRenderer
@@ -26,7 +25,6 @@ export default class DeleteArticleModal extends React.Component {
2625
}
2726

2827
handleYesButtonClick (e) {
29-
// store.dispatch(destroyArticle(this.props.articleKey))
3028
this.props.close()
3129
}
3230

0 commit comments

Comments
 (0)