From 7dd9941b73dbbd82601740e021cc87d765af60ca Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Sat, 16 Mar 2024 10:14:50 -0500 Subject: [PATCH] Remove unecessary escapes (#2328) --- .changeset/happy-pants-pump.md | 5 +++++ packages/api/src/moderation/mutewords.ts | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changeset/happy-pants-pump.md diff --git a/.changeset/happy-pants-pump.md b/.changeset/happy-pants-pump.md new file mode 100644 index 00000000000..c72ee94f6d0 --- /dev/null +++ b/.changeset/happy-pants-pump.md @@ -0,0 +1,5 @@ +--- +'@atproto/api': patch +--- + +Remove unecessary escapes from regex, which was causing a minification error when bundled in React Native. diff --git a/packages/api/src/moderation/mutewords.ts b/packages/api/src/moderation/mutewords.ts index a4df492382c..ef776b09460 100644 --- a/packages/api/src/moderation/mutewords.ts +++ b/packages/api/src/moderation/mutewords.ts @@ -3,9 +3,7 @@ import { AppBskyActorDefs, AppBskyRichtextFacet } from '../client' const REGEX = { LEADING_TRAILING_PUNCTUATION: /(?:^\p{P}+|\p{P}+$)/gu, ESCAPE: /[[\]{}()*+?.\\^$|\s]/g, - // @TODO tidy this - // eslint-disable-next-line no-useless-escape - SEPARATORS: /[\/\-\–\—\(\)\[\]\_]+/g, + SEPARATORS: /[/\-–—()[\]_]+/g, WORD_BOUNDARY: /[\s\n\t\r\f\v]+?/g, }