Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 84834bd

Browse files
author
Johannes Kahlhöfer
committed
LINT run
1 parent c03f596 commit 84834bd

File tree

19 files changed

+58
-78
lines changed

19 files changed

+58
-78
lines changed

assets/tutorial/01-blockly.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ module.exports = () => {
5454
},
5555

5656
nextTutorial: 'turn',
57-
57+
5858
highlighters: {
5959
classes: ['play-button']
6060
}
6161
}
62-
}
62+
}

assets/tutorial/02-turn.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ module.exports = () => {
1212
[1, 1, 1, 1, 1, 1]
1313
],
1414

15-
entities: [
16-
entities.tutorialRobot({ x: 1, y: 4, id: 'ROBOT', orientation: 0 })
17-
]
18-
},
15+
entities: [
16+
entities.tutorialRobot({ x: 1, y: 4, id: 'ROBOT', orientation: 0 })
17+
]
18+
},
1919

2020
editor: {
2121
workspace: `<xml xmlns="http://www.w3.org/1999/xhtml">
@@ -77,4 +77,4 @@ module.exports = () => {
7777

7878
nextTutorial: 'loop'
7979
}
80-
}
80+
}

assets/tutorial/03-loop.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ module.exports = () => {
1515
[1, 1, 1, 1, 1, 1, 1, 1, 1]
1616
],
1717

18-
entities: [
19-
entities.tutorialRobot({ x: 1, y: 7, id: 'ROBOT', orientation: 0 })
20-
]
21-
},
18+
entities: [
19+
entities.tutorialRobot({ x: 1, y: 7, id: 'ROBOT', orientation: 0 })
20+
]
21+
},
2222

2323
editor: {
2424
workspace: `<xml xmlns="http://www.w3.org/1999/xhtml">
@@ -68,4 +68,4 @@ module.exports = () => {
6868

6969
nextTutorial: 'scout'
7070
}
71-
}
71+
}

assets/tutorial/04-scout.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* globals localStorage */
12
const entities = require('../../models/game/entities')
23

34
const timeLimit = 10
@@ -34,7 +35,7 @@ module.exports = () => {
3435
],
3536

3637
entities: [
37-
entities.tutorialRobot({ x: 12, y: 12, id: 'ROBOT', orientation: 0, teamId: 1, discoverRange: 2 }),
38+
entities.tutorialRobot({ x: 12, y: 12, id: 'ROBOT', orientation: 0, teamId: 1, discoverRange: 2 }),
3839
entities.tutorialBase({ x: 12, y: 12, id: 'BASE', teamId: 1 })
3940
],
4041

@@ -131,4 +132,4 @@ module.exports = () => {
131132

132133
nextTutorial: 'resource'
133134
}
134-
}
135+
}

assets/tutorial/05-resource.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* globals localStorage */
12
const entities = require('../../models/game/entities')
23

34
const DEFAULT_WORKSPACE = `<xml xmlns="http://www.w3.org/1999/xhtml"><block type="start_handler" x="50" y="50" deletable="false"></block><block type="resource_event_handler" x="400" y="400" deletable="false"></block></xml>`
@@ -26,11 +27,11 @@ module.exports = () => {
2627
previousEntities.push(toAdd)
2728
}
2829
} catch (e) {
29-
console.log("Error parsing entities from previous Level: " + e)
30+
console.log('Error parsing entities from previous Level: ' + e)
3031
}
3132
}
3233
} catch (e) {
33-
console.log("Error parsing from previous Level: " + e)
34+
console.log('Error parsing from previous Level: ' + e)
3435
}
3536
}
3637

@@ -129,7 +130,7 @@ module.exports = () => {
129130
nextTutorial: ''
130131
}
131132

132-
function getWorkspace() {
133+
function getWorkspace () {
133134
if (previousWorkspace) {
134135
let injectPart = '<block type="resource_event_handler" x="400" y="400" deletable="false">'
135136
let injectBefore = '</xml>'
@@ -141,9 +142,8 @@ module.exports = () => {
141142
return DEFAULT_WORKSPACE
142143
}
143144

144-
function getEntitiesOrNew() {
145+
function getEntitiesOrNew () {
145146
if (previousEntities && previousEntities.length > 0) return previousEntities
146147
return DEFAULT_ENTITIES
147148
}
148-
149-
}
149+
}

components/panel-group.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ module.exports = component({
108108
window.dispatchEvent(new Event('resize'))
109109

110110
send('panelGroup:_resizePanel', { position }, _.noop)
111-
},
111+
}
112112
}
113113
},
114114

