1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

refactor: fix by standardjs

This commit is contained in:
sota1235
2017-01-11 23:17:32 +09:00
parent 0d004b2f0a
commit ed9ddee5f1
30 changed files with 69 additions and 72 deletions

View File

@@ -91,10 +91,10 @@ NoteItem.propTypes = {
type: PropTypes.string.isRequired,
title: PropTypes.string.isrequired,
tags: PropTypes.array,
isStarred: PropTypes.bool.isRequired,
isStarred: PropTypes.bool.isRequired
}),
handleNoteClick: PropTypes.func.isRequired,
handleNoteContextMenu: PropTypes.func.isRequired,
handleNoteContextMenu: PropTypes.func.isRequired
}
export default CSSModules(NoteItem, styles)

View File

@@ -40,10 +40,10 @@ NoteItemSimple.propTypes = {
storage: PropTypes.string.isRequired,
key: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
title: PropTypes.string.isrequired,
title: PropTypes.string.isrequired
}),
handleNoteClick: PropTypes.func.isRequired,
handleNoteContextMenu: PropTypes.func.isRequired,
handleNoteContextMenu: PropTypes.func.isRequired
}
export default CSSModules(NoteItemSimple, styles)

View File

@@ -12,7 +12,7 @@ export default class ProfileImage extends React.Component {
className={className}
width={this.props.size}
height={this.props.size}
src={src}/>
src={src} />
)
}
}

View File

