Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.

Commit 2b70368

Browse files
Linter appeasement
1 parent 5852e9b commit 2b70368

File tree

9 files changed

+33
-29
lines changed

9 files changed

+33
-29
lines changed

library/src/canvas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Screen.metadata = {
121121
export class Sequence extends BaseSequence {
122122
constructor(options={}) {
123123
super(
124-
addCanvasDefaults(options)
124+
addCanvasDefaults(options),
125125
)
126126

127127
// Push canvas to nested components

library/src/core.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class Component extends EventHandler {
5858
images: [],
5959
audio: [],
6060
...options.media,
61-
}
61+
},
6262
})
6363

6464
// Setup option proxying
@@ -156,14 +156,14 @@ export class Component extends EventHandler {
156156
await this.triggerMethod('before:prepare')
157157

158158
// Parse options
159-
const parsed_options = parseAllOptions.call(this, this.internals.rawOptions, {
159+
const parsedOptions = parseAllOptions.call(this, this.internals.rawOptions, {
160160
parameters: this.aggregateParameters,
161161
state: this.options.datastore ? this.options.datastore.state : {},
162162
})
163163

164164
this.internals.parsedOptions = extend(
165165
Object.create(this.internals.rawOptions),
166-
parsed_options
166+
parsedOptions,
167167
)
168168

169169
// Setup automatic event handling for responses
@@ -346,7 +346,7 @@ export class Component extends EventHandler {
346346
}
347347

348348
// Clone any nested components
349-
this.constructor.metadata.nestedComponents.forEach(o => {
349+
this.constructor.metadata.nestedComponents.forEach((o) => {
350350
if (Array.isArray(rawOptions[o])) {
351351
cloneOptions[o] = rawOptions[o].map(c => c.clone())
352352
} else {
@@ -376,7 +376,7 @@ export class Component extends EventHandler {
376376
get type() {
377377
return [
378378
...this.constructor.metadata.module,
379-
this.constructor.name
379+
this.constructor.name,
380380
].join('.')
381381
}
382382
}

library/src/data.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { assign, difference, flatten, intersection, uniq } from 'lodash'
2-
import { EventHandler } from './util/eventAPI'
31
import FileSaver from 'file-saver'
42
import 'whatwg-fetch'
53

4+
import { assign, difference, flatten, intersection, uniq } from 'lodash'
5+
import { EventHandler } from './util/eventAPI'
6+
67
// Data saving --------------------------------------------
78

89
const defaultMetadata = ['sender', 'sender_type', 'sender_id', 'timestamp']
@@ -260,7 +261,7 @@ export class Store extends EventHandler {
260261
download(filetype='csv', filename='data.csv') {
261262
return FileSaver.saveAs(
262263
this.exportBlob(filetype),
263-
filename
264+
filename,
264265
)
265266
}
266267

@@ -283,7 +284,7 @@ export class Store extends EventHandler {
283284
'Content-Type': 'application/json',
284285
},
285286
body: JSON.stringify({
286-
metadata: metadata,
287+
metadata,
287288
url: window.location.href,
288289
data: payload === 'staging' ? this.staging : this.data,
289290
}),

library/src/html.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// HTML-based displays for lab.js
22
import { extend } from 'lodash'
3-
import { Component, status } from './core'
4-
import { domSelect } from './util/domSelect'
53
import 'whatwg-fetch'
64

5+
import { Component, status, handMeDowns } from './core'
6+
import { domSelect } from './util/domSelect'
7+
import { prepareNested } from './flow'
8+
79
// html.Screens display HTML when run
810
export class Screen extends Component {
911
constructor(options) {
@@ -42,7 +44,7 @@ Screen.metadata = {
4244
nestedComponents: [],
4345
parsableOptions: {
4446
content: ['string'],
45-
}
47+
},
4648
}
4749

4850
// An html.Form can show, validate and serialize a form
@@ -170,9 +172,6 @@ Form.metadata = {
170172
nestedComponents: [],
171173
}
172174

173-
import { prepareNested } from './flow'
174-
import { handMeDowns } from './core'
175-
176175
export class Frame extends Component {
177176
constructor(options={}) {
178177
super({
@@ -199,7 +198,7 @@ export class Frame extends Component {
199198
this.internals.contentEndHandler = () => this.end()
200199
this.options.content.on(
201200
'after:end',
202-
this.internals.contentEndHandler
201+
this.internals.contentEndHandler,
203202
)
204203

205204
// Prepare content
@@ -222,7 +221,7 @@ export class Frame extends Component {
222221
// frame and content ending one another
223222
this.options.content.off(
224223
'after:end',
225-
this.internals.contentEndHandler
224+
this.internals.contentEndHandler,
226225
)
227226

228227
// Again, the content is in focus
@@ -240,5 +239,5 @@ Frame.metadata = {
240239
nestedComponents: ['content'],
241240
parsableOptions: {
242241
context: ['string'],
243-
}
242+
},
244243
}

library/src/plugins/debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const parseCell = (contents) => {
116116
}
117117
}
118118

119-
const renderStore = datastore => {
119+
const renderStore = (datastore) => {
120120
// Export keys including state
121121
const keys = datastore.keys(true)
122122

library/src/plugins/transmit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default class Transmit {
2626
url, { payload: 'full', ...metadata },
2727
)
2828
break
29+
default:
2930
}
3031
}
3132
}

library/src/util/domEvents.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const wrapHandler = function(handler, eventName, options=null, context=null) {
7777
// character in the spec, but would be
7878
// trimmed here)
7979
const keys = options.map(
80-
key => keyValues[key] || key
80+
key => keyValues[key] || key,
8181
)
8282

8383
// Look up keycode for each key,

library/src/util/fromObject.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ const retrieveNested = (path, object) => {
1616
// and a type field that specifies the
1717
// component type (e.g. 'lab.html.Screen')
1818
const fromObject = (options) => {
19+
// We assume that the library
20+
// is available as a global variable
21+
/* global lab:false */
1922
const typePath = options.type.split('.').slice(1)
2023
const constructor = retrieveNested(typePath, lab)
2124

2225
// Parse any nested components
23-
constructor.metadata.nestedComponents.forEach(o => {
26+
constructor.metadata.nestedComponents.forEach((o) => {
2427
// ... if the associated option exists ...
2528
if (options[o]) {
2629
if (Array.isArray(options[o])) {
@@ -45,8 +48,8 @@ const fromObject = (options) => {
4548
if (options.plugins) {
4649
options.plugins = options.plugins.map((pluginOptions) => {
4750
const pluginPath = pluginOptions.type.split('.').slice(1)
48-
const pluginConstructor = retrieveNested(pluginPath, lab)
49-
return new pluginConstructor(pluginOptions)
51+
const PluginConstructor = retrieveNested(pluginPath, lab)
52+
return new PluginConstructor(pluginOptions)
5053
})
5154
}
5255

library/src/util/options.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ const parsableOptions = function parsableOptions() {
1414
// Collect parsable options from the static property metadata
1515
return extend(
1616
{},
17-
...prototypeChain.map((p) => {
18-
return p.constructor.metadata
17+
...prototypeChain.map(p => (
18+
p.constructor.metadata
1919
? p.constructor.metadata.parsableOptions
2020
: undefined
21-
}),
21+
)),
2222
)
2323
}
2424

@@ -48,8 +48,8 @@ export const parseOption = function parseOption(key, value, context, metadata=un
4848
// TODO: Also decide whether to block escaping/evaluating
4949
// template code at this point
5050
const output = template(value, {
51-
'escape': '',
52-
'evaluate': '',
51+
escape: '',
52+
evaluate: '',
5353
}).call(this, context)
5454

5555
// Cooerce type if necessary

0 commit comments

Comments
 (0)