@@ -157,7 +157,7 @@ module.exports = component({
157157
windowResizeHandler()
158158

159159
window.addEventListener('resize', windowResizeHandler)
160-
});
160+
})
161161
}
162162

163163
function unload () {

elements/blockly/blocks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const {
55
MATH_COLOR,
66
ACTION_COLOR,
77
EVENT_COLOR,
8-
MOVEMENT_COLOR,
8+
MOVEMENT_COLOR
99
} = require('./colors')
1010

1111
/* global Blockly */

elements/blockly/colors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
LOGIC_COLOR: '#00838F',
33
LOOPS_COLOR: '#2E7D32',
4-
MATH_COLOR:'#4527A0',
4+
MATH_COLOR: '#4527A0',
55
ACTION_COLOR: '#F9A825',
66
EVENT_COLOR: '#37474F',
77
MOVEMENT_COLOR: '#1565C0'

elements/blockly/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const DEFAULT_OPTIONS = {
3030
},
3131
zoom: {
3232
controls: false,
33-
wheel: false,
33+
wheel: false
3434
}
3535
}
3636

elements/game-runner.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const html = require('choo/html')
22
const sf = require('sheetify')
33
const gameView = require('./game')
4-
const gameStatsView = require('./game-stats')
54
const { speedSliderView, playButtonView } = require('./runtime-controls')
65

76
const gameRunnerPrefix = sf`
@@ -29,15 +28,15 @@ function gameRunnerView ({
2928
game, clock,
3029
onStart, onStop, onChangeSpeed
3130
}) {
32-
3331
const gameHtml = gameView({
3432
state: game,
3533
progress: clock.progress
3634
})
3735

3836
const playButtonHtml = playButtonView({
3937
isRunning: clock.isRunning,
40-
onStart, onStop
38+
onStart,
39+
onStop
4140
})
4241

4342
const speedSliderHtml = speedSliderView({
@@ -60,4 +59,4 @@ function gameRunnerView ({
6059
`
6160
}
6261

63-
module.exports = gameRunnerView
62+
module.exports = gameRunnerView

elements/goal-progress/goal-evaluator.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const _ = require('lodash')
2-
//const X2Js = require('x2js')
2+
// const X2Js = require('x2js')
33
const { getEntity } = require('@robotopia/choo-game')
44

