Commit Graph

98 Commits

Author SHA1 Message Date
Guangcong Luo
73a04cdcba TypeScript: Enable noImplicitOverride
Some checks are pending
Publish to npm / test (push) Waiting to run
Publish to npm / get-version (push) Waiting to run
Publish to npm / npm-publish (push) Blocked by required conditions
Node.js CI / build (18.x) (push) Waiting to run
2025-02-26 14:38:32 -08:00
Guangcong Luo
62023bd299 Emit .d.ts types for NPM package
Some checks are pending
Publish to npm / test (push) Waiting to run
Publish to npm / get-version (push) Waiting to run
Publish to npm / npm-publish (push) Blocked by required conditions
Node.js CI / build (18.x) (push) Waiting to run
2025-02-26 02:44:08 -08:00
Guangcong Luo
78439b4a02
Update to ESLint 9 (#10926)
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.
2025-02-25 20:03:46 -08:00
livid washed
64c5951970
Move Random Battles files to a separate folder (#10285)
* Move Random Battles files to a new folder

* Fix bdsp test

* Move SSB back and move rands files into folders

* fix BF tests

* fix test

* fix bug

* fix SSB teamgen
2024-05-09 18:52:33 -06:00
Guangcong Luo
eb0ef53e0e
Remove unlinkUser (#10101)
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.
2024-01-08 20:49:34 -08:00
Mia
b11177d530
Migrate to esbuild for compilation (#9203) 2022-12-22 15:19:29 -06:00
Annika
836539f7ba tsc: Ignore private code type definitions 2021-11-29 15:53:05 -08:00
Mia
f608496938
Support JSX in HTML pages (#8523)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2021-11-12 22:06:26 -08:00
Mia
a482307402
tsc: Stop checking node_modules 2021-10-22 17:42:45 -05:00
Annika
c134195915
Use ts-node instead of Sucrase (#8369) 2021-07-09 19:59:22 -07:00
Annika
4424fbff9b
Make tsc warn about unreachable code (#8122) 2021-03-16 18:29:53 -07:00
Annika
d858bed664
Enable incremental compilation in tsc (#7802)
This makes `npm test` faster.
2020-12-13 23:11:38 -08:00
Adam Tran
c7c5f4253b
Support generating sourceMaps for source debugging (#7797) 2020-12-13 19:42:19 -08:00
Annika
a3b83ba50b
Translations: Convert JSON to TypeScript (#7493) 2020-10-09 12:03:44 -07:00
Guangcong Luo
2bcea34447 Support ./pokemon-showdown simulate-battle -S
simulate-battle now has a new option: --spectate.

As a recap:

-D --debug: simulate in debug mode

-R --replay: output only the omniscient (debug) replay, rather than the
  full stream

-S --spectate: output only the spectator replay, rather than the full
  stream
2020-09-29 15:28:07 -07:00
Guangcong Luo
ea8f52ce97
Move descriptions to data/text/ files (#7036)
This adds some new `data/text/` files, which are the new home for
item/move/ability descriptions, as well as in-game messages, in one
place for ease of translation.
2020-09-06 22:00:11 -07:00
Guangcong Luo
cd5c7991b7 Only check .ts files in server/
Mostly, this prevents TypeScript from complaining about .js
files in config/chat-plugins/private/
2020-06-10 11:23:20 -04:00
Guangcong Luo
377969aab2 Simplify tsconfig
A lot of this complexity was because we were once half-migrated, but
now we're basically fully migrated to TypeScript so there's no more
need.
2020-06-09 13:55:53 -07:00
Kris Johnson
a7948c7c9c
Typescript config/ (#6760) 2020-05-29 19:34:43 -07:00
Kris Johnson
e64e083e6c
Typescript The Cafe (#6379) 2020-02-20 23:01:20 -08:00
Kris Johnson
2ea84725e2
Typescript Daily Spotlight, RoomFAQs, and Wi-Fi (#6373) 2020-02-18 13:26:44 -08:00
Kris Johnson
5550b164c8
Typescript Calculator and Chat Monitor (#6365) 2020-02-13 12:38:12 -08:00
Kris Johnson
9aaab2c57b
Typescript Help Tickets and Modlog and fix warnings (#6352) 2020-02-12 21:48:03 -08:00
Kris Johnson
649ac8ea6b Typescript uno/othermetas/hangman (#6229) 2019-12-31 17:52:26 +09:00
whales
fb6f7cb7dc Typescript mafia (#6145) 2019-12-09 22:17:09 +09:00
Guangcong Luo
23f9bfa1b7
Split up server/chat-commands/ (#5943)
`server/chat-commands.js` is now a directory. It's been split into
`core`, `moderation`, and `admin`. `info` and `roomsettings` from
`chat-plugins` have also moved to `chat-commands`.

Some cleanup:

- Bot commands for inserting HTML into rooms like `/adduhtml` have been
  moved from `info` into `admin`.

- `/a` has been renamed `/addline`, for clarity (and also moved from
  `info` into `admin`).

- Room management commands like `/createroom` and `/roomintro` were
  moved to `room-settings`

- `chat-commands/admin` has been TypeScripted
2019-11-15 11:12:54 +13:00
Kirk Scheibelhut
b9e5fcb387
Introduce set importer logic (#5749)
`node tools/set-import [version]` can be run to create a
`@pokemon-showdown/sets` package containing sets from Smogon, usage
stats and third party sources. Some notes:

- The build is set up so that `tools/set-import/importer.ts` is
  compiled to `tools/set-import/importer.js` - creating a
  `.tools-dist/set-import` directory for the sole artifact was
  deemed to be overkill
- The sets package is generated such that it can be used easily on
  Node or in a browser (where the large set JSON can be loaded
  asynchronously)
- Supported tiers/formats are mostly arbitrary - those popular
  enough to have a signficant playerbase or analyses on Smogon have
  been included, but additional formats can be added based on demand
- Some set information is redundant for ease of use by downstream
  users: certain formes are split out and information that could
  theoretically be inferred like level/ability/HP IVs are included
  to simplify parsing logic and make the sets more immediately
  available. This results in what should mostly be negligible
  size overhead.
- In a similar vein, display versions of effect names instead of IDs
  are used (name -> ID is trivial, ID -> name requires data lookup)
- All sets pass validation, provided certain simple transformations
  are applied (eg. reverting `battleOnly` formes like Megas)

This tool has primarily been tested to run on Linux - running on
other platforms is not guaranteed to result in error-free output.
2019-09-10 21:15:05 -04:00
whales
16551a7c5c Typescript lottery (#5739) 2019-08-30 09:12:49 -05:00
TheJetOU
620fd82376 Add lottery plugin (#5722) 2019-08-26 09:56:01 -07:00
TheJetOU
7fe2e5338c TypeScript Tournaments (#5723) 2019-08-24 03:48:13 -07:00
Guangcong Luo
2093539e06
Update RoomGame API (#5492)
- The big change here is that player.userid can now be empty. You can
  now fit state into RoomGamePlayer subclasses even when there are no
  users associated with them.

- `game.players` has been introduced as the new canonical list of
  players, including userless players. The old `game.players` has been
  renamed `game.playerTable`, for clarity.

- `game.addPlayer` now returns the added player

All existing RoomGames have been updated for the new API, and
RoomBattle is now officially a RoomGame subclass.

Tournaments was also massively refactored to be properly updated for
the old API, since that never happened, and should now be a lot more
readable.
2019-05-12 12:56:32 +09:30
Kirk Scheibelhut
a9b26fce72 Typescript server/verifier.js (#5482) 2019-05-07 14:09:01 +09:30
Kirk Scheibelhut
6fea91ee56 Split dev-tools/globals* into sim and server (#5450) 2019-04-18 04:17:54 +09:30
whales
770d3e6b50 Typescript tours (#5323) 2019-04-06 15:51:32 +08:00
Kirk Scheibelhut
c911ee6fa6 Move sim/battle-stream-example.ts to sim/examples subdir 2019-03-22 02:42:05 -05:00
Kirk Scheibelhut
6e122d5d74 Refactor lib/ to be native Typescript (#5217) 2019-03-02 11:12:24 -06:00
Kirk Scheibelhut
36fb436b09 Include data/mods/gen1/pokedex.js in tsconfig (#5213) 2019-02-26 11:28:16 -06:00
Kirk Scheibelhut
b09fd63377 Refactor sim/ to be native Typescript (#5210) 2019-02-26 11:03:30 -06:00
Kirk Scheibelhut
ddcb15e3b7 Cleanup tsconfig includes further (#5202) 2019-02-24 03:23:40 -06:00
Kirk Scheibelhut
0dd43ea3a9 Remove 'server/process-manager.js' from tsconfig (#5197)
'process-manager.js' now lives under 'lib/' which is already
included.
2019-02-22 15:38:26 -06:00
Guangcong Luo
f3e45fbb72 Move server code to server/
Also move mods/ to data/mods/

This makes PS more monorepo-like. The intent is to further separate
the sim and the server code, but without fully committing to splitting
the repository itself.

We now support `./pokemon-showdown start` in addition to
`./pokemon-showdown`. I'm not clear which I want to be the default
yet.
2019-02-03 16:07:06 -06:00
urkerab
5863284eaa Fix some OMotM crashes (#5132) 2019-02-01 19:48:13 -06:00
urkerab
c9ac10d075 Other Metagames of the Month February 2019 (#5131) 2019-02-01 15:17:57 +04:00
Bär Halberkamp
466f4b3324 Add a /daily plugin (#5052) 2019-01-08 19:04:57 -06:00
Bär Halberkamp
0b3593f9a7 Add a chat plugin for The Café 2018-11-07 20:04:12 +01:00
The Immortal
ede7d8da8c Add Fortemons 2018-11-01 21:50:14 +04:00
Kris Johnson
1a729f65a3 Add OMotM, LCotM, and RoA Spotlight November (#4946) 2018-11-01 15:45:32 +04:00
The Immortal
6ef253379c Add Partners in Crime 2018-10-22 15:47:45 +04:00
Kris Johnson
9b0e99b06f G&F: Fix validation with Mega Evolutions (#4882) 2018-10-03 00:53:46 +04:00
Kris Johnson
3d3526a2a5 OMotM, LCotM, and RoA Spotlight Oct 2018 (#4880) 2018-10-02 12:01:23 +04:00