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