Skip to content

Commit

Permalink
fix(ESLint): fix syntax with new rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed Aug 9, 2016
1 parent ca9d38f commit c96653f
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 85 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = {
// Not for us ;-)
'jsx-a11y/label-has-for': 0,
'no-console': 0,

'import/no-named-as-default': 0,
},
settings: {
'import/resolver': 'webpack',
Expand Down
8 changes: 4 additions & 4 deletions src/ImageProviders.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const DEFAULT_IMAGE_PROVIDER = 'default';
const providers = {};
const listeners = {};

export function setImageProvider(provider, key) {
function setImageProvider(provider, key) {
providers[key || DEFAULT_IMAGE_PROVIDER] = provider;
const listenersToNotify = listeners[key || DEFAULT_IMAGE_PROVIDER] || [];
listenersToNotify.forEach(cb => {
Expand All @@ -13,11 +13,11 @@ export function setImageProvider(provider, key) {
delete listeners[key || DEFAULT_IMAGE_PROVIDER];
}

export function getImageProvider(key) {
function getImageProvider(key) {
return providers[key || DEFAULT_IMAGE_PROVIDER];
}

export function onImageProvider(callback, key = DEFAULT_IMAGE_PROVIDER) {
function onImageProvider(callback, key = DEFAULT_IMAGE_PROVIDER) {
if (providers[key]) {
callback(providers[key]);
return -1;
Expand All @@ -32,7 +32,7 @@ export function onImageProvider(callback, key = DEFAULT_IMAGE_PROVIDER) {
return id;
}

export function unsubscribe(id, key = DEFAULT_IMAGE_PROVIDER) {
function unsubscribe(id, key = DEFAULT_IMAGE_PROVIDER) {
listeners[key][id] = null;
}

Expand Down
33 changes: 16 additions & 17 deletions src/MainView.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react';
import VtkRenderer from 'paraviewweb/src/React/Renderers/VtkRenderer';
import SvgIconWidget from 'paraviewweb/src/React/Widgets/SvgIconWidget';
import style from 'VisualizerStyle/MainView.mcss';
import ControlPanel from './panels/ControlPanel';
import TimeController from './panels/TimeController';
import logo from './logo.svg';
import React from 'react';
import VtkRenderer from 'paraviewweb/src/React/Renderers/VtkRenderer';
import SvgIconWidget from 'paraviewweb/src/React/Widgets/SvgIconWidget';
import { connect } from 'react-redux';

import style from 'VisualizerStyle/MainView.mcss';

import ControlPanel from './panels/ControlPanel';
import TimeController from './panels/TimeController';
import logo from './logo.svg';

import network from './network';
import ImageProviders from './ImageProviders';
import { connect } from 'react-redux';
import { selectors, actions, dispatch } from './redux';

export const Visualizer = React.createClass({
Expand All @@ -30,7 +32,7 @@ export const Visualizer = React.createClass({
},

componentDidMount() {
ImageProviders.setImageProvider(this.refs.renderer.binaryImageStream);
ImageProviders.setImageProvider(this.renderer.binaryImageStream);
},

toggleMenu() {
Expand All @@ -56,11 +58,11 @@ export const Visualizer = React.createClass({
</div>
<div className={style.buttons}>
<TimeController />
<i className={style.resetCameraButton} onClick={this.props.resetCamera}></i>
<i className={style.resetCameraButton} onClick={this.props.resetCamera} />
</div>
</div>
<VtkRenderer
ref="renderer"
ref={c => { this.renderer = c; }}
client={this.props.client}
connection={this.props.connection}
session={this.props.session}
Expand All @@ -71,7 +73,6 @@ export const Visualizer = React.createClass({
});

// Binding --------------------------------------------------------------------
/* eslint-disable arrow-body-style */

export default connect(
state => {
Expand All @@ -82,10 +83,8 @@ export default connect(

return { client, connection, session, pendingCount };
},
() => {
return {
resetCamera: () => dispatch(actions.view.resetCamera()),
};
}
() => ({
resetCamera: () => dispatch(actions.view.resetCamera()),
})
)(Visualizer);

10 changes: 6 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import * as network from './network';
import MainView from './MainView';
/* global document window */

import { store, dispatch, actions } from './redux';
import { Provider } from 'react-redux';
import React from 'react';
import ReactDOM from 'react-dom';

import network from './network';
import MainView from './MainView';

import { store, dispatch, actions } from './redux';
import behaviorOnChange from './behavior';

require('normalize.css');
Expand Down Expand Up @@ -49,7 +51,7 @@ function start() {
// Mount UI
const container = document.querySelector('.content');
ReactDOM.unmountComponentAtNode(container);
return ReactDOM.render(<Provider store={store}><MainView /></Provider>, container);
ReactDOM.render(<Provider store={store}><MainView /></Provider>, container);
}

export function connect(config = {}) {
Expand Down
14 changes: 7 additions & 7 deletions src/network.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ParaViewWebClient from 'paraviewweb/src/IO/WebSocket/ParaViewWebClient';
import { createClient } from 'paraviewweb/src/IO/WebSocket/ParaViewWebClient';
import SmartConnect from 'paraviewweb/src/IO/WebSocket/SmartConnect';

var connection = null,
Expand All @@ -21,7 +21,7 @@ const customProtocols = {

function start(conn) {
connection = conn;
client = ParaViewWebClient.createClient(conn, [
client = createClient(conn, [
'ColorManager',
'FileListing',
'MouseHandler',
Expand All @@ -36,28 +36,28 @@ function start(conn) {
}
}

export function exit(timeout = 60) {
function exit(timeout = 60) {
if (connection) {
connection.destroy(timeout);
connection = null;
}
}

export function connect(config = {}) {
function connect(config = {}) {
smartConnect = new SmartConnect(config);
smartConnect.onConnectionReady(start);
smartConnect.connect();
}

export function getClient() {
function getClient() {
return client;
}

export function getConnection() {
function getConnection() {
return connection;
}

export function onReady(callback) {
function onReady(callback) {
if (client && client.session.isOpen) {
callback();
} else {
Expand Down
8 changes: 3 additions & 5 deletions src/panels/ControlPanel/FileBrowserPanel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ export const FileBrowser = React.createClass({
},

path(pathToList, path) {
if (pathToList === path[0]) {
pathToList = '.';
}
this.props.storeActiveDirectory(pathToList);
this.props.fetchServerDirectory(pathToList);
const reqPath = (pathToList === path[0]) ? '.' : pathToList;
this.props.storeActiveDirectory(reqPath);
this.props.fetchServerDirectory(reqPath);
},

directory(name) {
Expand Down
16 changes: 8 additions & 8 deletions src/panels/ControlPanel/InformationPanel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ export const InformationPanel = React.createClass({
return (
<div className={style.container}>
<div className={style.line}>
<i className={style.iconType}></i>
<i className={style.iconType} />
{this.props.proxy.data.type}
</div>
<div className={style.line}>
<i className={style.iconConnectivity}></i>
<i className={style.iconConnectivity} />
{`${this.props.proxy.data.points} points / ${this.props.proxy.data.cells} cells`}
</div>
<div className={style.line}>
<i className={style.iconMemory}></i>
<i className={style.iconMemory} />
{memoryToString(this.props.proxy.data.memory)}
</div>
<div className={style.line}>
<i className={style.iconBondingBox}></i>
<i className={style.iconBondingBox} />
<div>
<table className={style.table}>
<tbody>
Expand All @@ -104,7 +104,7 @@ export const InformationPanel = React.createClass({
</div>
{this.props.timeValues.length ?
<div className={style.line}>
<i className={style.iconTime}></i>
<i className={style.iconTime} />
<select value={this.props.timeStep} onChange={this.updateTime}>
{this.props.timeValues.map((t, idx) => <option key={idx} value={idx}>{t}</option>)}
</select>
Expand All @@ -113,21 +113,21 @@ export const InformationPanel = React.createClass({
{activeArray ?
<div>
<div className={style.line}>
<i className={style.iconArray}></i>
<i className={style.iconArray} />
<select value={this.state.arrayIdx % this.props.proxy.data.arrays.length} onChange={this.updateArray}>
{this.props.proxy.data.arrays.map((a, idx) => <option key={idx} value={idx}>{a.name}</option>)}
</select>
</div>
<div className={style.line}>
<i className={style.iconArrayType}></i>
<i className={style.iconArrayType} />
{`${activeArray.location} / ${activeArray.type}(${activeArray.size})`}
</div>

<div className={style.line}>
<table className={style.table}>
<thead>
<tr>
<th><i className={style.iconRange}></i></th>
<th><i className={style.iconRange} /></th>
<th>Min</th>
<th>Max</th>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion src/panels/ControlPanel/PipelineBrowser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const PipelineBrowser = React.createClass({
<div className={style.pipelineContainer}>
<PipelineWidget
nodes={this.props.pipeline.sources}
actives={[ this.props.source ? this.props.source.id : '0' ]}
actives={[this.props.source ? this.props.source.id : '0']}
onChange={this.handleChange}
enableDelete
width="295"
Expand Down
23 changes: 12 additions & 11 deletions src/panels/ControlPanel/SavePanel/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import CollapsibleWidget from 'paraviewweb/src/React/Widgets/CollapsibleWidget';
import style from 'VisualizerStyle/SavePanel.mcss';
/* global Image */
import React from 'react';
import { connect } from 'react-redux';
import CollapsibleWidget from 'paraviewweb/src/React/Widgets/CollapsibleWidget';
import style from 'VisualizerStyle/SavePanel.mcss';

import ImageProviders from '../../../ImageProviders';
import { connect } from 'react-redux';
import { selectors, actions, dispatch } from '../../../redux';

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -78,7 +79,7 @@ export const SavePanel = React.createClass({

resetSize() {
const image = new Image();
image.src = this.refs.screenshot.src;
image.src = this.screenshot.src;
const { width, height } = image;
this.setState({ width, height });
},
Expand Down Expand Up @@ -118,14 +119,14 @@ export const SavePanel = React.createClass({
}

return (
<div className={[ this.props.className, style.container ].join(' ')}>
<div className={[this.props.className, style.container].join(' ')}>
<CollapsibleWidget
open={!!this.props.collapsableState.localScreenShot}
subtitle="Local"
title="Screenshot"
onChange={this.updateLocalScreenShotCollapsableState}
>
<img ref="screenshot" src={this.state.url} className={style.localImage} alt="" />
<img ref={c => { this.screenshot = c; }} src={this.state.url} className={style.localImage} alt="" />
</CollapsibleWidget>
<CollapsibleWidget
open={!!this.props.collapsableState.screenshot}
Expand All @@ -134,7 +135,7 @@ export const SavePanel = React.createClass({
onChange={this.updateScreenShotCollapsableState}
>
<div className={style.line}>
<i className={style.resizeIcon} onClick={this.resetSize}></i>
<i className={style.resizeIcon} onClick={this.resetSize} />
<div className={style.group}>
<input
type="number"
Expand All @@ -160,7 +161,7 @@ export const SavePanel = React.createClass({
? style.saveIconError : style.saveIcon)}
title={this.props.statuses.screenshot}
onClick={this.saveScreenShot}
></i>
/>
<input
type="text"
className={style.input}
Expand All @@ -184,7 +185,7 @@ export const SavePanel = React.createClass({
? style.saveIconError : style.saveIcon)}
title={this.props.statuses.dataset}
onClick={this.saveDataset}
></i>
/>
<input
type="text"
className={style.input}
Expand All @@ -207,7 +208,7 @@ export const SavePanel = React.createClass({
? style.saveIconError : style.saveIcon)}
title={this.props.statuses.state}
onClick={this.saveState}
></i>
/>
<input
type="text"
className={style.input}
Expand Down
2 changes: 1 addition & 1 deletion src/panels/ControlPanel/SettingPanel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const SettingPanel = React.createClass({
return null;
}

return (
return (
<div className={style.container}>
<ProxyEditorWidget
sections={this.props.sections}
Expand Down
Loading

0 comments on commit c96653f

Please sign in to comment.