Skip to content

Commit

Permalink
fix issues with arrow-parens
Browse files Browse the repository at this point in the history
  • Loading branch information
vutran committed Sep 26, 2016
1 parent 2062726 commit b068ef8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
16 changes: 8 additions & 8 deletions app/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const toggleMainWindow = () => {
}
};

const execute = message => {
const execute = (message) => {
switch (message.action) {
case 'openurl':
if (message.item.arg) {
Expand Down Expand Up @@ -146,7 +146,7 @@ const handleWindowCollapse = () => {
*/
const handleDidFinishLoad = () => {
const t = config.get('theme') || '';
loadTheme(t).then(theme => {
loadTheme(t).then((theme) => {
if (theme) {
win.webContents.send(IPC_LOAD_THEME, theme);
}
Expand Down Expand Up @@ -175,7 +175,7 @@ const handleQueryCommand = (evt, { q: queryPhrase }, plugins) => {
// if plugins are found with the current keyword
// only make queries to those plugins
if (matchedPlugins.length) {
matchedPlugins.forEach(plugin => {
matchedPlugins.forEach((plugin) => {
// query helper only if the query string isn't set
if (!queryString.length) {
results.push(queryHelper(plugin, keyword));
Expand All @@ -187,15 +187,15 @@ const handleQueryCommand = (evt, { q: queryPhrase }, plugins) => {
});
} else {
// otherwise, do a regular query to core plugins
plugins.forEach(plugin => {
plugins.forEach((plugin) => {
// if core, then query the results
if (plugin.isCore && (!plugin.keyword || keyword === plugin.keyword)) {
results.push(queryResults(plugin, fractions));
}
});
}

Promise.all(results).then(resultSet => {
Promise.all(results).then((resultSet) => {
const retval = resultSet
// flatten and merge items
.reduce((prev, next) => prev.concat(next))
Expand All @@ -210,7 +210,7 @@ const handleQueryCommand = (evt, { q: queryPhrase }, plugins) => {
}
return -1;
})
.filter(i => {
.filter((i) => {
const score = i.title.toLowerCase().score(keyword);
// eslint-disable-next-line no-extra-boolean-cast
return Boolean(score)
Expand Down Expand Up @@ -247,7 +247,7 @@ const handleItemDetailsRequest = (evt, item) => {
content = retrieveItemDetails(item, plugin);
}
// resolve and update the state
Promise.resolve(content).then(html => {
Promise.resolve(content).then((html) => {
cacheConf.set(cacheKey, html);
evt.sender.send(IPC_ITEM_DETAILS_RESPONSE, html);
});
Expand Down Expand Up @@ -321,7 +321,7 @@ const createWindow = () => {
*
* @param {Object[]} plugins - An array of plugin objects
*/
const registerIpcListeners = plugins => {
const registerIpcListeners = (plugins) => {
// listen to query commands and queries
// for results and sends it to the renderer
ipcMain.on(IPC_QUERY_COMMAND, (evt, message) => debounceHandleQueryCommand(evt, message, plugins));
Expand Down
34 changes: 17 additions & 17 deletions app/main/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const { MAX_RESULTS } = require('../constants');
* @param {String} directory - The directory to read
* @return {Promise} - An array of plugin paths
*/
exports.loadPluginsInPath = directory => new Promise(resolve => {
exports.loadPluginsInPath = directory => new Promise((resolve) => {
const loaded = [];
fs.readdir(directory, (err, plugins) => {
if (plugins && plugins.length) {
plugins.forEach(plugin => {
plugins.forEach((plugin) => {
if (plugin !== '.DS_Store') {
const pluginPath = path.resolve(directory, plugin);
loaded.push(pluginPath);
Expand All @@ -35,7 +35,7 @@ exports.loadPluginsInPath = directory => new Promise(resolve => {
*
* @param
*/
exports.isCorePlugin = directory => {
exports.isCorePlugin = (directory) => {
const dirname = path.dirname(directory);
if (dirname === PLUGIN_PATH) {
return false;
Expand All @@ -49,7 +49,7 @@ exports.isCorePlugin = directory => {
* @param {String} directory - A plugin directory
* @return {Boolean} - True if it is a theme
*/
exports.isPluginATheme = directory => {
exports.isPluginATheme = (directory) => {
try {
const pkg = require(path.resolve(directory, 'package.json')); // eslint-disable-line global-require
// TODO: change the mechanism?
Expand All @@ -73,9 +73,9 @@ exports.isPluginATheme = directory => {
* @param {String} plugin - The plugin object
* @return {Promise} - A modified clone of the plugin object
*/
exports.applyModuleProperties = plugin => new Promise(resolve => {
exports.applyModuleProperties = plugin => new Promise((resolve) => {
const plistPath = path.resolve(plugin.path, 'info.plist');
fs.access(plistPath, fs.constants.R_OK, err1 => {
fs.access(plistPath, fs.constants.R_OK, (err1) => {
if (err1) {
// retrieve the keyword and action from the plugin
// eslint-disable-next-line global-require
Expand All @@ -98,7 +98,7 @@ exports.applyModuleProperties = plugin => new Promise(resolve => {
const plistData = plist.parse(data);
let keyword = '';
let action = '';
plistData.objects.forEach(o => {
plistData.objects.forEach((o) => {
if (o.type === 'alfred.workflow.input.scriptfilter') {
keyword = o.config.keyword;
} else if (o.type === 'alfred.workflow.action.openurl') {
Expand All @@ -125,10 +125,10 @@ exports.applyModuleProperties = plugin => new Promise(resolve => {
* @param {String[]} directories - An array of directories to load
* @return {Promise} - Resolves a list of plugin objects
*/
exports.loadPlugins = (directories) => new Promise(resolve => {
exports.loadPlugins = directories => new Promise((resolve) => {
const prom = directories.map(exports.loadPluginsInPath);
Promise.all(prom)
.then(pluginSets => {
.then((pluginSets) => {
const allPlugins = pluginSets
// merge promise results
.reduce((a, b) => a.concat(b))
Expand Down Expand Up @@ -158,7 +158,7 @@ exports.loadPlugins = (directories) => new Promise(resolve => {
* @param {Object} plugin - The plugin object data
* @return {Object}
*/
exports.connectItems = (items, plugin) => items.map(i => {
exports.connectItems = (items, plugin) => items.map((i) => {
const icon = {
path: '',
};
Expand Down Expand Up @@ -196,7 +196,7 @@ exports.connectItems = (items, plugin) => items.map(i => {
* @param {String[]} args - An array of arguments
* @return {Promise} - An array of results
*/
exports.queryResults = (plugin, args) => new Promise(resolve => {
exports.queryResults = (plugin, args) => new Promise((resolve) => {
const query = args.join(' ');
// process based on the schema
switch (plugin.schema) {
Expand All @@ -209,7 +209,7 @@ exports.queryResults = (plugin, args) => new Promise(resolve => {
};
const child = fork(plugin.path, args, options);
let msg = '';
child.stdout.on('data', data => {
child.stdout.on('data', (data) => {
if (data) {
msg += data.toString();
}
Expand All @@ -236,7 +236,7 @@ exports.queryResults = (plugin, args) => new Promise(resolve => {
: pluginObj.execute;

if (output) {
Promise.resolve(output).then(i => {
Promise.resolve(output).then((i) => {
const items = exports.connectItems(i.items, plugin);
resolve(items);
});
Expand All @@ -257,7 +257,7 @@ exports.queryResults = (plugin, args) => new Promise(resolve => {
* @param {String[]} keyword - The query keyword
* @return {Promise} - An array of results
*/
exports.queryHelper = (plugin, keyword) => new Promise(resolve => {
exports.queryHelper = (plugin, keyword) => new Promise((resolve) => {
let items = [];
if (!plugin.helper) {
resolve(items);
Expand All @@ -269,7 +269,7 @@ exports.queryHelper = (plugin, keyword) => new Promise(resolve => {
if (typeof plugin.helper === 'function') {
helperItem = plugin.helper(keyword);
}
Promise.resolve(helperItem).then(item => {
Promise.resolve(helperItem).then((item) => {
items.push(item);
items = exports.connectItems(items, plugin);
resolve(items);
Expand All @@ -286,7 +286,7 @@ exports.queryHelper = (plugin, keyword) => new Promise(resolve => {
* @param {Object} plugin - The plugin object
* @return {Promise} - Resolves to the rendered html string
*/
exports.retrieveItemDetails = (item, plugin) => new Promise(resolve => {
exports.retrieveItemDetails = (item, plugin) => new Promise((resolve) => {
// retrieve the rendered content
let type = 'html';
let content = '';
Expand All @@ -303,7 +303,7 @@ exports.retrieveItemDetails = (item, plugin) => new Promise(resolve => {
}
}
// resolve and update the state
Promise.resolve(content).then(res => {
Promise.resolve(content).then((res) => {
let html = res;
if (type === 'md') {
const md = new MarkdownIt();
Expand Down
2 changes: 1 addition & 1 deletion app/main/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { THEME_PATH } = require('../../utils/paths');
* @param {String} theme - The name of the theme
* @return {Promise} - The theme module
*/
exports.loadTheme = theme => new Promise(resolve => {
exports.loadTheme = theme => new Promise((resolve) => {
if (theme) {
const p = path.resolve(THEME_PATH, theme);
// eslint-disable-next-line global-require
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/src/components/QueryField.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const QueryField = class extends Component {
return (
<div {...base}>
<input
ref={c => { this.input = c && c; }}
ref={(c) => { this.input = c && c; }}
onChange={onChange}
value={value}
{...styles}
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/src/components/ResultList.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const ResultList = class extends Component {

return (
<div {...style({ position: 'relative', paddingTop: 15, paddingBottom: 15 })}>
<ol {...compose(base, this.props.results.length && shown)} ref={c => { this.c = c; }}>
<ol {...compose(base, this.props.results.length && shown)} ref={(c) => { this.c = c; }}>
{getResultItems(this.props.results, this.props.selectedIndex, this.props.theme)}
</ol>
{currItem && <ResultDetailsContainer item={currItem} />}
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/src/containers/QueryFieldContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const QueryFieldContainer = class extends Component {
const { theme, q } = this.props;
return (
<QueryField
ref={c => { this.queryField = c; }}
ref={(c) => { this.queryField = c; }}
value={q}
onChange={this.handleChange}
theme={theme}
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/src/containers/ResultListContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const ResultListContainer = class extends Component {
if (results.length) {
return (
<ResultList
ref={c => { this.c = c; }}
ref={(c) => { this.c = c; }}
theme={theme}
results={results}
selectedIndex={selectedIndex}
Expand Down

0 comments on commit b068ef8

Please sign in to comment.