summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev/lint/global-declarations.js11
-rw-r--r--ext/bg/js/settings/anki-templates-controller.js1
-rw-r--r--ext/bg/js/settings/backup-controller.js1
-rw-r--r--ext/bg/js/settings/dictionary-controller.js1
-rw-r--r--ext/bg/js/settings/dictionary-import-controller.js1
-rw-r--r--ext/bg/js/settings/popup-preview-frame.js1
-rw-r--r--ext/bg/js/settings/profile-controller.js1
7 files changed, 7 insertions, 10 deletions
diff --git a/dev/lint/global-declarations.js b/dev/lint/global-declarations.js
index 5448df85..57097c03 100644
--- a/dev/lint/global-declarations.js
+++ b/dev/lint/global-declarations.js
@@ -22,6 +22,10 @@ const assert = require('assert');
const {getAllFiles} = require('../util');
+function escapeRegExp(string) {
+ return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&');
+}
+
function countOccurences(string, pattern) {
return (string.match(pattern) || []).length;
}
@@ -38,13 +42,12 @@ function getNewline(string) {
}
function getSubstringCount(string, substring) {
- let start = 0;
let count = 0;
+ const pattern = new RegExp(`\\b${escapeRegExp(substring)}\\b`, 'g');
while (true) {
- const pos = string.indexOf(substring, start);
- if (pos < 0) { break; }
+ const match = pattern.exec(string);
+ if (match === null) { break; }
++count;
- start = pos + substring.length;
}
return count;
}
diff --git a/ext/bg/js/settings/anki-templates-controller.js b/ext/bg/js/settings/anki-templates-controller.js
index 3ac4fa9e..edf6f2c8 100644
--- a/ext/bg/js/settings/anki-templates-controller.js
+++ b/ext/bg/js/settings/anki-templates-controller.js
@@ -17,7 +17,6 @@
/* global
* AnkiNoteBuilder
- * Modal
* TemplateRendererProxy
* api
*/
diff --git a/ext/bg/js/settings/backup-controller.js b/ext/bg/js/settings/backup-controller.js
index 8f24bdb4..b37dd91d 100644
--- a/ext/bg/js/settings/backup-controller.js
+++ b/ext/bg/js/settings/backup-controller.js
@@ -17,7 +17,6 @@
/* global
* DictionaryController
- * Modal
* OptionsUtil
* api
*/
diff --git a/ext/bg/js/settings/dictionary-controller.js b/ext/bg/js/settings/dictionary-controller.js
index db3ebb22..d2ff831f 100644
--- a/ext/bg/js/settings/dictionary-controller.js
+++ b/ext/bg/js/settings/dictionary-controller.js
@@ -17,7 +17,6 @@
/* global
* DictionaryDatabase
- * Modal
* ObjectPropertyAccessor
* api
*/
diff --git a/ext/bg/js/settings/dictionary-import-controller.js b/ext/bg/js/settings/dictionary-import-controller.js
index 22146ec1..1c306c78 100644
--- a/ext/bg/js/settings/dictionary-import-controller.js
+++ b/ext/bg/js/settings/dictionary-import-controller.js
@@ -18,7 +18,6 @@
/* global
* DictionaryDatabase
* DictionaryImporter
- * Modal
* ObjectPropertyAccessor
* api
*/
diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js
index 8225ecb8..e3d598d9 100644
--- a/ext/bg/js/settings/popup-preview-frame.js
+++ b/ext/bg/js/settings/popup-preview-frame.js
@@ -17,7 +17,6 @@
/* global
* Frontend
- * Popup
* TextSourceRange
* api
* wanakana
diff --git a/ext/bg/js/settings/profile-controller.js b/ext/bg/js/settings/profile-controller.js
index aa74b419..4e0782d6 100644
--- a/ext/bg/js/settings/profile-controller.js
+++ b/ext/bg/js/settings/profile-controller.js
@@ -16,7 +16,6 @@
*/
/* global
- * Modal
* ProfileConditionsUI
* api
*/