55
function checkGoal ({ goal, game, workspace }) {
@@ -41,18 +41,18 @@ function checkGoal ({ goal, game, workspace }) {
4141
return false
4242

4343
case 'dontTouchTileType':
44-
//TODO: check for robot touching dirt upon walking
45-
//goal.params.tileID
44+
// TODO: check for robot touching dirt upon walking
45+
// goal.params.tileID
4646
return false
4747

4848
case 'useBlockWithinBlock':
49-
//TODO: workspace to json, check for outer block. Stringify outer blocks statement object and regex the inner block.
50-
//const workspaceAsJSON = new X2Js().xml_str2json(workspace);
51-
//goal.params.outerBlock
52-
//goal.params.innerBlock
53-
//console.log(workspaceAsJSON)
49+
// TODO: workspace to json, check for outer block. Stringify outer blocks statement object and regex the inner block.
50+
// const workspaceAsJSON = new X2Js().xml_str2json(workspace);
51+
// goal.params.outerBlock
52+
// goal.params.innerBlock
53+
// console.log(workspaceAsJSON)
5454
return false
55-
55+
5656
case 'discoverEntityOfType':
5757
if (!game || !game.entities || game.entities.length === 0) return false
5858
let i

elements/goal-progress/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function goalProgressView ({ display, game, goals, workspace }) {
6666
}
6767

6868
function goalListView ({ goals, game, workspace }) {
69-
if (goals.length === 0) return;
69+
if (goals.length === 0) return
7070

7171
const goalsHtml = _.map(goals, (goal) => {
7272
const className = classNames('goal', {

elements/page-layout.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,4 @@ function getHeaderHtml (menu) {
6060
`
6161
}
6262

63-
64-
module.exports = pageLayout
63+
module.exports = pageLayout

elements/tutorial/tutorialDialog.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const winningCondition = (gameState, { level, isStoryModalOpen }, workspace, sen
8888
`
8989
}
9090

91-
if (level.onFinish) level.onFinish({ gameState, workspace} )
91+
if (level.onFinish) level.onFinish({ gameState, workspace })
9292

9393
send('tutorial:sendEvent', {type: 'levelWon'})
9494

@@ -116,21 +116,11 @@ const winningCondition = (gameState, { level, isStoryModalOpen }, workspace, sen
116116
}
117117

118118
if (isStoryModalOpen) {
119-
let hintHtml
120-
121119
const startButton = buttonView({
122120
label: 'Start Tutorial',
123121
onClick: () => send('tutorial:setDisplayStoryModal', { displayStory: false })
124122
})
125123

126-
if (story.hint) {
127-
hintHtml = html`
128-
<p class="story-hint">
129-
${story.hint}
130-
</p>
131-
`
132-
}
133-
134124
return modalView(html`
135125
<div class="${prefix} content animated">
136126
<h1>${level.label}</h1>

lib/highlighter.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ const highlighter = () => {
1212

1313
return self
1414

15-
function start() {
15+
function start () {
1616
if (schedule) return console.log('Highlighter already running')
1717
active = false
1818
schedule = window.setInterval(highlight, interval)
1919
highlight()
2020
}
2121

22-
function stop() {
22+
function stop () {
2323
if (!schedule) return console.log('Highlighter was not running')
2424
window.clearInterval(schedule)
2525
schedule = null
2626
active = false
2727
}
2828

29-
function highlight() {
29+
function highlight () {
3030
let elements = []
3131
let i
3232
for (i in self.highlightTheseClasses) {
@@ -50,10 +50,10 @@ const highlighter = () => {
5050
for (i = 0; i < elements.length; i++) {
5151
let classes = elements[i].className
5252
if (classes.indexOf('highlight') === -1) {
53-
classes = classes + " highlight";
53+
classes = classes + ' highlight'
5454
}
5555
if (active) {
56-
elements[i].className = classes + " HL_on";
56+
elements[i].className = classes + ' HL_on'
5757
} else {
5858
elements[i].className = classes.replace(/\s*HL_on/g, '')
5959
}
@@ -62,4 +62,4 @@ const highlighter = () => {
6262
}
6363
}
6464

65-
module.exports = highlighter
65+
module.exports = highlighter

models/game/entities.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525
team: { id: teamId },
2626
position: { x, y, rotation: orientation },
2727
movable: {},
28-
discoverer: { range: discoverRange ? discoverRange : 3 },
28+
discoverer: { range: discoverRange | 3 },
2929
collector: { hasResource: hasResource },
3030
worker: { assignedTask: null },
3131
zIndex: 5,

models/tutorial/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const _ = require('lodash')
22
const update = require('immutability-helper')
33
const levels = require('../../assets/tutorial')
4-
//const levels = require('./levels')
4+
// const levels = require('./levels')
55

66
let willStopOnNextTick = false
77

@@ -65,14 +65,14 @@ module.exports = {
6565
}
6666
}
6767

68-
function handleClockEvent(events, event, send) {
68+
function handleClockEvent (events, event, send) {
6969
if (!event.hasOwnProperty('operation')) return events
7070
if (event.operation === 'tick') {
7171
if (willStopOnNextTick) {
7272
send('clock:stop', null, _.noop)
7373
willStopOnNextTick = false
7474
}
75-
return updatedEvents = update(events, {
75+
return update(events, {
7676
time: { $set: events.time + 1 }
7777
})
7878
}
@@ -81,4 +81,4 @@ function handleClockEvent(events, event, send) {
8181
time: { $set: event.value }
8282
})
8383
}
84-
}
84+
}

0 commit comments

Comments
 (0)