Commit Graph

35 Commits

Author SHA1 Message Date
Guangcong Luo
56190af620 Fix up TypeScript errors
Also suppress TypeScript validation of various files we don't want
validated right now.
2017-11-08 01:23:04 -06:00
Guangcong Luo
844f461dbb TypeScript rooms.js 2017-11-06 21:56:33 -06:00
Guangcong Luo
7466edf24e Remove unused globals.js file 2017-11-06 21:19:54 -06:00
Guangcong Luo
2d9fc18280 TypeScript sim/team-validator.js 2017-11-02 00:15:04 -05:00
Guangcong Luo
0e728281e6 Move team-validator to sim/team-validator 2017-11-01 05:22:37 -05:00
Guangcong Luo
a47077bbe9 Split TeamValidator and TeamValidatorAsync
I'm not really sold on "TeamValidatorAsync" as a class name or file
name, so I'm open to suggestions.

The long-term plan is to put TeamValidator in sim/ but this is in three
commits because I really want the right file to retain blame history.
2017-10-31 15:49:09 -05:00
Quinton Lee
a0b8228592 TypeScript: Improve Sim typing (#4069)
Also improves intellisense for Visual Studio and Visual Studio Code.
2017-10-20 07:53:26 -05:00
Guangcong Luo
88159c41bc Refactor BattleRoom -> GameRoom
BattleRoom is now GameRoom, a slightly more abstract room type capable
of holding any of a number of possible roomgames. Currently, battles
are the only such roomgame, but any future roomgame could possibly use
it.

Differences between ChatRoom and GameRoom:

- GameRooms start at the left, ChatRooms start at the right
- GameRooms have chat on the right, and a game area on the left, with a
  view area at the top left and a controls area at the bottom left
- GameRooms retain all their logs, ChatRooms only retain the latest 100
  lines
- GameRooms expire after 40 minutes of inactivity or 10 minutes of zero
  online users (configurable in the future)
- GameRooms are guaranteed to have an associated game, while ChatRooms
  may or may not
2017-10-18 05:41:03 -05:00
Ben Davies
a5bc1e0045 Typescript: ladders-matchmaker.js (#3942) 2017-09-01 19:18:59 -04:00
Ben Davies
67b25950de Typescript: Declare all globals, refactor monitor.js (#3748) 2017-07-13 12:20:03 +09:00
Ben Davies
74131dbf58 Typescript: crashlogger.js (#3605)
Depended on by numerous other modules to be moved over to Typescript
before they can.
2017-06-11 11:16:21 -05:00
Guangcong Luo
149ca3759c Add classes for data
Having classes for data will make it better for documenting and make
for overall nicer code that's easier to statically analyze.
2017-05-17 04:10:01 -05:00
Guangcong Luo
e34c77930a Start creating classes for getEffect data
Currently, getEffect/getTemplate/getMove/etc return bare objects.
Refactoring their returns into classes will allow TypeScript to type
check them.
2017-05-09 16:00:11 -05:00
Ben Davies
8de4bdfecb Sockets: refactor to use maps (#3474) 2017-04-23 16:39:38 -07:00
Ben Davies
5031794f97 Sockets: fix unit tests (#3281)
* Sockets: fix Sockets.killWorker not disconnecting connections

* Sockets: fix unit tests

- Fix crash when constructing mock sockets in certain cases
- Properly prevent workers from writing to stdout
- Fix race conditions in workers-related tests that were causing false
  positives

* Tests: mock workers now more closely imitate sockets' workers

This helps catch cases where messages are being sent in the wrong order
to the workers, e.g. messages sent to sockets that no longer exist.
2017-02-24 05:38:37 -06:00
Ben Davies
5c4834f3fd Tests: tweak user mocks, add Connection tests, fix Trivia tests (#2682)
Worker mocks now have proper ids. Trivia tests now dispose of user objects
rather than letting them stay in memory for the rest of the tests.
2016-08-09 04:02:27 -05:00
Guangcong Luo
095652c9ee Exit process when child process exits
If a child process dies in a way that it can't recover from, the main
process now exits, to prevent loops of 'Error: channel closed'
thousands of times a second, filling up the error log and making it
hard to track down the real error.
2016-02-03 22:40:51 -06:00
Konrad Borowski
81f602b8d8 Always use trailing comma for multiline objects 2016-01-01 00:20:07 +01:00
Konrad Borowski
79a5b23f25 Modify data and mods files to follow style rules 2016-01-01 00:18:00 +01:00
Konrad Borowski
156e193bed Only enable certain ES6 features during ESLint test
Currently, only those features are allowed: let/const, classes, and
octal literals. More can be added when needed, as long main Showdown
server has a supporting Node.js's version.

This also accidentally fixes a bug which caused data files to not
be checked for `let`/`const` keyword existence, which would cause
a problem in a web browser.
2015-12-10 23:07:32 +01:00
Guangcong Luo
332a65f9c0 Convert some Users tables to ES6 Maps
Specifically, Users.users, Users.connections, and Users.pastUsers
are now ES6 Maps. In theory, this should be a minor performance
upgrade, but we still need to profile to make sure.
2015-12-10 11:52:26 -05:00
Ivo Julca
648cd538ff Disallow var variable declarations except in data/ 2015-12-03 19:46:11 -05:00
Ivo Julca
44adce3f78 Turn on strict mode globally for real 2015-11-08 15:43:47 -05:00
Ivo Julca
8619ba2022 Turn on strict mode globally for real 2015-11-08 15:38:15 -05:00
Ivo Julca
793b4977b9 Eslint: loosen new-cap rule
Some of our globals are functions -yet not constructors.
2015-11-08 15:18:21 -05:00
Guangcong Luo
ded9f1cd5d Fix duplicate cases in random set generators 2015-11-07 23:12:19 -06:00
Ivo Julca
7dddb66253 Migrate build system to ESLint
JSHint's ES6 support is shaky, and its development has stalled as of late.
Since ESLint can do by itself both JSHint and JSCS' jobs, this commit replaces them.
Gulp and its related dependencies are also hereby removed.
2015-11-07 21:36:49 -05:00
Juanma Serrano
c4ac8d6e2f Use strict mode and let and const instead of var
This commit also fixes some duplicated variable declarations.
2015-11-06 21:56:52 -05:00
Ivo Julca
e9b09d1096 Test: fix suite in Node.js prior to 2.2.0 2015-09-11 01:04:52 -05:00
Ivo Julca
85379ff12e Test: don't listen for connections 2015-09-11 00:38:49 -05:00
Ivo Julca
cd36fbfde2 Gulpfile: add more JSCS rules
- Disallow spaces between function names and round brackets.
- Disallow spaces inside array/object literal brackets.
- Disallow spaces before semicolons.
- Disallow yoda conditions for equality.
2015-07-28 19:38:53 -05:00
Ivo Julca
b441375b5a Test: move utility functions to dev-tools/ 2015-07-07 03:08:18 -05:00
Ivo Julca
8329e6f532 JSCS: fix crash in validateConditionals rule for empty blocks 2015-06-18 19:35:41 -05:00
Ivo Julca
c08aba185b Implement JSCS rule to enforce switch cases not to be indented 2015-06-12 03:41:04 -05:00
Ivo Julca
b740197244 Implement JSCS rule to enforce PS conditionals' style 2015-06-12 03:36:36 -05:00