boolean -> number and number -> string should be explicit. Probably
string -> number should be, too, but I'm not ready to turn on the lint
option yet.
This was supposed to be part of the big ESLint refactor but I forgot
to push it. <_<
ESLint has a whole new config format, so I figure it's a good time to
make the config system saner.
- First, we no longer have separate eslint-no-types configs. Lint
performance shouldn't be enough of a problem to justify the
relevant maintenance complexity.
- Second, our base config should work out-of-the-box now. `npx eslint`
will work as expected, without any CLI flags. You should still use
`npm run lint` which adds the `--cached` flag for performance.
- Third, whatever updates I did fixed style linting, which apparently
has been bugged for quite some time, considering all the obvious
mixed-tabs-and-spaces issues I found in the upgrade.
Also here are some changes to our style rules. In particular:
- Curly brackets (for objects etc) now have spaces inside them. Sorry
for the huge change. ESLint doesn't support our old style, and most
projects use Prettier style, so we might as well match them in this way.
See https://github.com/eslint-stylistic/eslint-stylistic/issues/415
- String + number concatenation is no longer allowed. We now
consistently use template strings for this.
This reinstates the recently-reverted RoomGame refactor/cleanup, but
with the bugs (forfeiting BestOfGame, and autojoin) fixed.
This reinstates:
- 6bccd4f622 Fix crash in bestof when expiring battles
- 2a48cbd064 Cleanup more RoomGame implementations
The latter fixes these, in addition to refactoring:
- Fix a race condition when destroying bestof games
- Fix `/tour settings scouting off` error message
This is mostly just refactoring, but the refactor caught a few bugs:
- Fix a race condition when destroying bestof games
- Fix `/tour settings scouting off` error message
`users.joinRoom` was not written to handle `Chat.Interruption`.
This is a stopgap fix. A proper fix would probably involve relocating
`onBeforeRoomJoin`.
This refactor removes `player.unlinkUser()` which was used for several
unrelated use cases.
These have been split apart into:
- at the end of a game, `game.setEnded()` now clears `user.games`,
while leaving `player.id` untouched
- when trying to change the user associated with the player, we now
consistently use the higher-level `game.updatePlayer()`
There's a good chance this fixes the lagspikes currently affecting PS.
This replaces some pretty jank code with much cleaner code.
Anything that would be more cleanly implemented by iterating the
players array is now done by iterating the players array.
Some instances of p1/p2 are lying around but we should slowly deprecate
them.
This does 2 things:
* allows command permissions to be set to the default user group, granting the permission to all users
* lets rooms set permissions for broadcasting on a per-command basis by using `!` as the prefix for a command with no other permissions requirements
This is intended to let Tech & Code room let regular users broadcast `!code`, but potentially has other applications.
Closes#9534
Loginfilter doesn't fit the usecase for this since it doesn't track renames - oldUser doesn't work since that's only if the name was already used, and consulting previousIDs doesn't work since we only add userids to that once. This is the simplest way to add support for this functionality.
GlobalAuth#delete already calls GlobalAuth#save, so this save call is unnessecary.
Testing did not reveal and problems with removing this extra call.
This is an attempt to fix a rare issue where GlobalAuth changes do not save.
Changes relevant to our codebase:
- TypeScript now knows that `typeof id === 'string'`! A bunch of casts
on `User | ID` or `Room | RoomID` are no longer necessary!!!
- `override` will protect against certain typoes, and we'll adopt it
(and `--noImplicitOverride`) as soon as sucrase comes in
- `declare` is now required for properties we want to narrow the type
of without directly overwriting - a good thing to use going forward,
but very annoying to fix all our old code for
This involves a huge refactor for how battles are constructed, but
it's totally worth it.
Currently, tournaments, challenges, and laddering are unsupported; only
unrated searches work. But it does work, and it's beautiful.