@@ -17,17 +17,17 @@ const SideNavFilter = ({
isFolded, isHomeActive, handleAllNotesButtonClick,
isStarredActive, handleStarredButtonClick
}) => (
<div styleName={ isFolded ? 'menu--folded' : 'menu' }>
<div styleName={isFolded ? 'menu--folded' : 'menu'}>
<button styleName={isHomeActive ? 'menu-button--active' : 'menu-button'}
onClick={handleAllNotesButtonClick}
>
<i className='fa fa-book fa-fw'/>
<i className='fa fa-book fa-fw' />
<span styleName='menu-button-label'>All Notes</span>
</button>
<button styleName={isStarredActive ? 'menu-button--active' : 'menu-button'}
onClick={handleStarredButtonClick}
>
<i className='fa fa-star fa-fw'/>
<i className='fa fa-star fa-fw' />
<span styleName='menu-button-label'>Starred</span>
</button>
</div>
@@ -38,7 +38,7 @@ SideNavFilter.propTypes = {
isHomeActive: PropTypes.bool.isRequired,
handleAllNotesButtonClick: PropTypes.func.isRequired,
isStarredActive: PropTypes.bool.isRequired,
handleStarredButtonClick: PropTypes.func.isRequired,
handleStarredButtonClick: PropTypes.func.isRequired
}
export default CSSModules(SideNavFilter, styles)

View File

@@ -117,7 +117,7 @@ class SnippetTab extends React.Component {
<button styleName='deleteButton'
onClick={(e) => this.handleDeleteButtonClick(e)}
>
<i className='fa fa-times'/>
<i className='fa fa-times' />
</button>
}
</div>

View File

@@ -52,7 +52,7 @@ StorageItem.propTypes = {
folderName: PropTypes.string.isRequired,
folderColor: PropTypes.string,
isFolded: PropTypes.bool.isRequired,
noteCount: PropTypes.number,
noteCount: PropTypes.number
}
export default CSSModules(StorageItem, styles)

View File

@@ -97,9 +97,7 @@ class NoteDetail extends React.Component {
let { note, config } = this.props
if (note == null) {
return (
<div styleName='root'>
</div>
<div styleName='root' />
)
}

View File

@@ -59,7 +59,6 @@ class NoteList extends React.Component {
let notesList = notes
.slice(0, 10 + 10 * this.state.range)
.map((note, _index) => {
const isActive = (index === _index)
const key = `${note.storage}-${note.key}`
const dateDisplay = moment(note.updatedAt).fromNow()

View File

@@ -351,7 +351,7 @@ function refreshData () {
ReactDOM.render((
<Provider store={store}>
<Finder/>
<Finder />
</Provider>
), document.getElementById('content'), function () {
refreshData()

View File

@@ -1,17 +1,17 @@
/**
* @fileoverview Formatting date string.
*/
import moment from 'moment';
import moment from 'moment'
/**
* @description Return date string. For example, 'Sep.9, 2016 12:00'.
* @param {mixed}
* @return {string}
*/
export function getLastUpdated(date) {
export function getLastUpdated (date) {
const m = moment(date)
if (!m.isValid()) {
throw Error('Invalid argument.');
throw Error('Invalid argument.')
}
return m.format('MMM D, gggg H:mm')

View File

@@ -58,7 +58,7 @@ md.use(math, {
})
md.use(require('markdown-it-footnote'))
// Override task item
md.block.ruler.at('paragraph', function (state, startLine/*, endLine*/) {
md.block.ruler.at('paragraph', function (state, startLine/*, endLine */) {
let content, terminate, i, l, token
let nextLine = startLine + 1
let terminatorRules = state.md.block.ruler.getRules('paragraph')

View File

@@ -268,7 +268,7 @@ class FolderSelect extends React.Component {
<span styleName='idle-label-name-surfix'>in {currentOption.storage.name}</span>
</span>
</div>
<i styleName='idle-caret' className='fa fa-fw fa-caret-down'/>
<i styleName='idle-caret' className='fa fa-fw fa-caret-down' />
</div>
}

View File

@@ -21,7 +21,7 @@ const LastUpdatedString = ({ date }) => {
}
LastUpdatedString.propTypes = {
date: PropTypes.string,
date: PropTypes.string
}
export default CSSModules(LastUpdatedString, styles)

View File

@@ -538,7 +538,7 @@ class SnippetNoteDetail extends React.Component {
<button styleName='info-right-button'
onClick={(e) => this.handleContextButtonClick(e)}
>
<i className='fa fa-ellipsis-v'/>
<i className='fa fa-ellipsis-v' />
</button>
</div>
</div>
@@ -563,7 +563,7 @@ class SnippetNoteDetail extends React.Component {
<button styleName='plusButton'
onClick={(e) => this.handleTabPlusButtonClick(e)}
>
<i className='fa fa-plus'/>
<i className='fa fa-plus' />
</button>
</div>
{viewList}
@@ -577,19 +577,19 @@ class SnippetNoteDetail extends React.Component {
? 'Select Syntax...'
: this.state.note.snippets[this.state.snippetIndex].mode
}&nbsp;
<i className='fa fa-caret-down'/>
<i className='fa fa-caret-down' />
</button>
<button
onClick={(e) => this.handleIndentTypeButtonClick(e)}
>
Indent: {config.editor.indentType}&nbsp;
<i className='fa fa-caret-down'/>
<i className='fa fa-caret-down' />
</button>
<button
onClick={(e) => this.handleIndentSizeButtonClick(e)}
>
size: {config.editor.indentSize}&nbsp;
<i className='fa fa-caret-down'/>
<i className='fa fa-caret-down' />
</button>
</div>

View File

@@ -8,7 +8,7 @@ class TagSelect extends React.Component {
super(props)
this.state = {
newTag: '',
newTag: ''
}
}
@@ -111,7 +111,7 @@ class TagSelect extends React.Component {
<button styleName='tag-removeButton'
onClick={(e) => this.handleTagRemoveButtonClick(tag)(e)}
>
<i className='fa fa-times fa-fw tag-removeButton-icon'/>
<i className='fa fa-times fa-fw tag-removeButton-icon' />
</button>
</span>
)

View File

@@ -112,7 +112,7 @@ class Main extends React.Component {
ConfigManager.set({ navWidth })
dispatch({
type: 'SET_NAV_WIDTH',
navWidth,
navWidth
})
})
}
@@ -169,7 +169,7 @@ class Main extends React.Component {
onMouseDown={(e) => this.handleLeftSlideMouseDown(e)}
draggable='false'
>
<div styleName='slider-hitbox'/>
<div styleName='slider-hitbox' />
</div>
}
<div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'}

View File

@@ -376,7 +376,7 @@ class NoteList extends React.Component {
}
onClick={(e) => this.handleListStyleButtonClick(e, 'DEFAULT')}
>
<i className='fa fa-th-large'/>
<i className='fa fa-th-large' />
</button>
<button styleName={config.listStyle === 'SMALL'
? 'control-button--active'
@@ -384,7 +384,7 @@ class NoteList extends React.Component {
}
onClick={(e) => this.handleListStyleButtonClick(e, 'SMALL')}
>
<i className='fa fa-list-ul'/>
<i className='fa fa-list-ul' />
</button>
</div>
<div styleName='list'

View File

@@ -181,7 +181,7 @@ class StorageItem extends React.Component {
<button styleName='header-addFolderButton'
onClick={(e) => this.handleAddFolderButtonClick(e)}
>
<i className='fa fa-plus'/>
<i className='fa fa-plus' />
</button>
}

View File

@@ -65,7 +65,7 @@ class SideNav extends React.Component {
<button styleName='top-menu'
onClick={(e) => this.handleMenuButtonClick(e)}
>
<i className='fa fa-navicon fa-fw'/>
<i className='fa fa-navicon fa-fw' />
<span styleName='top-menu-label'>Menu</span>
</button>
</div>
@@ -87,8 +87,8 @@ class SideNav extends React.Component {
onClick={(e) => this.handleToggleButtonClick(e)}
>
{isFolded
? <i className='fa fa-angle-double-right'/>
: <i className='fa fa-angle-double-left'/>
? <i className='fa fa-angle-double-right' />
: <i className='fa fa-angle-double-left' />
}
</button>
</div>

View File

@@ -59,9 +59,9 @@ class StatusBar extends React.Component {
</button>
: null
}
{/*<button styleName='help'>
{/* <button styleName='help'>
<i className='fa fa-info-circle' />
</button>*/}
</button> */}
<button styleName='zoom'
onClick={(e) => this.handleZoomButtonClick(e)}
>

View File

@@ -262,8 +262,8 @@ class TopBar extends React.Component {
<span styleName='control-search-optionList-item-folder-surfix'>in {storage.name}</span>
</div>
{note.type === 'SNIPPET_NOTE'
? <i styleName='control-search-optionList-item-type' className='fa fa-code'/>
: <i styleName='control-search-optionList-item-type' className='fa fa-file-text-o'/>
? <i styleName='control-search-optionList-item-type' className='fa fa-code' />
: <i styleName='control-search-optionList-item-type' className='fa fa-file-text-o' />
}&nbsp;
{note.title}
</div>
@@ -276,7 +276,7 @@ class TopBar extends React.Component {
>
<div styleName='control'>
<div styleName='control-search'>
<i styleName='control-search-icon' className='fa fa-search fa-fw'/>
<i styleName='control-search-icon' className='fa fa-search fa-fw' />
<div styleName='control-search-input'
onFocus={(e) => this.handleSearchFocus(e)}
onBlur={(e) => this.handleSearchBlur(e)}
@@ -303,14 +303,14 @@ class TopBar extends React.Component {
<button styleName='left-search-clearButton'
onClick={(e) => this.handleSearchClearButton(e)}
>
<i className='fa fa-times'/>
<i className='fa fa-times' />
</button>
}
</div>
<button styleName='control-newPostButton'
onClick={(e) => this.handleNewPostButtonClick(e)}>
<i className='fa fa-plus'/>
<i className='fa fa-plus' />
<span styleName='control-newPostButton-tooltip'>
Make a Note {OSX ? '⌘' : '^'} + n
</span>

View File

@@ -20,10 +20,10 @@ class ModalBase extends React.Component {
render () {
return (
<div className={'ModalBase' + (this.state.isHidden ? ' hide' : '')}>
<div onClick={(e) => this.close(e)} className='modalBack'/>
<div onClick={(e) => this.close(e)} className='modalBack' />
{this.state.component == null ? null : (
<Provider store={store}>
<this.state.component {...this.state.componentProps} close={this.close}/>
<this.state.component {...this.state.componentProps} close={this.close} />
</Provider>
)}
</div>
@@ -33,7 +33,7 @@ class ModalBase extends React.Component {
let el = document.createElement('div')
document.body.appendChild(el)
let modalBase = ReactDOM.render(<ModalBase/>, el)
let modalBase = ReactDOM.render(<ModalBase />, el)
export function openModal (component, props) {
if (modalBase == null) { return }

View File

@@ -33,13 +33,13 @@ export default class DeleteArticleModal extends React.Component {
render () {
return (
<div className='DeleteArticleModal modal'>
<div className='title'><i className='fa fa-fw fa-trash'/> Delete an article.</div>
<div className='title'><i className='fa fa-fw fa-trash' /> Delete an article.</div>
<div className='message'>Do you really want to delete?</div>
<div className='control'>
<button ref='no' onClick={(e) => this.handleNoButtonClick(e)}><i className='fa fa-fw fa-close'/> No</button>
<button ref='yes' onClick={(e) => this.handleYesButtonClick(e)} className='danger'><i className='fa fa-fw fa-check'/> Yes</button>
<button ref='no' onClick={(e) => this.handleNoButtonClick(e)}><i className='fa fa-fw fa-close' /> No</button>
<button ref='yes' onClick={(e) => this.handleYesButtonClick(e)} className='danger'><i className='fa fa-fw fa-check' /> Yes</button>
</div>
</div>
)

View File

@@ -197,7 +197,7 @@ class InitModal extends React.Component {
render () {
if (this.state.isLoading) {
return <div styleName='root--loading'>
<i styleName='spinner' className='fa fa-spin fa-spinner'/>
<i styleName='spinner' className='fa fa-spin fa-spinner' />
<div styleName='loadingMessage'>Preparing initialization...</div>
</div>
}
@@ -235,7 +235,7 @@ class InitModal extends React.Component {
{this.state.legacyStorageExists &&
<div styleName='body-migration'>
<label><input type='checkbox' checked={this.state.migrationRequested} onChange={(e) => this.handleMigrationRequestedChange(e)}/> Migrate old data from the legacy app v0.5</label>
<label><input type='checkbox' checked={this.state.migrationRequested} onChange={(e) => this.handleMigrationRequestedChange(e)} /> Migrate old data from the legacy app v0.5</label>
</div>
}
@@ -247,7 +247,7 @@ class InitModal extends React.Component {
>
{this.state.isSending
? <span>
<i className='fa fa-spin fa-spinner'/> Loading...
<i className='fa fa-spin fa-spinner' /> Loading...
</span>
: 'Let\'s Go!'
}

View File

@@ -114,8 +114,8 @@ class NewNoteModal extends React.Component {
>
<i styleName='control-button-icon'
className='fa fa-file-text-o'
/><br/>
<span styleName='control-button-label'>Markdown Note</span><br/>
/><br />
<span styleName='control-button-label'>Markdown Note</span><br />
<span styleName='control-button-description'>It is good for any type of documents. Check List, Code block and Latex block are available.</span>
</button>
@@ -126,14 +126,14 @@ class NewNoteModal extends React.Component {
>
<i styleName='control-button-icon'
className='fa fa-code'
/><br/>
<span styleName='control-button-label'>Snippet Note</span><br/>
/><br />
<span styleName='control-button-label'>Snippet Note</span><br />
<span styleName='control-button-description'>This format is specialized on managing snippets like Gist. Multiple snippets can be grouped as a note.
</span>
</button>
</div>
<div styleName='description'><i className='fa fa-arrows-h'/> Tab to switch format</div>
<div styleName='description'><i className='fa fa-arrows-h' /> Tab to switch format</div>
</div>
)

View File

@@ -150,7 +150,7 @@ class HotkeyTab extends React.Component {
}
HotkeyTab.propTypes = {
dispatch: PropTypes.func,
dispatch: PropTypes.func
}
export default CSSModules(HotkeyTab, styles)

View File

@@ -26,7 +26,7 @@ class InfoTab extends React.Component {
<div styleName='top'>
<div styleName='icon-space'>
<img styleName='icon' src='../resources/app.png' width='92' height='92'/>
<img styleName='icon' src='../resources/app.png' width='92' height='92' />
<div styleName='icon-right'>
<div styleName='appId'>Boostnote {appVersion}</div>
<div styleName='description'>
@@ -34,7 +34,7 @@ class InfoTab extends React.Component {
</div>
</div>
</div>
<div styleName='clear'></div>
<div styleName='clear' />
<div styleName='madeBy'>Made by&nbsp;
<a href='http://maisin.co/'
onClick={(e) => this.handleLinkClick(e)}

View File

@@ -137,7 +137,7 @@ class UnstyledFolderItem extends React.Component {
</div>
: null
}
<i className='fa fa-square'/>
<i className='fa fa-square' />
</button>
<input styleName='folderList-item-left-nameInput'
value={this.state.folder.name}
@@ -368,17 +368,17 @@ class StorageItem extends React.Component {
: <div styleName='header-label'
onClick={(e) => this.handleLabelClick(e)}
>
<i className='fa fa-folder-open'/>&nbsp;
<i className='fa fa-folder-open' />&nbsp;
{storage.name}&nbsp;
<span styleName='header-label-path'>({storage.path})</span>&nbsp;
<i styleName='header-label-editButton' className='fa fa-pencil'/>
<i styleName='header-label-editButton' className='fa fa-pencil' />
</div>
}
<div styleName='header-control'>
<button styleName='header-control-button'
onClick={(e) => this.handleNewFolderButtonClick(e)}
>
<i className='fa fa-plus'/>
<i className='fa fa-plus' />
<span styleName='header-control-button-tooltip'
style={{left: -20}}
>Add Folder</span>
@@ -386,7 +386,7 @@ class StorageItem extends React.Component {
<button styleName='header-control-button'
onClick={(e) => this.handleExternalButtonClick(e)}
>
<i className='fa fa-external-link'/>
<i className='fa fa-external-link' />
<span styleName='header-control-button-tooltip'
style={{left: -50}}
>Open Storage folder</span>
@@ -394,7 +394,7 @@ class StorageItem extends React.Component {
<button styleName='header-control-button'
onClick={(e) => this.handleUnlinkButtonClick(e)}
>
<i className='fa fa-unlink'/>
<i className='fa fa-unlink' />
<span styleName='header-control-button-tooltip'
style={{left: -10}}
>Unlink</span>

View File

@@ -72,7 +72,7 @@ class StoragesTab extends React.Component {
<button styleName='list-control-addStorageButton'
onClick={(e) => this.handleAddStorageButton(e)}
>
<i className='fa fa-plus'/> Add Storage
<i className='fa fa-plus' /> Add Storage
</button>
</div>
</div>

View File

@@ -43,7 +43,7 @@ class Preferences extends React.Component {
switch (this.state.currentTab) {
case 'INFO':
return <InfoTab/>
return <InfoTab />
case 'HOTKEY':
return (
<HotkeyTab
@@ -86,9 +86,9 @@ class Preferences extends React.Component {
let tabs = [
{target: 'STORAGES', label: 'Storages'},
{target: 'HOTKEY', label: 'Hotkey'},
{target: 'UI', label: 'UI'},
{target: 'INFO', label: 'Info'}
{target: 'HOTKEY', label: 'Hotkey'},
{target: 'UI', label: 'UI'},
{target: 'INFO', label: 'Info'}
]
let navButtons = tabs.map((tab) => {