about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-13 09:12:14 -0500
committerClaire <claire.github-309c@sitedethib.com>2023-02-18 16:02:12 +0100
commit7e64eef73b62fcb1537181e66bcd3e5e25fcc665 (patch)
tree3cc08273c3f3d3c8519bef1663c0967e05e6ae1f
parent587f6b3b066360da37066063d659194d43fd7a59 (diff)
[Glitch] Enable ESLint no-useless-escape
Port db2c58d47ae0db8490a30cd3846f30e615c382b5 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
-rw-r--r--app/javascript/flavours/glitch/actions/push_notifications/registerer.js2
-rw-r--r--app/javascript/flavours/glitch/features/compose/containers/warning_container.js2
-rw-r--r--app/javascript/flavours/glitch/features/compose/util/counter.js2
-rw-r--r--app/javascript/flavours/glitch/features/emoji/emoji_utils.js2
-rw-r--r--app/javascript/flavours/glitch/features/follow_recommendations/components/account.js2
-rw-r--r--app/javascript/flavours/glitch/utils/hashtag.js2
6 files changed, 6 insertions, 6 deletions
diff --git a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js
index 762fe260c..bc5634233 100644
--- a/app/javascript/flavours/glitch/actions/push_notifications/registerer.js
+++ b/app/javascript/flavours/glitch/actions/push_notifications/registerer.js
@@ -6,7 +6,7 @@ import { setBrowserSupport, setSubscription, clearSubscription } from './setter'
 const urlBase64ToUint8Array = (base64String) => {
   const padding = '='.repeat((4 - base64String.length % 4) % 4);
   const base64 = (base64String + padding)
-    .replace(/\-/g, '+')
+    .replace(/-/g, '+')
     .replace(/_/g, '/');
 
   const rawData = window.atob(base64);
diff --git a/app/javascript/flavours/glitch/features/compose/containers/warning_container.js b/app/javascript/flavours/glitch/features/compose/containers/warning_container.js
index 9402601f8..5b48c45e4 100644
--- a/app/javascript/flavours/glitch/features/compose/containers/warning_container.js
+++ b/app/javascript/flavours/glitch/features/compose/containers/warning_container.js
@@ -25,7 +25,7 @@ const buildHashtagRE = () => {
       '))', 'iu',
     );
   } catch {
-    return /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i;
+    return /(?:^|[^/)\w])#(\w*[a-zA-Z·]\w*)/i;
   }
 };
 
diff --git a/app/javascript/flavours/glitch/features/compose/util/counter.js b/app/javascript/flavours/glitch/features/compose/util/counter.js
index 5a68bad99..ec2431096 100644
--- a/app/javascript/flavours/glitch/features/compose/util/counter.js
+++ b/app/javascript/flavours/glitch/features/compose/util/counter.js
@@ -5,5 +5,5 @@ const urlPlaceholder = '$2xxxxxxxxxxxxxxxxxxxxxxx';
 export function countableText(inputText) {
   return inputText
     .replace(urlRegex, urlPlaceholder)
-    .replace(/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/ig, '$1@$3');
+    .replace(/(^|[^/\w])@(([a-z0-9_]+)@[a-z0-9.-]+[a-z0-9]+)/ig, '$1@$3');
 }
diff --git a/app/javascript/flavours/glitch/features/emoji/emoji_utils.js b/app/javascript/flavours/glitch/features/emoji/emoji_utils.js
index 571907a50..be793526d 100644
--- a/app/javascript/flavours/glitch/features/emoji/emoji_utils.js
+++ b/app/javascript/flavours/glitch/features/emoji/emoji_utils.js
@@ -73,7 +73,7 @@ const stringFromCodePoint = _String.fromCodePoint || function () {
 
 const _JSON = JSON;
 
-const COLONS_REGEX = /^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/;
+const COLONS_REGEX = /^(?::([^:]+):)(?::skin-tone-(\d):)?$/;
 const SKINS = [
   '1F3FA', '1F3FB', '1F3FC',
   '1F3FD', '1F3FE', '1F3FF',
diff --git a/app/javascript/flavours/glitch/features/follow_recommendations/components/account.js b/app/javascript/flavours/glitch/features/follow_recommendations/components/account.js
index 7c8a71879..81d39bd49 100644
--- a/app/javascript/flavours/glitch/features/follow_recommendations/components/account.js
+++ b/app/javascript/flavours/glitch/features/follow_recommendations/components/account.js
@@ -27,7 +27,7 @@ const makeMapStateToProps = () => {
 };
 
 const getFirstSentence = str => {
-  const arr = str.split(/(([\.\?!]+\s)|[.。?!\n•])/);
+  const arr = str.split(/(([.?!]+\s)|[.。?!\n•])/);
 
   return arr[0];
 };
diff --git a/app/javascript/flavours/glitch/utils/hashtag.js b/app/javascript/flavours/glitch/utils/hashtag.js
index 8f5665c46..d91cd5591 100644
--- a/app/javascript/flavours/glitch/utils/hashtag.js
+++ b/app/javascript/flavours/glitch/utils/hashtag.js
@@ -1,6 +1,6 @@
 export function recoverHashtags (recognizedTags, text) {
   return recognizedTags.map(tag => {
-    const re = new RegExp(`(?:^|[^\/)\w])#(${tag.name})`, 'i');
+    const re = new RegExp(`(?:^|[^/)\w])#(${tag.name})`, 'i');
     const matched_hashtag = text.match(re);
     return matched_hashtag ? matched_hashtag[1] : null;
   },