We talked about maybe doing this in 2018, and for some reason I woke up today wanting to eslint something. :thinking: Maybe it's because I've been playing Factorio for 2 days straight.
So I fired it up with "eslint:recommended"-settings and beat the red text with hammers until I got tired. Here's the progress so far.
I've fixed stuff that looked obvious (unused variables, mixed tabbing, vars overriding each other, …) but left eslint erroring if I felt unsure. I mostly did only the minimum to resolve the eslint error, so for example while a full var→const/let replacement round would be a good idea, I've so far just been replacing them individually where they fix eslint errors.
Ones I'm unsure about that @sidorares should maybe check that they're no problem:
[ ] lib/unpackstream.js:323 → takes an unused stream argument, but the stream.write call is commented out; is that a bug, or a remnant from an old implementation?
[ ] lib/xcore.js:22 → stash isn't called anywhere, is it for debugging like hexy? Seems like a no-op?
[ ] lib/ext/render.js:34 → the num_* stuff is extracted but not used. Should they be in res?
[ ] lib/ext/render.js:99 → Unused function. For debugging?
[ ] lib/ext/render.js:435 → Unused variable glyphPaddedLength. Sounds meaningful but isn't used. Is it a logical error?
We talked about maybe doing this in 2018, and for some reason I woke up today wanting to eslint something. :thinking: Maybe it's because I've been playing Factorio for 2 days straight.
So I fired it up with
"eslint:recommended"
-settings and beat the red text with hammers until I got tired. Here's the progress so far.I've fixed stuff that looked obvious (unused variables, mixed tabbing,
var
s overriding each other, …) but left eslint erroring if I felt unsure. I mostly did only the minimum to resolve the eslint error, so for example while a fullvar
→const
/let
replacement round would be a good idea, I've so far just been replacing them individually where they fix eslint errors.Ones I'm unsure about that @sidorares should maybe check that they're no problem:
[ ]
lib/unpackstream.js:323
→ takes an unusedstream
argument, but thestream.write
call is commented out; is that a bug, or a remnant from an old implementation?[ ]
lib/xcore.js:22
→stash
isn't called anywhere, is it for debugging likehexy
? Seems like a no-op?[ ]
lib/ext/render.js:34
→ thenum_*
stuff is extracted but not used. Should they be inres
?[ ]
lib/ext/render.js:99
→ Unused function. For debugging?[ ]
lib/ext/render.js:435
→ Unused variableglyphPaddedLength
. Sounds meaningful but isn't used. Is it a logical error?[ ]
lib/ext/render.js:647
→ Unused variablecharFormat
. Again sounds meaningful. Check logic.[ ]
lib/ext/render.js:650
→ as just above ↑[ ]
lib/ext/apple-wm.js:186
→SetWindowMenu
only contains dead code, so I commented it out. Probably in-progress and intentional?Marked items either passed lint already, or I did a basic pass over them (adding notable issues to the above list for competent review):