[polari] utils: Stop disabling eslint rule
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] utils: Stop disabling eslint rule
- Date: Mon, 15 Jul 2019 19:42:22 +0000 (UTC)
commit 438ad0996e5823421c477a2c26f6d8900bcf3079
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jul 2 06:05:11 2019 +0200
utils: Stop disabling eslint rule
It turns out eslint's prefer-template rule accepts some
string concatenation, as long it's the right one.
https://gitlab.gnome.org/GNOME/polari/merge_requests/125
src/utils.js | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/utils.js b/src/utils.js
index b880a1e..e5f71f3 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -55,15 +55,14 @@ const _notTrailingJunk = '[^\\s`!()\\[\\]{};:\'\\".,<>?\u00AB\u00BB\u201C\u201D\
// a lot of false positives, so whitelist some useful ones and hope nobody complains :-)
const _schemeWhitelist = ['geo', 'mailto', 'man', 'info', 'ghelp', 'help'];
-/* eslint-disable prefer-template */
const _urlRegexp = new RegExp(
- '(^|' + _leadingJunk + ')' +
+ `(^|${_leadingJunk})` +
'(' +
'(?:' +
'(?:[a-z]+)://' + // scheme://
'|' +
'(?:' +
- _schemeWhitelist.join('|') + // scheme:
+ `${_schemeWhitelist.join('|')}` + // scheme:
'):' +
'|' +
'www\\d{0,3}[.]' + // www.
@@ -73,15 +72,14 @@ const _urlRegexp = new RegExp(
'(?:' + // one or more:
'[^\\s()<>]+' + // run of non-space non-()
'|' + // or
- _balancedParens + // balanced parens
+ `${_balancedParens}` + // balanced parens
')+' +
'(?:' + // end with:
- _balancedParens + // balanced parens
+ `${_balancedParens}` + // balanced parens
'|' + // or
- _notTrailingJunk + // last non-junk char
+ `${_notTrailingJunk}` + // last non-junk char
')' +
')', 'gi');
-/* eslint-enable prefer-template */
const _channelRegexp = new RegExp('(^| )#([\\w\\+\\.-]+)', 'g');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]