Skip to content

Commit

Permalink
fix(examples): ESLint + build
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed Feb 1, 2018
1 parent d0e5283 commit 1968986
Show file tree
Hide file tree
Showing 70 changed files with 589 additions and 530 deletions.
1 change: 0 additions & 1 deletion config/rules-examples.js
Expand Up @@ -5,7 +5,6 @@ module.exports = [
exclude: /test[^]*\.(png|jpg)$/,
},
{ test: /\.html$/, loader: 'html-loader' },
{ test: /\.css$/, use: ['style-loader', 'css-loader', 'postcss-loader'] },
{ test: /\.cjson$/, loader: 'hson-loader' },
{ test: /\.hson$/, loader: 'hson-loader' },
];
13 changes: 12 additions & 1 deletion config/rules-pvw.js
Expand Up @@ -3,6 +3,7 @@ const autoprefixer = require('autoprefixer');
module.exports = [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
Expand All @@ -14,6 +15,7 @@ module.exports = [
},
{
test: /\.c$/i,
exclude: /node_modules/,
loader: 'shader-loader',
},
{
Expand Down Expand Up @@ -63,6 +65,15 @@ module.exports = [
},
{
test: /\.css$/,
loader: 'style-loader!css-loader!postcss-loader',
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{
loader: 'postcss-loader',
options: {
plugins: () => [autoprefixer('last 2 version', 'ie >= 10')],
},
},
],
},
];
2 changes: 1 addition & 1 deletion config/rules-tests.js
@@ -1,9 +1,9 @@
module.exports = [
{ test: /\.cjson$/, loader: 'hson-loader' },
{ test: /test[^]*\.(png|jpg)$/, use: 'url-loader?limit=1048576' },
{ test: /\.glsl$/i, loader: 'shader-loader' },
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{ loader: 'babel-loader', options: { presets: ['env'] } },
{
Expand Down
6 changes: 5 additions & 1 deletion config/rules-vtk.js
@@ -1,5 +1,9 @@
module.exports = [
{ test: /\.glsl$/i, loader: 'shader-loader' },
{
test: /\.glsl$/i,
include: /node_modules(\/|\\)vtk.js(\/|\\)/,
loader: 'shader-loader',
},
{
test: /\.js$/,
include: /node_modules(\/|\\)vtk.js(\/|\\)/,
Expand Down
26 changes: 16 additions & 10 deletions documentation/config.js
@@ -1,15 +1,21 @@
const vtkLoaders = require('../config/webpack.loaders.js');
const path = require('path');

const linterRules = require('../config/rules-linter.js');
const pvwRules = require('../config/rules-pvw.js');
const vtkRules = require('../config/rules-vtk.js');
const wslinkRules = require('../config/rules-wslink.js');

module.exports = {
baseUrl: '/paraviewweb',
work: './build-tmp',
api: ['../src'],
examples: ['../src'],
config: {
title: 'ParaViewWeb',
description: '"ParaViewWeb is a Web framework which allow to bring the power of ParaView and VTK into the Web."',
subtitle: '"Small framework for bringing scientific visualization to the Web"',
description:
'"ParaViewWeb is a Web framework which allow to bring the power of ParaView and VTK into the Web."',
subtitle:
'"Small framework for bringing scientific visualization to the Web"',
author: 'Kitware Inc.',
timezone: 'UTC',
url: 'https://kitware.github.io/paraviewweb',
Expand All @@ -19,19 +25,19 @@ module.exports = {
},
webpack: {
module: {
noParse: [
/plotly\.js/
],
loaders: vtkLoaders,
noParse: [/plotly\.js/],
rules: [].concat(
linterRules,
pvwRules,
vtkRules,
wslinkRules
),
},
resolve: {
alias: {
PVWStyle: path.resolve('./style'),
},
},
postcss: [
require('autoprefixer')({ browsers: ['last 2 versions'] }),
],
},
copy: [],
};
5 changes: 2 additions & 3 deletions src/Component/Native/Composite/example/index.js
@@ -1,9 +1,8 @@
import 'normalize.css';

import CompositeComponent from '..';
import BGColorComponent from '../../BackgroundColor';

// Load CSS
require('normalize.css');

const container = document.querySelector('.content');
container.style.position = 'relative';
container.style.width = '100%';
Expand Down
2 changes: 0 additions & 2 deletions src/Component/Native/Composite/index.js
@@ -1,5 +1,3 @@
/* global document */

import style from 'PVWStyle/ComponentNative/Composite.mcss';

export default class NativeCompositeComponent {
Expand Down
5 changes: 2 additions & 3 deletions src/Component/Native/ToggleControl/example/index.js
@@ -1,10 +1,9 @@
import 'normalize.css';

import ToggleControlComponent from '..';
import BGColorComponent from '../../BackgroundColor';
import Spacer from '../../Spacer';

// Load CSS
import 'normalize.css';

const container = document.querySelector('.content');
container.style.height = '100vh';

Expand Down
1 change: 0 additions & 1 deletion src/Component/Native/Workbench/example/index.js
@@ -1,4 +1,3 @@
/* global window, document */
import 'normalize.css';

import Workbench from '..';
Expand Down
3 changes: 2 additions & 1 deletion src/InfoViz/Core/LegendProvider/example/index.js
@@ -1,4 +1,5 @@
import 'babel-polyfill';
import 'normalize.css';

import React from 'react';
import ReactDOM from 'react-dom';

Expand Down
2 changes: 0 additions & 2 deletions src/InfoViz/Native/HistogramSelector/example/index.js
@@ -1,6 +1,4 @@
/* global document */
import 'normalize.css';
import 'babel-polyfill';

import sizeHelper from '../../../../Common/Misc/SizeHelper';

Expand Down
@@ -1,5 +1,4 @@
import 'normalize.css';
import 'babel-polyfill';

import sizeHelper from '../../../../Common/Misc/SizeHelper';

Expand Down
1 change: 0 additions & 1 deletion src/InfoViz/Native/ParallelCoordinates/example/index.js
@@ -1,5 +1,4 @@
import 'normalize.css';
import 'babel-polyfill';

import sizeHelper from '../../../../Common/Misc/SizeHelper';

Expand Down
2 changes: 2 additions & 0 deletions src/NativeUI/Canvas/LinearPieceWiseEditor/example/index.js
@@ -1,3 +1,5 @@
import 'normalize.css';

import LinearPieceWiseEditor from '..';

const container = document.createElement('canvas');
Expand Down
3 changes: 3 additions & 0 deletions src/NativeUI/Canvas/RemoteRenderer/example/index.js
@@ -1,4 +1,7 @@
import 'normalize.css';

import SmartConnect from 'wslink/src/SmartConnect';

import RemoteRenderer from '..';
import SizeHelper from '../../../../Common/Misc/SizeHelper';
import ParaViewWebClient from '../../../../IO/WebSocket/ParaViewWebClient';
Expand Down
88 changes: 44 additions & 44 deletions src/React/CollapsibleControls/FloatImageControl/example/index.js
@@ -1,54 +1,54 @@
import FloatImageControl from '..';
import 'normalize.css';

import React from 'react';
import ReactDOM from 'react-dom';
import jsonData from './pipeline.js';

// Load CSS
require('normalize.css');
import FloatImageControl from '..';
import jsonData from './pipeline';

document.body.style.padding = '10px';

const layerMapByName = {},
state = {
light: 200,
const layerMapByName = {};
const state = {
light: 200,
};
const model = {
dimensions: jsonData.dimensions,
onProbeChange() {
return null;
},
getTimeProbe() {
return {
enabled: false,
query: null,
draw: false,
};
},
getLayers() {
return jsonData.layers;
},
getLight() {
return state.light;
},
setLight(v) {
state.light = v;
},
isMultiView() {
return false;
},
updateMaskLayerVisibility(name, value) {
layerMapByName[name].meshActive = value;
render(); // eslint-disable-line
},
updateLayerVisibility(name, value) {
layerMapByName[name].active = value;
render(); // eslint-disable-line
},
updateLayerColorBy(name, value) {
layerMapByName[name].array = value;
render(); // eslint-disable-line
},
model = {
dimensions: jsonData.dimensions,
onProbeChange() {
return null;
},
getTimeProbe() {
return {
enabled: false,
query: null,
draw: false,
};
},
getLayers() {
return jsonData.layers;
},
getLight() {
return state.light;
},
setLight(v) {
state.light = v;
},
isMultiView() {
return false;
},
updateMaskLayerVisibility(name, value) {
layerMapByName[name].meshActive = value;
render();
},
updateLayerVisibility(name, value) {
layerMapByName[name].active = value;
render();
},
updateLayerColorBy(name, value) {
layerMapByName[name].array = value;
render();
},
};
};

// Fill map
jsonData.layers.forEach((item) => {
Expand Down
75 changes: 38 additions & 37 deletions src/React/CollapsibleControls/LightControl/example/index.js
@@ -1,49 +1,50 @@
import LightControl from '..';
import 'normalize.css';

import React from 'react';
import ReactDOM from 'react-dom';

// Load CSS
require('normalize.css');
import LightControl from '..';

document.body.style.padding = '10px';

const state = {
enabled: true,
properties: {
lightTerms: {
ka: 1,
kd: 0.3,
ks: 0.5,
alpha: 0,
},
lightPosition: {
x: 0,
y: 0,
},
},
},
light = {
getLightProperties() {
return state.properties;
},
setLightProperties({ lightTerms, lightPosition }) {
if (lightPosition) {
state.properties.lightPosition = lightPosition;
console.log(lightPosition);
}
if (lightTerms) {
state.properties.lightTerms = lightTerms;
console.log(lightTerms);
}
},
setLightingEnabled(e) {
console.log('enable', e);
state.enabled = e;
enabled: true,
properties: {
lightTerms: {
ka: 1,
kd: 0.3,
ks: 0.5,
alpha: 0,
},
getLightingEnabled() {
return state.enabled;
lightPosition: {
x: 0,
y: 0,
},
};
},
};

const light = {
getLightProperties() {
return state.properties;
},
setLightProperties({ lightTerms, lightPosition }) {
if (lightPosition) {
state.properties.lightPosition = lightPosition;
console.log(lightPosition);
}
if (lightTerms) {
state.properties.lightTerms = lightTerms;
console.log(lightTerms);
}
},
setLightingEnabled(e) {
console.log('enable', e);
state.enabled = e;
},
getLightingEnabled() {
return state.enabled;
},
};

ReactDOM.render(
<LightControl light={light} />,
Expand Down
@@ -1,10 +1,10 @@
import LookupTableManager from '../../../../Common/Core/LookupTableManager';
import LookupTableManagerControl from '..';
import 'normalize.css';

import React from 'react';
import ReactDOM from 'react-dom';

// Load CSS
require('normalize.css');
import LookupTableManager from '../../../../Common/Core/LookupTableManager';
import LookupTableManagerControl from '..';

document.body.style.padding = '10px';

Expand Down

0 comments on commit 1968986

Please sign in to comment.