Skip to content

Commit

Permalink
chore(lint): arrow_parens
Browse files Browse the repository at this point in the history
eslint --fix
  • Loading branch information
lgeiger committed Dec 20, 2016
1 parent 456da49 commit dd8132f
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 69 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"no-duplicate-imports": [0],
"react/no-find-dom-node": [0],
"jsx-a11y/no-static-element-interactions": [0],
"arrow-parens": [0],
"react/require-extension": "off",
"comma-dangle": [0],
"react/jsx-filename-extension": "off",
Expand Down
2 changes: 1 addition & 1 deletion src/main/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const installShellCommand = () => {
installShellCommandsObservable(exe, rootDir, binDir)
.subscribe(
() => {},
(err) => dialog.showErrorBox('Could not write shell script.', err.message),
err => dialog.showErrorBox('Could not write shell script.', err.message),
() => dialog.showMessageBox({
title: 'Command installed.',
message: 'The shell command "nteract" is installed.',
Expand Down
10 changes: 5 additions & 5 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ function openFileFromEvent({ event, filename }) {
openFile$
.buffer(fullAppReady$) // Form an array of open-file events from before app-ready
.first() // Should only be the first
.subscribe(buffer => {
.subscribe((buffer) => {
// Now we can choose whether to open the default notebook
// based on if arguments went through argv or through open-file events
if (notebooks.length <= 0 && buffer.length <= 0) {
log.info('launching an empty notebook by default');
kernelSpecsPromise.then(specs => {
kernelSpecsPromise.then((specs) => {
let kernel;

if (argv.kernel in specs) {
Expand All @@ -182,7 +182,7 @@ openFile$
);
} else {
notebooks
.forEach(f => {
.forEach((f) => {
try {
launch(resolve(f));
} catch (e) {
Expand All @@ -201,7 +201,7 @@ openFile$

fullAppReady$
.subscribe(() => {
kernelSpecsPromise.then(kernelSpecs => {
kernelSpecsPromise.then((kernelSpecs) => {
if (Object.keys(kernelSpecs).length !== 0) {
// Get the default menu first
Menu.setApplicationMenu(defaultMenu);
Expand All @@ -223,7 +223,7 @@ fullAppReady$
}
});
}
}).catch(err => {
}).catch((err) => {
dialog.showMessageBox({
type: 'error',
title: 'No Kernels Installed',
Expand Down
2 changes: 1 addition & 1 deletion src/main/kernels.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function condaInfoObservable() {
* @returns {Observable} List of envionmental variables
*/
export function condaEnvsObservable(condaInfo$) {
return condaInfo$.map(info => {
return condaInfo$.map((info) => {
const envs = info.envs.map(env => ({ name: path.basename(env), prefix: env }));
envs.push({ name: 'root', prefix: info.root_prefix });
return envs;
Expand Down
2 changes: 1 addition & 1 deletion src/main/prepare-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Rx from 'rxjs/Rx';
const env$ = Rx.Observable
.fromPromise(shellEnv())
.first()
.do(env => {
.do((env) => {
Object.assign(process.env, env);
})
.publishReplay(1);
Expand Down
2 changes: 1 addition & 1 deletion src/notebook/components/cell/editor/complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function codeCompleteObservable(channels, editor, message) {
.timeout(2000); // 4s

// On subscription, send the message
return Rx.Observable.create(observer => {
return Rx.Observable.create((observer) => {
const subscription = completion$.subscribe(observer);
channels.shell.next(message);
return subscription;
Expand Down
4 changes: 2 additions & 2 deletions src/notebook/components/transforms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ function richestMimetype(bundle: ImmutableMap<string, any>,
tf: ImmutableMap<string, any> = transforms): string {
return bundle.keySeq()
// we can only use those we have a transform for
.filter((mimetype) => tf.has(mimetype) && order.includes(mimetype))
.filter(mimetype => tf.has(mimetype) && order.includes(mimetype))
// the richest is based on the order in displayOrder
.sortBy((mimetype) => order.indexOf(mimetype))
.sortBy(mimetype => order.indexOf(mimetype))
.first();
}

Expand Down
2 changes: 1 addition & 1 deletion src/notebook/components/transforms/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type MDRender = (input: string) => string;
const parser = new CommonMark.Parser();
const renderer = new MarkdownRenderer();

const mdRender: MDRender = (input) => renderer.render(parser.parse(input));
const mdRender: MDRender = input => renderer.render(parser.parse(input));

export class MarkdownDisplay extends React.Component {
props: Props;
Expand Down
4 changes: 2 additions & 2 deletions src/notebook/epics/comm.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function createCommCloseMessage(parent_header, comm_id, data = {}) {
* @param {error} error any type of error to pass on
* @return {Object} Flux standard error action
*/
export const createCommErrorAction = (error) =>
export const createCommErrorAction = error =>
Rx.Observable.of({
type: COMM_ERROR,
payload: error,
Expand Down Expand Up @@ -127,7 +127,7 @@ export function commActionObservable(newKernelAction) {
* @param {redux.Store} store the redux store
* @return {ActionsObservable} Comm actions
*/
export const commListenEpic = (action$) =>
export const commListenEpic = action$ =>
action$.ofType(NEW_KERNEL)
// We have a new channel
.switchMap(commActionObservable)
Expand Down
6 changes: 3 additions & 3 deletions src/notebook/epics/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const SAVE_CONFIG = 'SAVE_CONFIG';
export const saveConfig = () => ({ type: SAVE_CONFIG });
export const doneSavingConfig = () => ({ type: DONE_SAVING_CONFIG });

export const configLoaded = (config) => ({
export const configLoaded = config => ({
type: MERGE_CONFIG,
config,
});
Expand All @@ -42,7 +42,7 @@ export const loadConfigEpic = actions =>
readFileObservable(CONFIG_FILE_PATH)
.map(JSON.parse)
.map(configLoaded)
.catch((err) =>
.catch(err =>
Observable.of({ type: 'ERROR', payload: err, error: true })
)
);
Expand All @@ -69,6 +69,6 @@ export const saveConfigEpic = (actions, store) =>
writeFileObservable(CONFIG_FILE_PATH, JSON.stringify(store.getState().config.toJS()))
.map(doneSavingConfig)
)
.catch((err) =>
.catch(err =>
Observable.of({ type: 'ERROR', payload: err, error: true })
);
16 changes: 8 additions & 8 deletions src/notebook/epics/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import {
const Rx = require('rxjs/Rx');
const Immutable = require('immutable');

export const createErrorActionObservable = (type) =>
(error) =>
export const createErrorActionObservable = type =>
error =>
Rx.Observable.of({
type,
payload: error,
Expand Down Expand Up @@ -76,7 +76,7 @@ export function createExecuteRequest(code) {
export function createPagerActions(id, payloadStream) {
return payloadStream.filter(p => p.source === 'page')
.scan((acc, pd) => acc.push(Immutable.fromJS(pd)), new Immutable.List())
.map((pagerDatas) => updateCellPagers(id, pagerDatas));
.map(pagerDatas => updateCellPagers(id, pagerDatas));
}

/**
Expand Down Expand Up @@ -107,7 +107,7 @@ export function createSourceUpdateAction(id, setInputStream) {
export function createCellAfterAction(id, setInputStream) {
return setInputStream.filter(x => !x.replace)
.pluck('text')
.map((text) => createCellAfter('code', id, text));
.map(text => createCellAfter('code', id, text));
}

/**
Expand Down Expand Up @@ -153,7 +153,7 @@ export function handleFormattableMessages(id, cellMessages) {
return cellMessages
.ofMessageType(['execute_result', 'display_data', 'stream', 'error'])
.map(msgSpecToNotebookFormat)
.map((output) => ({ type: 'APPEND_OUTPUT', id, output }));
.map(output => ({ type: 'APPEND_OUTPUT', id, output }));
}

/**
Expand Down Expand Up @@ -212,7 +212,7 @@ export function executeCellStream(channels, id, code) {
);

// On subscription, send the message
return Rx.Observable.create(observer => {
return Rx.Observable.create((observer) => {
const subscription = cellAction$.subscribe(observer);
channels.shell.next(executeRequest);
return subscription;
Expand Down Expand Up @@ -246,7 +246,7 @@ export function createExecuteCellStream(action$, store, source, id) {
*/
export function executeCellEpic(action$, store) {
return action$.ofType('EXECUTE_CELL')
.do(action => {
.do((action) => {
if (!action.id) {
throw new Error('execute cell needs an id');
}
Expand Down Expand Up @@ -276,7 +276,7 @@ export const updateDisplayEpic = action$ =>
channels.iopub.ofMessageType(['update_display_data'])
.map(msgSpecToNotebookFormat)
// Convert 'update_display_data' to 'display_data'
.map((output) => Object.assign({}, output, { output_type: 'display_data' }))
.map(output => Object.assign({}, output, { output_type: 'display_data' }))
.map(output => ({ type: 'UPDATE_DISPLAY', output }))
.catch(createErrorActionObservable(ERROR_UPDATE_DISPLAY))
);
8 changes: 4 additions & 4 deletions src/notebook/epics/kernel-launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function acquireKernelInfo(channels) {
.pluck('content', 'language_info')
.map(setLanguageInfo);

return Rx.Observable.create(observer => {
return Rx.Observable.create((observer) => {
const subscription = obs.subscribe(observer);
channels.shell.next(message);
return subscription;
Expand All @@ -70,7 +70,7 @@ export function acquireKernelInfo(channels) {
export function newKernelObservable(kernelSpecName, cwd) {
return Rx.Observable.create((observer) => {
launch(kernelSpecName, { cwd })
.then(c => {
.then((c) => {
const { config, spawn, connectionFile, kernelSpec } = c;

const identity = uuid.v4();
Expand Down Expand Up @@ -124,7 +124,7 @@ export const watchExecutionStateEpic = action$ =>
*/
export const acquireKernelInfoEpic = action$ =>
action$.ofType(NEW_KERNEL)
.switchMap(action => {
.switchMap((action) => {
/* istanbul ignore if -- used for interactive debugging */
if (process.env.DEBUG) {
window.channels = action.channels;
Expand All @@ -139,7 +139,7 @@ export const acquireKernelInfoEpic = action$ =>
*/
export const newKernelEpic = action$ =>
action$.ofType(LAUNCH_KERNEL)
.do(action => {
.do((action) => {
if (!action.kernelSpecName) {
throw new Error('newKernel needs a kernelSpecName');
}
Expand Down
8 changes: 4 additions & 4 deletions src/notebook/epics/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const LOAD = 'LOAD';
export const SET_NOTEBOOK = 'SET_NOTEBOOK';
export const NEW_NOTEBOOK = 'NEW_NOTEBOOK';

export const load = (filename) => ({ type: LOAD, filename });
export const load = filename => ({ type: LOAD, filename });

export const newNotebook = (kernelSpecName, cwd) => ({
type: NEW_NOTEBOOK,
Expand Down Expand Up @@ -65,7 +65,7 @@ export const convertRawNotebook = (filename, data) => ({
*/
export const loadEpic = actions =>
actions.ofType(LOAD)
.do(action => {
.do((action) => {
// If there isn't a filename, save-as it instead
if (!action.filename) {
throw new Error('load needs a filename');
Expand All @@ -74,14 +74,14 @@ export const loadEpic = actions =>
// Switch map since we want the last load request to be the lead
.switchMap(action =>
readFileObservable(action.filename)
.map((data) => convertRawNotebook(action.filename, data))
.map(data => convertRawNotebook(action.filename, data))
.flatMap(({ filename, notebook }) =>
Observable.of(
notebookLoaded(filename, notebook),
extractNewKernel(filename, notebook),
)
)
.catch((err) =>
.catch(err =>
Observable.of({ type: 'ERROR', payload: err, error: true })
)
);
Expand Down
8 changes: 4 additions & 4 deletions src/notebook/epics/saving.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Observable = Rx.Observable;
*/
export function saveEpic(action$) {
return action$.ofType(SAVE)
.do(action => {
.do((action) => {
// If there isn't a filename, save-as it instead
if (!action.filename) {
throw new Error('save needs a filename');
Expand All @@ -33,14 +33,14 @@ export function saveEpic(action$) {
writeFileObservable(action.filename,
JSON.stringify(
commutable.toJS(
action.notebook.update('cellMap', (cells) =>
cells.map((value) =>
action.notebook.update('cellMap', cells =>
cells.map(value =>
value.deleteIn(['metadata', 'inputHidden'])
.deleteIn(['metadata', 'outputHidden'])
.deleteIn(['metadata', 'status'])))),
null,
1))
.catch(error => {
.catch((error) => {
const input$ = Observable.of({
type: 'ERROR',
payload: error,
Expand Down
8 changes: 4 additions & 4 deletions src/notebook/kernel/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export function createMessage(msg_type, fields) {
*/
export function childOf(parentMessage) {
const parentMessageID = parentMessage.header.msg_id;
return Observable.create(subscriber => {
return Observable.create((subscriber) => {
// since we're in an arrow function `this` is from the outer scope.
// save our inner subscription
const subscription = this.subscribe(msg => {
const subscription = this.subscribe((msg) => {
if (!msg.parent_header || !msg.parent_header.msg_id) {
subscriber.error(new Error('no parent_header.msg_id on message'));
return;
Expand All @@ -67,10 +67,10 @@ export function childOf(parentMessage) {
* @return {Observable} the resulting observable
*/
export function ofMessageType(messageTypes) {
return Observable.create(subscriber => {
return Observable.create((subscriber) => {
// since we're in an arrow function `this` is from the outer scope.
// save our inner subscription
const subscription = this.subscribe(msg => {
const subscription = this.subscribe((msg) => {
if (!msg.header || !msg.header.msg_type) {
subscriber.error(new Error('no header.msg_type on message'));
return;
Expand Down
2 changes: 1 addition & 1 deletion src/notebook/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const createLogger = require('redux-logger');
module.exports = function clogger() {
const logger = createLogger({
// predicate: (getState, action) => action.type.includes('COMM'),
stateTransformer: (state) =>
stateTransformer: state =>
Object.keys(state).reduce((prev, key) =>
Object.assign(
{},
Expand Down
Loading

0 comments on commit dd8132f

Please sign in to comment.