Commit Graph

24 Commits

Author SHA1 Message Date
Guangcong Luo
9fd696977c Fix crash in formatText 2026-01-10 14:36:51 -08:00
Guangcong Luo
f2883557ca Protect against infinite loop 2026-01-10 21:31:12 +00:00
Sergio Garcia
13aa6355af
Fix various typos (#11607) 2025-12-08 18:38:02 -06: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
Alex "Mathy
067d99d4dd
Chat: Actually prevent unmatched square brackets (#10691)
Some checks failed
Node.js CI / build (16.x) (push) Has been cancelled
2024-11-23 13:10:33 -07:00
Alex "Mathy
7a8ebe8155
Chat: Don't allow unmatched square brackets in hyperlinks (#10681) 2024-11-18 15:17:58 -07:00
Guangcong Luo
262160e8e3 Add syntax mode for chat-formatter
This adds support for a chat-formatter mode that retains the syntax,
for use in Discord-style syntax highlighting WYSIWYM editors.
2024-06-22 16:13:09 -07:00
Guangcong Luo
f0cfceb09d Comment chat-formatter better 2024-06-22 16:13:09 -07:00
Alexander B
17c084d7bc
Chat: Don't hyperlink parts of words with common TLDs (#8891)
* Don't hyperlink words ending in ".jpg"

* Check for any word boundary after the TLD
2022-09-14 08:58:34 -07:00
Guangcong Luo
d555f6fe0d Fix max-len for long regexes
We use eslint-disable for max-len in a lot of places where we don't
actually need it. This fixes that.
2021-05-23 20:48:31 -07:00
Christopher Monsanto
99fd7b8706
Chat: Implement Discord spoilers (#7948) 2021-04-09 01:39:47 -07:00
Konrad Borowski
1a9bfa044a
Require a digit to follow port number in links (#7644) 2020-11-05 04:44:28 -08:00
Guangcong Luo
9d87616176
Add more style linting rules (#7537)
* Lint arrow-body-style

* Lint prefer-object-spread

Object spread is faster _and_ more readable.

This also fixes a few unnecessary object clones.

* Enable no-parameter-properties

This isn't currently used, but this makes clear that it shouldn't be.

* Refactor more Promises to async/await

* Remove unnecessary code from getDataMoveHTML etc

* Lint prefer-string-starts-ends-with

* Stop using no-undef

According to the typescript-eslint FAQ, this is redundant with
TypeScript, and they're not wrong. This will save us from needing to
specify globals in two different places which will be nice.
2020-10-19 02:42:28 -07:00
Kris Johnson
d9b3a510ad
TextFormatter: Support replacing \n without trusted (#7507) 2020-10-11 13:38:34 -07:00
Annika
05a9f9a1e5
Minor code quality improvements based on LGTM (#7092) 2020-07-30 14:24:37 -07:00
Kris Johnson
77e4a8ad6f
Add type and category support for <psicon> (#6983) 2020-07-18 18:05:19 -07:00
Guangcong Luo
efa98a08b9 Improve linkRegex
We're now using regexfree for linkRegex as well as the indentation
rule.

https://zarel.github.io/regexfree/
2020-03-08 20:16:53 -07:00
Guangcong Luo
b21c9047e2
Migrate to typescript-eslint (#6342) 2020-03-05 08:33:06 -08:00
Waleed Hassan
28e870c4fb Server: Use readonly where appropriate (#5902) 2019-10-21 16:12:32 +10:30
Guangcong Luo
e0a2cf07e1 Correctly define global types for .ts files
Global types are defined differently for `.ts` files than for `.js`
files, leading to some confusion for past refactors.

This commit defines them correctly.

I'm also considering making certain global types only available under
namespaces, but I don't want to do that to `User` or `Room`, so for
now, there are no changes there, besides putting streams in the
`Streams` namespace (so `WriteStream` is now `Streams.WriteStream`).
2019-08-23 09:33:49 -07:00
TheJetOU
3c3d897b92 Move JSDoc comments from assignment to declaration (#5701)
This makes IntelliSense show the JSDoc comment.
2019-08-13 17:25:29 +02:00
HoeenHero
e5b575f950 Implement Chat.stripFormatting (#5658)
Strips chat formatting from a string.
This is used for properly validating the length of room faqs
and daily spotlights.
2019-08-01 00:08:11 -05:00
Kirk Scheibelhut
3d24166cdf toId -> toID
Closes #5479
2019-05-12 17:53:01 -07:00
jetou
9a7ce703f2 TypeScript server/chat formatter.js (#5495) 2019-05-10 09:23:46 -07:00