Commit Graph

54 Commits

Author SHA1 Message Date
Guangcong Luo
a10821ab8b
Update to ESLint 9 (#2326)
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
This finally removes the tslint dependency and switches to eslint.

There are a lot of other changes here, too, to bring the codebase up to
server standards. TSLint never had much in the way of indentation
enforcement.

Not very happy about eslint splitting itself up over 6 dependencies,
or its documentation over three websites, nor how poorly documented the
new flat config is, but I mean, eslint's gonna eslint. Customizing
would be even harder if we tried to use Biome or something. They mostly
seem to go full Prettier.

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 (except in ES3
  code). We otherwise now consistently use template strings for this.
2025-02-25 20:05:32 -08:00
Guangcong Luo
51657d5008 Increase TypeScript strictness
(Now with `noImplicitOverride`)
2025-02-19 00:47:33 -08:00
Guangcong Luo
5d41f3ec93
Reorganize directories (#2187)
Files meant to be served have been moved into
`play.pokemonshowdown.com/` and `pokemonshowdown.com/`.

We now have three directories for the three subdomains handled by this
repo:

- `pokemonshowdown.com/`
- `play.pokemonshowdown.com/`
- `replay.pokemonshowdown.com/`

Naming them after the subdomains will make it much easier to tell where
the files for each go.

The diff is probably useless; it'll be easier if you just look at the
new tree:
https://github.com/smogon/pokemon-showdown-client/tree/reorganize
2023-11-16 03:39:29 -08:00
Guangcong Luo
86a70287bb
Update dependencies 2023-03-16 05:01:37 -07:00
Adam Tran
6cdb206747
Add source-map dependency (#1970) 2022-05-12 22:11:40 -04:00
Guangcong Luo
e74eac22d1 Update dependencies 2021-11-25 20:52:51 -05:00
Guangcong Luo
2cd13d9de2 Remove babel-cli dependency
At this point, we might as well use babel-core directly.

New system supports source maps for `battledata` and `graphics`! Woo!

It also logs the compile step.
2021-04-13 14:06:25 -07:00
Guangcong Luo
8aa6db2d81 Update TypeScript version 2021-04-11 04:46:25 -07:00
Guangcong Luo
621d6565e6 Update .babelrc
The new Babel version gives us access to transforming `||=` and `??`,
and removes the need for a lot of dependencies that are now included in
`@babel/preset-env` thanks to them being released rather than proposals.

This also adds a new Babel plugin to simply remove import/export when
building, which seems to be the best way to make `import` and `export`
usable on the client.
2021-04-10 23:23:49 -07:00
Guangcong Luo
d40fa7f28e Update Babel to latest version 2021-04-10 22:30:50 -07:00
Guangcong Luo
7fc87cad1c Build data/text.js from server
text.js is no longer maintained in the client repo; it's now built
directly from the server's data/text/ directory.
2020-10-27 17:09:49 +00:00
Guangcong Luo
374c18580e Update jQuery types
It looks like a past jQuery type bug was fixed sometime recently.
2020-10-20 16:59:46 +01:00
Guangcong Luo
fed48471ae Update TypeScript version 2020-10-09 20:50:12 -07:00
Kirk Scheibelhut
d76cd108dd Create test pages for sprites
Similar to styles/STYLING.html and styles/hpbartest.html, test pages
prove to be more robust and convenient for testing than the unit
tests (which are already broken).

These pages are primarily intended to help with delivering #1369,
but can be used to test improvements to sprites across the board.
2020-04-02 11:48:50 -07:00
Kirk Scheibelhut
9714d936a5
Begin adding sprite tests (#1476) 2020-03-15 22:34:44 -07:00
Guangcong Luo
651f875cf2 Suppress build error
This build error doesn't appear locally and I can't reproduce it, but
I've heard others report it, and now Travis is having it as an issue.

I'm going to try to explicitly specify this dependency to see if it
makes a difference.
2019-11-11 21:33:01 +13:00
Guangcong Luo
0d05feb41b Migrate to optional chaining and TypeScript 3.7
This is something I probably wouldn't have rushed nearly as much,
except I have a serious use-case coming up; specifically

```js
foo = document.querySelector('foo')?.bar;
```

in a class property.

`document.querySelector('foo') && document.querySelector('foo').bar`
is incredibly inefficient here, but TypeScript doesn't consider
`(document.querySelector('foo') || {}).bar` to be valid because `{}`
doesn't have the `.bar` property. Creating a temporary variable
would have been a huge mess because this was a class property
initializer.

In hindsight, `(document.querySelector('foo')! || {}).bar` would
probably have worked, but too late now.
2019-10-13 01:28:36 +11:00
Guangcong Luo
9114cb9894 Make minor tweaks to teambuilder
Most of these update the pokemon/item/etc lists to be slightly more
modern, in preparation for their use in the Preact client.

(Also update TypeScript)
2019-06-07 18:36:36 -05:00
Guangcong Luo
25d2422a58 Add support for chat userlists and usercards
This involves a relatively substantial refactor to how panels work, but
it should be somewhat finalized now. Popups are now fully supported.
2019-03-17 19:02:53 +09:00
Guangcong Luo
e93277437d Update dependencies 2019-02-26 07:17:19 -06:00
Guangcong Luo
b0b014fdda Remove types/node dependency
Any Node stuff we use (mostly, NWjs and pseudo-UMD) is an ugly hack
that TypeScript has trouble with, anyway.
2019-02-18 13:45:52 -06:00
Guangcong Luo
432ccd64be Make Travis CI auto-run tslint
I'm reasonably confident that the tslint settings are where I want
them to be, at this point. Going over the line length limit is a
warning, not an error, so I don't have to worry about that being
too harsh.
2018-12-16 11:09:59 -06:00
Guangcong Luo
ad3b39b673 Add build scripts
This mostly makes it easier to build in VS Code just by pressing
Cmd+Shift+B or whatever the equivalent is for your platform.
2018-11-29 18:40:31 -06:00
Guangcong Luo
f62060c8ac Add data/text.js to eslint 2018-11-22 21:51:27 -06:00
Guangcong Luo
8669bae196 Add tslint
Probably the most controversial change here is that I have a max line
length limit, currently set to 140 columns. Lines that set up a
string buffer, lines involving regexes, and the text parser's replace
chains are excluded from the limit.

PS has otherwise been moving towards a line length limit, it just
hasn't been linter-enforced yet. I worry about contributors being
annoyed by it, especially since it's not like it's handled
automatically by Prettier or something.

Oh well, it's set to "warning" so Travis won't yell about it.
2018-11-15 23:01:03 -06:00
Guangcong Luo
76805f9068 Add TypeScript to npm test 2018-10-16 21:45:18 -05:00
Guangcong Luo
26f78dcce6 Add Preact dependency
Preact is currently unused in the client, but will be used in an
upcoming rewrite. This adds the foundation to support `.tsx` files in
`src/`.
2018-10-16 14:53:27 -05:00
Guangcong Luo
6e8e112b24 Update Babel version
I'm not sure why Travis tests are failing, but this is a common
recommendation when googling the error message...
2018-10-16 03:45:08 -05:00
Guangcong Luo
f86245febb Add mocha tests to npm test 2018-10-16 03:31:27 -05:00
Guangcong Luo
fb4f83a580 Remove testcafe dependency
It was unused and vulnerable.
2018-10-16 03:04:52 -05:00
Dan Huang
ee91a72dc6 Support headless client Battle (#1151) 2018-10-16 02:48:59 -05:00
Guangcong Luo
382a5334b3 Add image-size dependency to package.json 2018-05-19 21:59:46 -04:00
Guangcong Luo
6e7b3b6d5c Update Google Auth Library dependency 2018-05-19 19:30:51 -04:00
Guangcong Luo
4e7f998afa TypeScript data/graphics.js 2018-05-18 17:10:58 -05:00
Guangcong Luo
b3c6c2a308 Make eslint ignore compiled files 2018-05-14 12:53:34 -05:00
Guangcong Luo
a15ec64d1d Move battledata.js to TypeScript
This is the first step of moving the entire client over to
TypeScript + Preact!!!!

The main change here is that battledata.js has been split into three
files:
- `src/battle-dex.ts`
- `src/battle-dex-data.ts`
- `src/battle-dex-misc.js`

These are concatenated back into `battledata.js` in the client, so
third parties (and specifically, old replay files) should be
unaffected. Also, this makes sure that we don't have more than two
dependencies right now.

The compilation is done with Babel 7 beta, because no stable version
of Babel supports TypeScript. We're not using `tsc` because it can't
compile to ES3 and it doesn't support preserving line numbers.

`toRoomid` has been moved from client.js to battle-dex.ts.
2018-05-14 12:53:34 -05:00
Guangcong Luo
15c73c922f Refactor build system
We no longer have the relevant Githook for automatic building, so
putting it in `githooks/` no longer makes much sense. It's now manually
called with a build script `./build`, like other PS websites (most
notably PSDex and the damagecalc).
2017-12-04 17:37:01 -05:00
Guangcong Luo
5bed590db0 Update testcafe dependency 2017-11-22 07:16:39 -06:00
Guangcong Luo
2c57bdfb14 Update eslint version 2017-11-22 07:15:29 -06:00
Guangcong Luo
24c090a08d Default to HTTPS
Chrome peer-pressuring us by locking Notification behind HTTPS... they
also lock plenty of other things behind HTTPS and the trade-off seems
worth-it now.
2017-11-21 07:50:32 -05:00
Konrad Borowski
cfd87a91c1 Add level 50 Pokemon test for VGC (#964) 2017-07-06 15:34:20 +09:00
Konrad Borowski
156b5bf3d5 Add testclient unit tests (#957) 2017-06-27 17:43:54 -07:00
Felix Rilling
faaaedadcb Make package name lowercase (#905) 2017-04-23 12:59:14 -05:00
Guangcong Luo
e96b9b9fd1 Improve animated sprite update script
BW animated sprites are now also automatically generated. In addition,
the generation script can now handle female sprites and cosmetic forms.

The storage format has also changed to be more concise.
2016-12-29 15:32:26 -05:00
Guangcong Luo
d593d5355e Version 0.11.0 2016-11-29 18:46:30 -05:00
Guangcong Luo
15fc14856d pokedex-mini.js is now autogenerated 2016-11-29 18:44:52 -05:00
Ivo Julca
40e296a219 Deps: Sync ESLint version and settings with server 2016-08-05 00:50:20 -05:00
Ivo Julca
2211924c49 Sync ESLint version and rules with server repo 2016-06-13 14:05:56 -05:00
Guangcong Luo
7cd3058542 Fix warnings in npm test 2016-03-15 15:44:07 -04:00
Ivo Julca
a62e85b822 Build: remove sugar dependency 2016-03-05 22:30:15 -05:00