[Glitch] Enable ESLint no-useless-escape

Port db2c58d47a to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
pull/2112/head
Nick Schonning 2023-02-13 09:12:14 -05:00 committed by Claire
parent 587f6b3b06
commit 7e64eef73b
6 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ import { setBrowserSupport, setSubscription, clearSubscription } from './setter'
const urlBase64ToUint8Array = (base64String) => { const urlBase64ToUint8Array = (base64String) => {
const padding = '='.repeat((4 - base64String.length % 4) % 4); const padding = '='.repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding) const base64 = (base64String + padding)
.replace(/\-/g, '+') .replace(/-/g, '+')
.replace(/_/g, '/'); .replace(/_/g, '/');
const rawData = window.atob(base64); const rawData = window.atob(base64);

View File

@ -25,7 +25,7 @@ const buildHashtagRE = () => {
'))', 'iu', '))', 'iu',
); );
} catch { } catch {
return /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i; return /(?:^|[^/)\w])#(\w*[a-zA-Z·]\w*)/i;
} }
}; };

View File

@ -5,5 +5,5 @@ const urlPlaceholder = '$2xxxxxxxxxxxxxxxxxxxxxxx';
export function countableText(inputText) { export function countableText(inputText) {
return inputText return inputText
.replace(urlRegex, urlPlaceholder) .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');
} }

View File

@ -73,7 +73,7 @@ const stringFromCodePoint = _String.fromCodePoint || function () {
const _JSON = JSON; const _JSON = JSON;
const COLONS_REGEX = /^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/; const COLONS_REGEX = /^(?::([^:]+):)(?::skin-tone-(\d):)?$/;
const SKINS = [ const SKINS = [
'1F3FA', '1F3FB', '1F3FC', '1F3FA', '1F3FB', '1F3FC',
'1F3FD', '1F3FE', '1F3FF', '1F3FD', '1F3FE', '1F3FF',

View File

@ -27,7 +27,7 @@ const makeMapStateToProps = () => {
}; };
const getFirstSentence = str => { const getFirstSentence = str => {
const arr = str.split(/(([\.\?!]+\s)|[.。?!\n•])/); const arr = str.split(/(([.?!]+\s)|[.。?!\n•])/);
return arr[0]; return arr[0];
}; };

View File

@ -1,6 +1,6 @@
export function recoverHashtags (recognizedTags, text) { export function recoverHashtags (recognizedTags, text) {
return recognizedTags.map(tag => { 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); const matched_hashtag = text.match(re);
return matched_hashtag ? matched_hashtag[1] : null; return matched_hashtag ? matched_hashtag[1] : null;
}, },