Skip to content

Commit e3c390a

Browse files
author
Valentin Vetter
committed
cleanup(sdk): fix standard issues
Using `npx standard --fix`
1 parent 16a8dd9 commit e3c390a

File tree

13 files changed

+36
-32
lines changed

13 files changed

+36
-32
lines changed

engine/modules/entities/src/main/resources/view/entity-module/BitmapText.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Entity } from './Entity.js'
2-
import {ErrorLog} from '../core/ErrorLog.js'
3-
import {MissingBitmapFontError} from './errors/MissingBitmapFontError.js'
2+
import { ErrorLog } from '../core/ErrorLog.js'
3+
import { MissingBitmapFontError } from './errors/MissingBitmapFontError.js'
44
import { TextureBasedEntity } from './TextureBasedEntity.js'
55

66
/* global PIXI */
@@ -31,7 +31,7 @@ export class BitmapText extends Entity {
3131
if (PIXI.extras.BitmapText.fonts[state.fontFamily]) {
3232
if (this.graphics.children.length === 0) {
3333
this.displayed = new PIXI.BitmapText(state.text, {
34-
font: {size: state.fontSize || 1, name: state.fontFamily}
34+
font: { size: state.fontSize || 1, name: state.fontFamily }
3535
})
3636
this.graphics.addChild(this.displayed)
3737
} else {

engine/modules/entities/src/main/resources/view/entity-module/Command.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class CreateCommand {
5757
}
5858

5959
apply (entities) {
60-
let entity = EntityFactory.create(this.type)
60+
const entity = EntityFactory.create(this.type)
6161
entity.id = this.id
6262
entities.set(this.id, entity)
6363
}
@@ -143,7 +143,7 @@ export class PropertiesCommand {
143143
if (typeof opts.convert === 'function') {
144144
value = opts.convert(value, globalData, frameInfo, this.t)
145145
}
146-
let method = PropertiesCommand.curves[args[idx + 2]]
146+
const method = PropertiesCommand.curves[args[idx + 2]]
147147

148148
this.params[key] = value
149149
idx += 2
@@ -156,7 +156,7 @@ export class PropertiesCommand {
156156
}
157157

158158
apply (entities, frameInfo) {
159-
let entity = entities.get(this.id)
159+
const entity = entities.get(this.id)
160160
entity.addState(this.t, { values: this.params, curve: this.curve }, frameInfo.number, frameInfo)
161161
entity.stateAdded = true
162162
}

engine/modules/entities/src/main/resources/view/entity-module/CommandParser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function splitOnCharOutsideQuotes (text, charParam) {
4242

4343
function getCommands (Type, text, globalData, frameInfo) {
4444
const args = splitOnCharOutsideQuotes(text, ';')
45-
let commands = []
45+
const commands = []
4646
args.forEach(command => commands.push(new Type(splitOnCharOutsideQuotes(command, ' '), globalData, frameInfo)))
4747
return commands
4848
}

engine/modules/entities/src/main/resources/view/entity-module/Entity.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class Entity {
4141
if (!this.states[frame]) {
4242
this.states[frame] = []
4343
}
44-
let state = Entity.createState(t, params.values, params.curve)
44+
const state = Entity.createState(t, params.values, params.curve)
4545

4646
const collision = this.states[frame].find(v => v.t === t)
4747
if (collision && Object.keys(state.curve).length === 0) {
@@ -62,7 +62,7 @@ export class Entity {
6262
}
6363

6464
render (progress, data, globalData) {
65-
let subframes = this.states[data.number]
65+
const subframes = this.states[data.number]
6666
this.container.visible = false
6767
let start = null
6868
let end
@@ -79,7 +79,7 @@ export class Entity {
7979

8080
if (!start) {
8181
// The start frame must be at the end of a previous turn
82-
let frameNumbers = Object.keys(this.states)
82+
const frameNumbers = Object.keys(this.states)
8383
let index = frameNumbers.indexOf(data.number.toString()) - 1
8484
// Failsafe
8585
if (index === -1) {
@@ -88,7 +88,7 @@ export class Entity {
8888
while (index >= 0 && frameNumbers[index] >= data.number) {
8989
index--
9090
}
91-
let prev = this.states[frameNumbers[index]] || []
91+
const prev = this.states[frameNumbers[index]] || []
9292
start = prev[prev.length - 1]
9393

9494
// If it didn't exist on the previous turn, don't even animate it
@@ -104,12 +104,12 @@ export class Entity {
104104
}
105105
} else {
106106
// Look for the most recent state, but don't interpolate?
107-
let frameNumbers = Object.keys(this.states)
107+
const frameNumbers = Object.keys(this.states)
108108
let index = frameNumbers.length - 1
109109
while (index >= 0 && frameNumbers[index] > data.number) {
110110
index--
111111
}
112-
let substates = this.states[frameNumbers[index]]
112+
const substates = this.states[frameNumbers[index]]
113113

114114
if (substates != null) {
115115
start = substates[substates.length - 1]
@@ -121,7 +121,7 @@ export class Entity {
121121
if (start) {
122122
const changed = {}
123123
const state = Object.assign({}, this.currentState)
124-
for (let property of this.properties) {
124+
for (const property of this.properties) {
125125
const opts = PROPERTIES[property] || PROPERTIES.default
126126
const lerpMethod = opts.lerpMethod
127127
const curve = end.curve[property] || (a => a)

engine/modules/entities/src/main/resources/view/entity-module/EntityFactory.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { BitmapText } from './BitmapText.js'
77
import { Group } from './Group.js'
88
import { BufferedGroup } from './BufferedGroup.js'
99
import { SpriteAnimation } from './SpriteAnimation.js'
10-
import { RoundedRectangle } from './RoundedRectangle.js';
11-
import { Polygon } from './Polygon.js';
12-
import { TilingSprite } from './TilingSprite.js';
10+
import { RoundedRectangle } from './RoundedRectangle.js'
11+
import { Polygon } from './Polygon.js'
12+
import { TilingSprite } from './TilingSprite.js'
1313

1414
export class EntityFactory {
1515
static create (type) {

engine/modules/entities/src/main/resources/view/entity-module/GraphicEntityModule.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class GraphicEntityModule {
109109

110110
entity.states[frameNumber] = subStates.map((subState) => {
111111
// Extrapolate through existing substates, updating the extrapolationMap in the process (currentState)
112-
const state = this.extrapolationMap[entity.id] = { ...this.extrapolationMap[entity.id], ...subState}
112+
const state = this.extrapolationMap[entity.id] = { ...this.extrapolationMap[entity.id], ...subState }
113113

114114
if (typeof entity.computeAnimationProgressTime === 'function') {
115115
entity.computeAnimationProgressTime(prevState, state)
@@ -160,7 +160,7 @@ export class GraphicEntityModule {
160160
this.resortTree()
161161
this.globalData.mustResort = false
162162
}
163-
for (let entityId in this.globalData.maskUpdates) {
163+
for (const entityId in this.globalData.maskUpdates) {
164164
const entity = this.entities.get(+entityId)
165165
const maskId = this.globalData.maskUpdates[entityId]
166166
if (maskId === -1) {
@@ -169,7 +169,7 @@ export class GraphicEntityModule {
169169
entity.container.mask = this.entities.get(maskId).graphics
170170
}
171171
}
172-
for (let entity of this.globalData.updatedBuffers) {
172+
for (const entity of this.globalData.updatedBuffers) {
173173
entity.postUpdate()
174174
}
175175
this.globalData.maskUpdates = {}

engine/modules/entities/src/main/resources/view/entity-module/Rectangle.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export class Rectangle extends Shape {
44
static defaultSideLength () {
55
return 100
66
}
7+
78
constructor () {
89
super()
910
Object.assign(this.defaultState, {

engine/modules/entities/src/main/resources/view/entity-module/RoundedRectangle.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ export class RoundedRectangle extends Shape {
44
static defaultSideLength () {
55
return 100
66
}
7+
78
static defaultRadius () {
89
return 20
910
}
11+
1012
constructor () {
1113
super()
1214
Object.assign(this.defaultState, {

engine/modules/entities/src/main/resources/view/entity-module/Shape.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@ export class Shape extends Entity {
66
static defaultLineWidth () {
77
return 0
88
}
9+
910
static defaultFillColor () {
1011
return 0xffffff
1112
}
13+
1214
static defaultLineColor () {
1315
return 0x0
1416
}
17+
1518
static defaultLineAlpha () {
1619
return 1
1720
}
21+
1822
static defaultFillAlpha () {
1923
return 1
2024
}
25+
2126
constructor () {
2227
super()
2328
Object.assign(this.defaultState, {

engine/modules/entities/src/main/resources/view/entity-module/Sprite.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {SpriteBasedEntity} from './SpriteBasedEntity.js'
2-
import {ErrorLog} from '../core/ErrorLog.js'
3-
import {MissingImageError} from './errors/MissingImageError.js'
1+
import { SpriteBasedEntity } from './SpriteBasedEntity.js'
42

53
/* global PIXI */
64

0 commit comments

Comments
 (0)