Skip to content

Commit de6067a

Browse files
committed
Run lint on all files: yarn run lint
1 parent eacee74 commit de6067a

File tree

118 files changed

+14383
-13460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+14383
-13460
lines changed

examples/web1/index.js

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,72 @@ var WidgetManager = require('./manager').WidgetManager;
33

44
require('@jupyter-widgets/controls/css/widgets.css');
55

6-
document.addEventListener("DOMContentLoaded", function(event) {
7-
var manager = new WidgetManager(document.body);
6+
document.addEventListener('DOMContentLoaded', function(event) {
7+
var manager = new WidgetManager(document.body);
88

9-
/**
10-
* Helper function for creating and displaying widgets.
11-
* @return {Promise<WidgetView>}
12-
*/
13-
function createWidget(widgetType, value, description) {
14-
15-
// Create the widget model.
16-
return manager.new_model({
17-
model_module: '@jupyter-widgets/controls',
18-
model_name: widgetType + 'Model',
19-
model_id: 'widget-1'
9+
/**
10+
* Helper function for creating and displaying widgets.
11+
* @return {Promise<WidgetView>}
12+
*/
13+
function createWidget(widgetType, value, description) {
14+
// Create the widget model.
15+
return manager
16+
.new_model({
17+
model_module: '@jupyter-widgets/controls',
18+
model_name: widgetType + 'Model',
19+
model_id: 'widget-1'
2020
// Create a view for the model.
21-
}).then(function(model) {
22-
console.log(widgetType + ' model created');
21+
})
22+
.then(function(model) {
23+
console.log(widgetType + ' model created');
2324

24-
model.set({
25-
description: description || '',
26-
value: value,
27-
});
25+
model.set({
26+
description: description || '',
27+
value: value
28+
});
2829

29-
return manager.create_view(model);
30-
}, console.error.bind(console))
31-
.then(function(view) {
32-
console.log(widgetType + ' view created');
33-
manager.display_view(null, view);
34-
return view;
35-
}, console.error.bind(console));
36-
}
30+
return manager.create_view(model);
31+
}, console.error.bind(console))
32+
.then(function(view) {
33+
console.log(widgetType + ' view created');
34+
manager.display_view(null, view);
35+
return view;
36+
}, console.error.bind(console));
37+
}
3738

38-
var defaultHTML = 'test <b>text</b>';
39-
var textArea = createWidget('Textarea', defaultHTML, 'HTML:');
40-
var html = createWidget('HTML', defaultHTML);
39+
var defaultHTML = 'test <b>text</b>';
40+
var textArea = createWidget('Textarea', defaultHTML, 'HTML:');
41+
var html = createWidget('HTML', defaultHTML);
4142

42-
// Create a link model.
43-
manager.new_model({
44-
model_module: '@jupyter-widgets/controls',
45-
model_name: 'LinkModel',
46-
model_id: 'widget-2',
47-
state: {
48-
'source': null,
49-
'target': null
50-
}
51-
// Set the link model state.
52-
}).then(function(link) {
53-
console.log('link created');
43+
// Create a link model.
44+
manager
45+
.new_model({
46+
model_module: '@jupyter-widgets/controls',
47+
model_name: 'LinkModel',
48+
model_id: 'widget-2',
49+
state: {
50+
source: null,
51+
target: null
52+
}
53+
// Set the link model state.
54+
})
55+
.then(function(link) {
56+
console.log('link created');
5457

55-
return Promise.all([textArea, html]).then(
56-
function(models) {
57-
console.log('setting link');
58-
var textArea = models[0];
59-
var html = models[1];
60-
link.set({
61-
'source': [textArea.model, 'value'],
62-
'target': [html.model, 'value']
63-
});
64-
link.save_changes();
65-
console.log('link set');
66-
}
67-
);
68-
}).then(function() {
69-
var event = new Event('widgetsRendered');
70-
document.dispatchEvent(event);
58+
return Promise.all([textArea, html]).then(function(models) {
59+
console.log('setting link');
60+
var textArea = models[0];
61+
var html = models[1];
62+
link.set({
63+
source: [textArea.model, 'value'],
64+
target: [html.model, 'value']
65+
});
66+
link.save_changes();
67+
console.log('link set');
68+
});
69+
})
70+
.then(function() {
71+
var event = new Event('widgetsRendered');
72+
document.dispatchEvent(event);
7173
});
7274
});

examples/web1/karma.config.js

Lines changed: 44 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,62 @@
22
// Generated on Mon Dec 07 2015 08:28:33 GMT-0800 (PST)
33

44
module.exports = function(config) {
5-
var cfg = {
5+
var cfg = {
6+
// base path that will be used to resolve all patterns (eg. files, exclude)
7+
basePath: '',
68

7-
// base path that will be used to resolve all patterns (eg. files, exclude)
8-
basePath: '',
9+
// frameworks to use
10+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
11+
frameworks: ['mocha', 'chai'],
912

13+
// list of files / patterns to load in the browser
14+
files: ['built/index.built.js', 'test/**/*.js'],
1015

11-
// frameworks to use
12-
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13-
frameworks: ['mocha', 'chai'],
16+
// list of files to exclude
17+
exclude: [],
1418

19+
// test results reporter to use
20+
// possible values: 'dots', 'progress'
21+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
22+
reporters: ['mocha'],
1523

16-
// list of files / patterns to load in the browser
17-
files: [
18-
'built/index.built.js',
19-
'test/**/*.js'
20-
],
24+
// web server port
25+
port: 9876,
2126

27+
// enable / disable colors in the output (reporters and logs)
28+
colors: true,
2229

23-
// list of files to exclude
24-
exclude: [
25-
],
30+
// level of logging
31+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
32+
logLevel: config.LOG_INFO,
33+
browserNoActivityTimeout: 30000,
2634

27-
// test results reporter to use
28-
// possible values: 'dots', 'progress'
29-
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
30-
reporters: ['mocha'],
35+
// enable / disable watching file and executing tests whenever any file changes
36+
autoWatch: false,
3137

38+
// start these browsers
39+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
40+
browsers: ['Chrome'],
3241

33-
// web server port
34-
port: 9876,
42+
customLaunchers: {
43+
Chrome_travis_ci: {
44+
base: 'Chrome',
45+
flags: ['--no-sandbox']
46+
}
47+
},
3548

49+
// Continuous Integration mode
50+
// if true, Karma captures browsers, runs the tests and exits
51+
singleRun: true,
3652

37-
// enable / disable colors in the output (reporters and logs)
38-
colors: true,
53+
// Concurrency level
54+
// how many browser should be started simultanous
55+
concurrency: Infinity
56+
};
3957

58+
if (process.env.TRAVIS) {
59+
cfg.browsers = ['Chrome_travis_ci'];
60+
}
4061

41-
// level of logging
42-
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
43-
logLevel: config.LOG_INFO,
44-
browserNoActivityTimeout: 30000,
45-
46-
// enable / disable watching file and executing tests whenever any file changes
47-
autoWatch: false,
48-
49-
50-
// start these browsers
51-
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
52-
browsers: ['Chrome'],
53-
54-
customLaunchers: {
55-
Chrome_travis_ci: {
56-
base: 'Chrome',
57-
flags: ['--no-sandbox']
58-
}
59-
},
60-
61-
// Continuous Integration mode
62-
// if true, Karma captures browsers, runs the tests and exits
63-
singleRun: true,
64-
65-
// Concurrency level
66-
// how many browser should be started simultanous
67-
concurrency: Infinity
68-
};
69-
70-
if (process.env.TRAVIS) {
71-
cfg.browsers = ['Chrome_travis_ci'];
72-
}
73-
74-
config.set(cfg);
62+
config.set(cfg);
7563
};

examples/web1/manager.js

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,66 @@ var controls = require('@jupyter-widgets/controls');
44
var LuminoWidget = require('@lumino/widgets').Widget;
55

66
class WidgetManager extends ManagerBase {
7-
constructor(el) {
8-
super();
9-
this.el = el;
10-
}
7+
constructor(el) {
8+
super();
9+
this.el = el;
10+
}
1111

12-
loadClass(className, moduleName, moduleVersion) {
13-
return new Promise(function(resolve, reject) {
14-
if (moduleName === '@jupyter-widgets/controls') {
15-
resolve(controls);
16-
} else if (moduleName === '@jupyter-widgets/base') {
17-
resolve(base)
18-
} else {
19-
var fallback = function(err) {
20-
let failedId = err.requireModules && err.requireModules[0];
21-
if (failedId) {
22-
console.log(`Falling back to unpkg.com for ${moduleName}@${moduleVersion}`);
23-
window.require([`https://unpkg.com/${moduleName}@${moduleVersion}/dist/index.js`], resolve, reject);
24-
} else {
25-
throw err;
26-
}
27-
};
28-
window.require([`${moduleName}.js`], resolve, fallback);
29-
}
30-
}).then(function(module) {
31-
if (module[className]) {
32-
return module[className];
33-
} else {
34-
return Promise.reject(`Class ${className} not found in module ${moduleName}@${moduleVersion}`);
35-
}
36-
});
37-
}
12+
loadClass(className, moduleName, moduleVersion) {
13+
return new Promise(function(resolve, reject) {
14+
if (moduleName === '@jupyter-widgets/controls') {
15+
resolve(controls);
16+
} else if (moduleName === '@jupyter-widgets/base') {
17+
resolve(base);
18+
} else {
19+
var fallback = function(err) {
20+
let failedId = err.requireModules && err.requireModules[0];
21+
if (failedId) {
22+
console.log(
23+
`Falling back to unpkg.com for ${moduleName}@${moduleVersion}`
24+
);
25+
window.require(
26+
[
27+
`https://unpkg.com/${moduleName}@${moduleVersion}/dist/index.js`
28+
],
29+
resolve,
30+
reject
31+
);
32+
} else {
33+
throw err;
34+
}
35+
};
36+
window.require([`${moduleName}.js`], resolve, fallback);
37+
}
38+
}).then(function(module) {
39+
if (module[className]) {
40+
return module[className];
41+
} else {
42+
return Promise.reject(
43+
`Class ${className} not found in module ${moduleName}@${moduleVersion}`
44+
);
45+
}
46+
});
47+
}
3848

39-
display_view(msg, view, options) {
40-
var that = this;
41-
return Promise.resolve(view).then(function(view) {
42-
LuminoWidget.attach(view.pWidget, that.el);
43-
view.on('remove', function() {
44-
console.log('View removed', view);
45-
});
46-
return view;
47-
});
48-
};
49+
display_view(msg, view, options) {
50+
var that = this;
51+
return Promise.resolve(view).then(function(view) {
52+
LuminoWidget.attach(view.pWidget, that.el);
53+
view.on('remove', function() {
54+
console.log('View removed', view);
55+
});
56+
return view;
57+
});
58+
}
4959

50-
_get_comm_info() {
51-
return Promise.resolve({});
52-
};
60+
_get_comm_info() {
61+
return Promise.resolve({});
62+
}
5363

54-
_create_comm() {
55-
return Promise.reject('no comms available');
56-
}
64+
_create_comm() {
65+
return Promise.reject('no comms available');
66+
}
5767
}
5868

59-
exports.WidgetManager = WidgetManager;
69+
exports.WidgetManager = WidgetManager;

0 commit comments

Comments
 (0)