Permalink
Browse files

refactor: fix some coding style pointed by standard js

  • Loading branch information...
1 parent ed9ddee commit 79f33b9405f66a73cf52de123c59fc6e50f56a0a @sota1235 sota1235 committed Jan 11, 2017
@@ -75,8 +75,8 @@ const NoteItem = ({ isActive, note, dateDisplay, handleNoteClick, handleNoteCont
: <i styleName='item-title-icon' className='fa fa-fw fa-file-text-o' />
}
- {note.isStarred ?
- <i styleName='item-star' className='fa fa-star' /> : ''
+ {note.isStarred
+ ? <i styleName='item-star' className='fa fa-star' /> : ''
}
</div>
</div>
@@ -1,4 +1,4 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './SnippetTab.styl'
import context from 'browser/lib/context'
@@ -27,8 +27,8 @@ const StorageItem = ({
onClick={handleButtonClick}
onContextMenu={handleContextMenu}
>
- <span styleName={isFolded ?
- 'folderList-item-name--folded' : 'folderList-item-name'
+ <span styleName={isFolded
+ ? 'folderList-item-name--folded' : 'folderList-item-name'
}
style={{borderColor: folderColor}}
>
@@ -1,4 +1,4 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './NoteDetail.styl'
import MarkdownPreview from 'browser/components/MarkdownPreview'
@@ -1,4 +1,4 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
import NoteItem from 'browser/components/NoteItem'
import moment from 'moment'
@@ -54,7 +54,7 @@ class NoteList extends React.Component {
}
render () {
- let { storageMap, notes, index } = this.props
+ let { notes, index } = this.props
let notesList = notes
.slice(0, 10 + 10 * this.state.range)
@@ -1,4 +1,4 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './StorageSection.styl'
import StorageItem from 'browser/components/StorageItem'
@@ -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'
@@ -1,4 +1,3 @@
import CodeMirror from 'codemirror'
-import _ from 'lodash'
CodeMirror.modeInfo.push({name: 'Stylus', mime: 'text/x-styl', mode: 'stylus', ext: ['styl'], alias: ['styl']})
@@ -128,8 +128,8 @@ class FolderSelect extends React.Component {
}
nextOption () {
- let { storages } = this.props
let { optionIndex } = this.state
+ let { folders } = this.props
optionIndex++
if (optionIndex >= folders.length) optionIndex = 0
@@ -205,7 +205,7 @@ class MarkdownNoteDetail extends React.Component {
}
render () {
- let { data, config } = this.props
+ let { config } = this.props
let { note } = this.state
return (
@@ -14,6 +14,7 @@ import SnippetTab from 'browser/components/SnippetTab'
import StatusBar from '../StatusBar'
import context from 'browser/lib/context'
import ConfigManager from 'browser/main/lib/ConfigManager'
+import _ from 'lodash'
function pass (name) {
switch (name) {
@@ -459,7 +460,7 @@ class SnippetNoteDetail extends React.Component {
}
render () {
- let { data, config } = this.props
+ let { config } = this.props
let { note } = this.state
let editorFontSize = parseInt(config.editor.fontSize, 10)
@@ -324,8 +324,8 @@ class NoteList extends React.Component {
const isDefault = config.listStyle === 'DEFAULT'
const isActive = location.query.key === note.storage + '-' + note.key
const dateDisplay = moment(
- config.sortBy === 'CREATED_AT' ?
- note.createdAt : note.updatedAt
+ config.sortBy === 'CREATED_AT'
+ ? note.createdAt : note.updatedAt
).fromNow()
const key = `${note.storage}-${note.key}`
@@ -7,9 +7,6 @@ import ConfigManager from 'browser/main/lib/ConfigManager'
import StorageItem from './StorageItem'
import SideNavFilter from 'browser/components/SideNavFilter'
-const electron = require('electron')
-const { remote } = electron
-
class SideNav extends React.Component {
// TODO: should not use electron stuff v0.7
handleMenuButtonClick (e) {
@@ -10,8 +10,6 @@ import ConfigManager from 'browser/main/lib/ConfigManager'
import dataApi from 'browser/main/lib/dataApi'
const OSX = window.process.platform === 'darwin'
-const { remote } = require('electron')
-const { Menu, MenuItem } = remote
class TopBar extends React.Component {
constructor (props) {
@@ -71,10 +69,10 @@ class TopBar extends React.Component {
break
}
}
- if (storage == null) alert('No storage to create a note')
+ if (storage == null) window.alert('No storage to create a note')
let folder = _.find(storage.folders, {key: params.folderKey})
if (folder == null) folder = storage.folders[0]
- if (folder == null) alert('No folder to create a note')
+ if (folder == null) window.alert('No folder to create a note')
return {
storage,
@@ -1,11 +1,10 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './InitModal.styl'
import dataApi from 'browser/main/lib/dataApi'
import store from 'browser/main/store'
import { hashHistory } from 'react-router'
import _ from 'lodash'
-import keygen from 'browser/lib/keygen'
const CSON = require('@rokt33r/season')
const path = require('path')
@@ -1,4 +1,4 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './NewNoteModal.styl'
import dataApi from 'browser/main/lib/dataApi'
@@ -7,8 +7,6 @@ import store from 'browser/main/store'
const electron = require('electron')
const ipc = electron.ipcRenderer
-const OSX = global.process.platform === 'darwin'
-
class HotkeyTab extends React.Component {
constructor (props) {
super(props)
@@ -1,4 +1,4 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoTab.styl'
@@ -106,7 +106,10 @@ class UnstyledFolderItem extends React.Component {
const popover = { position: 'absolute', zIndex: 2 }
const cover = {
position: 'fixed',
- top: 0, right: 0, bottom: 0, left: 0
+ top: 0,
+ right: 0,
+ bottom: 0,
+ left: 0
}
const pickerStyle = Object.assign({}, {
position: 'absolute'
@@ -5,9 +5,6 @@ import ConfigManager from 'browser/main/lib/ConfigManager'
import store from 'browser/main/store'
import consts from 'browser/lib/consts'
-const electron = require('electron')
-const ipc = electron.ipcRenderer
-
const OSX = global.process.platform === 'darwin'
class UiTab extends React.Component {
View
@@ -5,16 +5,16 @@ const packager = require('electron-packager')
const WIN = process.platform === 'win32'
module.exports = function (grunt) {
- var auth_code
+ var authCode
try {
- auth_code = grunt.file.readJSON('secret/auth_code.json')
+ authCode = grunt.file.readJSON('secret/auth_code.json')
} catch (e) {
if (e.origError.code === 'ENOENT') {
console.warn('secret/auth_code.json is not found. CodeSigning is not available.')
}
}
- const OSX_COMMON_NAME = auth_code != null ? auth_code.OSX_COMMON_NAME : ''
- const WIN_CERT_PASSWORD = auth_code != null ? auth_code.WIN_CERT_PASSWORD : ''
+ const OSX_COMMON_NAME = authCode != null ? authCode.OSX_COMMON_NAME : ''
+ const WIN_CERT_PASSWORD = authCode != null ? authCode.WIN_CERT_PASSWORD : ''
var initConfig = {
pkg: grunt.file.readJSON('package.json'),
View
@@ -1,18 +1,12 @@
const electron = require('electron')
const app = electron.app
-const Menu = electron.Menu
var finderWindow = null
app.on('ready', function () {
if (process.platform === 'darwin') {
app.dock.hide()
}
-
- // var template = require('./finder-menu')
- // var menu = Menu.buildFromTemplate(template)
- // Menu.setApplicationMenu(menu)
-
finderWindow = require('./finder-window')
})
@@ -36,7 +36,7 @@ test.beforeEach((t) => {
})
test.serial('Initialize All Storages', (t) => {
- const { v1StorageData, legacyStorageData, emptyStorageData } = t.context
+ const { v1StorageData, legacyStorageData } = t.context
return Promise.resolve()
.then(function test () {
return init()
@@ -12,7 +12,6 @@ const TestDummy = require('../fixtures/TestDummy')
const sander = require('sander')
const os = require('os')
const CSON = require('@rokt33r/season')
-const faker = require('faker')
const storagePath = path.join(os.tmpdir(), 'test/move-note')
const storagePath2 = path.join(os.tmpdir(), 'test/move-note2')

0 comments on commit 79f33b9

Please sign in to comment.