Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainMaestro committed Mar 10, 2017
1 parent ce3f8f5 commit ac89596
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/lib/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ export const ensureFiles = () => {
}

export const client = npm(pluginsPath)
export { default as addSettings } from './settings'
export { default as addSettings } from './settings'
3 changes: 2 additions & 1 deletion app/lib/plugins/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const isValidSetting = setting => {
return false
}

if (type == 'option') {
if (type === 'option') {
return Array.isArray(options) && options.length
}

Expand All @@ -35,6 +35,7 @@ export default ({ settings }, base) => {
return
}

// eslint-disable-next-line no-unused-vars
const { value, ...pluginSetting } = pluginSettings[key] || {}

if (!isEqual(setting, pluginSetting)) {
Expand Down
4 changes: 3 additions & 1 deletion app/main/actions/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ const eachPlugin = (term, display) => {
Object.keys(plugins).forEach(name => {
const settings = externalSettings[name]
if (settings) {
Object.keys(settings).forEach(key => settings[key] = settings[key].value)
Object.keys(settings).forEach(key => {
settings[key] = settings[key].value
})
}

try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import React, { PropTypes } from 'react'
import styles from '../styles.css'

export default (props) => (
const Checkbox = (props) => (
<div className={styles.item}>
<div className={styles.itemValueWithoutLabel}>
<label>
Expand All @@ -16,3 +16,11 @@ export default (props) => (
</div>
</div>
)

Checkbox.propTypes = {
value: PropTypes.any,
onChange: PropTypes.func.isRequired,
description: PropTypes.string,
}

export default Checkbox
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import React, { PropTypes } from 'react'
import styles from '../styles.css'
import hotkeyStyles from '../Hotkey/styles.css'

export default (props) => (
const Input = (props) => (
<div className={styles.item}>
<label className={styles.label}>{props.label}:</label>
<div className={styles.itemValue}>
Expand All @@ -18,3 +18,13 @@ export default (props) => (
</div>
</div>
)

Input.propTypes = {
inputType: PropTypes.string.isRequired,
label: PropTypes.string,
value: PropTypes.any,
onChange: PropTypes.func.isRequired,
description: PropTypes.string,
}

export default Input
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import Select, { Creatable } from 'react-select'
import React, { PropTypes } from 'react'
import { Creatable } from 'react-select'
import styles from '../styles.css'

export default (props) => (
const Options = (props) => (
<div className={styles.item}>
<div className={styles.itemValue}>
<Creatable
Expand All @@ -18,3 +18,14 @@ export default (props) => (
</div>
</div>
)

Options.propTypes = {
options: PropTypes.array.isRequired,
label: PropTypes.string,
value: PropTypes.any,
onChange: PropTypes.func.isRequired,
description: PropTypes.string,
multi: PropTypes.bool.isRequired,
}

export default Options
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react'
import Select, { Creatable } from 'react-select'
import React, { PropTypes } from 'react'
import { Creatable } from 'react-select'
import styles from '../styles.css'

export default (props) => (
const Select = (props) => (
<div className={styles.item}>
<div className={styles.itemValue}>
<Creatable
multi={true}
multi
value={props.value}
placeholder={props.label}
onChange={props.onChange}
Expand All @@ -17,3 +17,12 @@ export default (props) => (
</div>
</div>
)

Select.propTypes = {
label: PropTypes.string,
value: PropTypes.any,
onChange: PropTypes.func.isRequired,
description: PropTypes.string,
}

export default Select
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React, { PropTypes, Component } from 'react'
import loadThemes from 'lib/loadThemes'
import styles from './styles.css'
import hotkeyStyles from './Hotkey/styles.css'
import { Checkbox, Input, Select, Options } from './components'

export default class ExternalSettings extends Component {
Expand All @@ -19,7 +17,7 @@ export default class ExternalSettings extends Component {
const { type, description } = setting
const value = setting.value || setting.defaultValue

if (type == 'bool') {
if (type === 'bool') {
return (
<Checkbox
key={label}
Expand All @@ -30,7 +28,7 @@ export default class ExternalSettings extends Component {
)
}

if (type == 'array') {
if (type === 'array') {
return (
<Select
key={label}
Expand All @@ -42,7 +40,7 @@ export default class ExternalSettings extends Component {
)
}

if (type == 'option') {
if (type === 'option') {
const { multi } = setting
const options = setting.options.map(option => ({ label: option, value: option }))

Expand All @@ -52,8 +50,8 @@ export default class ExternalSettings extends Component {
label={label}
value={value}
onChange={newValue => {
const value = multi ? newValue.map(val => val.value) : newValue.value
this.changeSetting(plugin, label, value)
const changedValue = multi ? newValue.map(val => val.value) : newValue.value
this.changeSetting(plugin, label, changedValue)
}}
description={description}
options={options}
Expand Down
2 changes: 1 addition & 1 deletion app/main/plugins/externalPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pluginsWatcher.on('addDir', (pluginPath) => {
console.groupEnd()
return
}
addSettings(plugin, base);
addSettings(plugin, base)
console.log('Loaded.')
const requirePath = window.require.resolve(pluginPath)
const watcher = chokidar.watch(requirePath, { depth: 0 })
Expand Down

0 comments on commit ac89596

Please sign in to comment.