From f041f808891d6fc16e02a05b96a398ab432c756a Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 21 Dec 2023 09:31:21 -0500 Subject: Enable no-new eslint rule (#411) --- .eslintrc.json | 1 + ext/js/pages/settings/profile-conditions-ui.js | 1 + ext/js/pages/settings/translation-text-replacements-controller.js | 1 + 3 files changed, 3 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 1a427686..eb0eecdb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -62,6 +62,7 @@ "no-const-assign": "error", "no-constant-condition": "off", "no-global-assign": "error", + "no-new": "error", "no-param-reassign": "off", "no-prototype-builtins": "error", "no-shadow": [ diff --git a/ext/js/pages/settings/profile-conditions-ui.js b/ext/js/pages/settings/profile-conditions-ui.js index 715aeb69..8e5da3d8 100644 --- a/ext/js/pages/settings/profile-conditions-ui.js +++ b/ext/js/pages/settings/profile-conditions-ui.js @@ -389,6 +389,7 @@ export class ProfileConditionsUI extends EventDispatcher { */ _validateRegExp(value) { try { + // eslint-disable-next-line no-new new RegExp(value, 'i'); return true; } catch (e) { diff --git a/ext/js/pages/settings/translation-text-replacements-controller.js b/ext/js/pages/settings/translation-text-replacements-controller.js index a54c3dd9..ebd1b58d 100644 --- a/ext/js/pages/settings/translation-text-replacements-controller.js +++ b/ext/js/pages/settings/translation-text-replacements-controller.js @@ -268,6 +268,7 @@ class TranslationTextReplacementsEntry { let okay = false; try { if (typeof value === 'string') { + // eslint-disable-next-line no-new new RegExp(value, 'g'); okay = true; } -- cgit v1.2.3