Permalink
Browse files

Merge pull request #231 from sota1235/master

[Refactor] Use ESLint instead of StandarJS and add settings for TravisCI
  • Loading branch information...
2 parents 3ca18c0 + bd0a326 commit f70cf7845d5baa75e39b5d9c53a86d12eb9d8d55 @sota1235 sota1235 committed on GitHub Jan 11, 2017
Showing with 123 additions and 134 deletions.
  1. +3 โˆ’0 .eslintignore
  2. +6 โˆ’0 .eslintrc
  3. +6 โˆ’0 .travis.yml
  4. +4 โˆ’4 browser/components/NoteItem.js
  5. +2 โˆ’2 browser/components/NoteItemSimple.js
  6. +1 โˆ’1 browser/components/ProfileImage.js
  7. +4 โˆ’4 browser/components/SideNavFilter.js
  8. +2 โˆ’2 browser/components/SnippetTab.js
  9. +3 โˆ’3 browser/components/StorageItem.js
  10. +2 โˆ’4 browser/finder/NoteDetail.js
  11. +2 โˆ’3 browser/finder/NoteList.js
  12. +1 โˆ’1 browser/finder/StorageSection.js
  13. +1 โˆ’2 browser/finder/index.js
  14. +0 โˆ’1 browser/lib/customMeta.js
  15. +3 โˆ’3 browser/lib/date-formatter.js
  16. +1 โˆ’1 browser/lib/markdown.js
  17. +2 โˆ’2 browser/main/Detail/FolderSelect.js
  18. +1 โˆ’1 browser/main/Detail/LastUpdatedString.js
  19. +1 โˆ’1 browser/main/Detail/MarkdownNoteDetail.js
  20. +7 โˆ’6 browser/main/Detail/SnippetNoteDetail.js
  21. +2 โˆ’2 browser/main/Detail/TagSelect.js
  22. +2 โˆ’2 browser/main/Main.js
  23. +4 โˆ’4 browser/main/NoteList/index.js
  24. +1 โˆ’1 browser/main/SideNav/StorageItem.js
  25. +3 โˆ’6 browser/main/SideNav/index.js
  26. +2 โˆ’2 browser/main/StatusBar/index.js
  27. +7 โˆ’9 browser/main/TopBar/index.js
  28. +3 โˆ’3 browser/main/lib/modal.js
  29. +3 โˆ’3 browser/main/modals/DeleteArticleModal.js
  30. +4 โˆ’5 browser/main/modals/InitModal.js
  31. +6 โˆ’6 browser/main/modals/NewNoteModal.js
  32. +1 โˆ’3 browser/main/modals/PreferencesModal/HotkeyTab.js
  33. +3 โˆ’3 browser/main/modals/PreferencesModal/InfoTab.js
  34. +10 โˆ’7 browser/main/modals/PreferencesModal/StorageItem.js
  35. +1 โˆ’1 browser/main/modals/PreferencesModal/StoragesTab.js
  36. +0 โˆ’3 browser/main/modals/PreferencesModal/UiTab.js
  37. +4 โˆ’4 browser/main/modals/PreferencesModal/index.js
  38. +4 โˆ’4 gruntfile.js
  39. +0 โˆ’9 lib/finder-app.js
  40. +1 โˆ’12 lib/main-app.js
  41. +7 โˆ’2 package.json
  42. +2 โˆ’0 readme.md
  43. 0 tests/dataApi/{createFolder.js โ†’ createFolder-test.js}
  44. 0 tests/dataApi/{createNote.js โ†’ createNote-test.js}
  45. 0 tests/dataApi/{deleteFolder.js โ†’ deleteFolder-test.js}
  46. 0 tests/dataApi/{deleteNote.js โ†’ deleteNote-test.js}
  47. +1 โˆ’1 tests/dataApi/init.js
  48. 0 tests/dataApi/{migrateFromV6Storage.js โ†’ migrateFromV6Storage-test.js}
  49. +0 โˆ’1 tests/dataApi/{moveNote.js โ†’ moveNote-test.js}
  50. 0 tests/dataApi/{removeStorage.js โ†’ removeStorage-test.js}
  51. 0 tests/dataApi/{renameStorage.js โ†’ renameStorage-test.js}
  52. 0 tests/dataApi/{updateFolder.js โ†’ updateFolder-test.js}
  53. 0 tests/dataApi/{updateNote.js โ†’ updateNote-test.js}
View
@@ -0,0 +1,3 @@
+node_modules/
+compiled/
+dist/
View
@@ -0,0 +1,6 @@
+{
+ "extends": ["standard", "standard-jsx"],
+ "rules": {
+ "no-useless-escape": 0
+ }
+}
View
@@ -0,0 +1,6 @@
+language: node_js
+node_js:
+ - 'stable'
+ - 'lts/*'
+
+script: npm run lint && npm run test
@@ -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>
@@ -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)
@@ -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)
@@ -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} />
)
}
}
@@ -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)
@@ -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'
@@ -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>
@@ -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}}
>
@@ -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)
@@ -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'
@@ -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' />
)
}
@@ -1,4 +1,4 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
import NoteItem from 'browser/components/NoteItem'
import moment from 'moment'
@@ -54,12 +54,11 @@ 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)
.map((note, _index) => {
-
const isActive = (index === _index)
const key = `${note.storage}-${note.key}`
const dateDisplay = moment(note.updatedAt).fromNow()
@@ -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'
@@ -351,7 +350,7 @@ function refreshData () {
ReactDOM.render((
<Provider store={store}>
- <Finder/>
+ <Finder />
</Provider>
), document.getElementById('content'), function () {
refreshData()
@@ -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']})
@@ -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')
@@ -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')
@@ -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
@@ -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>
}
@@ -21,7 +21,7 @@ const LastUpdatedString = ({ date }) => {
}
LastUpdatedString.propTypes = {
- date: PropTypes.string,
+ date: PropTypes.string
}
export default CSSModules(LastUpdatedString, styles)
@@ -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)
@@ -538,7 +539,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 +564,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 +578,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>
@@ -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>
)
@@ -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'}
@@ -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}`
@@ -376,15 +376,15 @@ 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'
: 'control-button'
}
onClick={(e) => this.handleListStyleButtonClick(e, 'SMALL')}
>
- <i className='fa fa-list-ul'/>
+ <i className='fa fa-list-ul' />
</button>
</div>
<div styleName='list'
@@ -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>
}
Oops, something went wrong.

0 comments on commit f70cf78

Please sign in to comment.