Skip to content

Commit c9277b3

Browse files
committed
execute JS linter on app.js
1 parent 586ca74 commit c9277b3

File tree

1 file changed

+23
-23
lines changed
  • runner/src/main/resources/view

1 file changed

+23
-23
lines changed

runner/src/main/resources/view/app.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ function PlayerCtrl ($scope, $timeout, $interval, $element) {
127127

128128
function onFrameChange (frame) {
129129
// one frame in this method is one game turn, and contains subframes for each agent's actions
130-
for (let i in ctrl.data.ids) {
130+
for (const i in ctrl.data.ids) {
131131
$scope.agents[i].stdout = null
132132
$scope.agents[i].stderr = null
133133
}
134134

135135
$scope.referee = {}
136136
const frameData = ctrl.parsedGameInfo.frames[frame]
137-
for (let i in ctrl.data.ids) {
137+
for (const i in ctrl.data.ids) {
138138
const subframe = frameData.subframes.find(subframe => subframe.agentId === i)
139139
if (subframe) {
140140
if (subframe.stdout) {
@@ -154,12 +154,12 @@ function PlayerCtrl ($scope, $timeout, $interval, $element) {
154154
function convertFrameFormat (data) {
155155
// one frame in this method means one output, if in a single game turn two agents act, the two actions are put in separate frames
156156
const frames = data.views.map(v => {
157-
let f = v.split('\n')
158-
let header = f[0].split(' ')
157+
const f = v.split('\n')
158+
const header = f[0].split(' ')
159159

160160
return { view: v.replace(/^(KEY_FRAME)|(INTERMEDIATE_FRAME)/, ''), keyframe: header[0] === 'KEY_FRAME' }
161161
})
162-
const refereeKeysMap = { 'errors': 'stderr', 'outputs': 'stdout' }
162+
const refereeKeysMap = { errors: 'stderr', outputs: 'stdout' }
163163
for (let i = 0; i < frames.length; i++) {
164164
frames[i].gameSummary = data.summaries[i]
165165
frames[i].referee = {}
@@ -170,11 +170,11 @@ function PlayerCtrl ($scope, $timeout, $interval, $element) {
170170
frames[i].referee[newKey] = data[key].referee[i]
171171
}
172172
}
173-
for (let pi in data.ids) {
173+
for (const pi in data.ids) {
174174
frames[i].stderr = frames[i].stderr || data.errors[pi][i]
175175
frames[i].stdout = frames[i].stdout || data.outputs[pi][i]
176-
for (let agentId in data.outputs) {
177-
let output = data.outputs[agentId]
176+
for (const agentId in data.outputs) {
177+
const output = data.outputs[agentId]
178178
// check that at turn i, agent has output not null, so it is agent's turn
179179
if (output[i] != null && agentId !== 'referee') {
180180
frames[i].agentId = agentId
@@ -217,8 +217,8 @@ function PlayerCtrl ($scope, $timeout, $interval, $element) {
217217
$scope.selectProgress = 'inactive'
218218
$scope.reportItems = [
219219
{
220-
'type': 'ERROR',
221-
'message': error
220+
type: 'ERROR',
221+
message: error
222222
}
223223
]
224224
$scope.showExportPopup = true
@@ -277,8 +277,8 @@ function PlayerCtrl ($scope, $timeout, $interval, $element) {
277277
.catch(function (error) {
278278
$scope.reportItems = [
279279
{
280-
'type': 'ERROR',
281-
'message': error
280+
type: 'ERROR',
281+
message: error
282282
}
283283
]
284284
$scope.showExportPopup = true
@@ -294,36 +294,36 @@ function PlayerCtrl ($scope, $timeout, $interval, $element) {
294294
$scope.showConfigForm = true
295295
} else {
296296
const exportResponseString = await data.text()
297-
let exportResponse = JSON.parse(exportResponseString)
297+
const exportResponse = JSON.parse(exportResponseString)
298298

299-
for (let stub in exportResponse.stubs) {
299+
for (const stub in exportResponse.stubs) {
300300
try {
301301
window.cginput.parseStubInput(exportResponse.stubs[stub], 0)
302302
} catch (e) {
303303
exportResponse.reportItems.push({
304-
'type': 'WARNING',
305-
'message': stub + ' Error in stub.txt',
306-
'details': { 'name': e.name, 'params': e.params }
304+
type: 'WARNING',
305+
message: stub + ' Error in stub.txt',
306+
details: { name: e.name, params: e.params }
307307
})
308308
}
309309
}
310310

311311
if (exportResponse.exportStatus === 'SUCCESS') {
312312
exportResponse.reportItems.push({
313-
'type': 'SUCCESS',
314-
'message': 'Export success.'
313+
type: 'SUCCESS',
314+
message: 'Export success.'
315315
})
316-
let url = exportResponse.dataUrl
317-
let a = document.createElement('a')
316+
const url = exportResponse.dataUrl
317+
const a = document.createElement('a')
318318
a.href = url
319319
a.download = 'export.zip'
320320
document.body.appendChild(a)
321321
a.click()
322322
document.body.removeChild(a)
323323
} else {
324324
exportResponse.reportItems.push({
325-
'type': 'FAIL',
326-
'message': 'Export fail.'
325+
type: 'FAIL',
326+
message: 'Export fail.'
327327
})
328328
}
329329
$scope.reportItems = exportResponse.reportItems

0 commit comments

Comments
 (0)