aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.json1
-rw-r--r--ext/bg/js/backend.js32
-rw-r--r--ext/bg/js/database.js4
-rw-r--r--ext/bg/js/japanese.js12
-rw-r--r--ext/bg/js/json-schema.js2
-rw-r--r--ext/bg/js/search.js4
-rw-r--r--ext/bg/js/settings/dictionaries.js2
-rw-r--r--ext/mixed/js/core.js6
8 files changed, 32 insertions, 31 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index b21c00f4..cfee7be8 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -26,6 +26,7 @@
"no-const-assign": "error",
"no-constant-condition": "off",
"no-global-assign": "error",
+ "no-shadow": ["error", {"builtinGlobals": false}],
"no-undef": "error",
"no-unneeded-ternary": "error",
"no-unused-vars": ["error", {"vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "caughtErrors": "none"}],
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 7c71f82c..2691b7d9 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -274,18 +274,18 @@ class Backend {
const node = nodes.pop();
for (const key of Object.keys(node.obj)) {
const path = node.path.concat(key);
- const obj = node.obj[key];
- if (obj !== null && typeof obj === 'object') {
- nodes.unshift({obj, path});
+ const obj2 = node.obj[key];
+ if (obj2 !== null && typeof obj2 === 'object') {
+ nodes.unshift({obj: obj2, path});
} else {
- valuePaths.push([obj, path]);
+ valuePaths.push([obj2, path]);
}
}
}
return valuePaths;
}
- function modifyOption(path, value, options) {
+ function modifyOption(path, value) {
let pivot = options;
for (const key of path.slice(0, -1)) {
if (!hasOwn(pivot, key)) {
@@ -298,7 +298,7 @@ class Backend {
}
for (const [value, path] of getValuePaths(changedOptions)) {
- modifyOption(path, value, options);
+ modifyOption(path, value);
}
await this._onApiOptionsSave({source});
@@ -340,9 +340,9 @@ class Backend {
dictTermsSort(definitions);
const {expression, reading} = definitions[0];
const source = text.substring(0, sourceLength);
- for (const {text, furigana} of jpDistributeFuriganaInflected(expression, reading, source)) {
- const reading = jpConvertReading(text, furigana, options.parsing.readingMode);
- term.push({text, reading});
+ for (const {text: text2, furigana} of jpDistributeFuriganaInflected(expression, reading, source)) {
+ const reading2 = jpConvertReading(text2, furigana, options.parsing.readingMode);
+ term.push({text: text2, reading: reading2});
}
text = text.substring(source.length);
} else {
@@ -365,17 +365,17 @@ class Backend {
for (const {expression, reading, source} of parsedLine) {
const term = [];
if (expression !== null && reading !== null) {
- for (const {text, furigana} of jpDistributeFuriganaInflected(
+ for (const {text: text2, furigana} of jpDistributeFuriganaInflected(
expression,
jpKatakanaToHiragana(reading),
source
)) {
- const reading = jpConvertReading(text, furigana, options.parsing.readingMode);
- term.push({text, reading});
+ const reading2 = jpConvertReading(text2, furigana, options.parsing.readingMode);
+ term.push({text: text2, reading: reading2});
}
} else {
- const reading = jpConvertReading(source, null, options.parsing.readingMode);
- term.push({text: source, reading});
+ const reading2 = jpConvertReading(source, null, options.parsing.readingMode);
+ term.push({text: source, reading: reading2});
}
result.push(term);
}
@@ -816,12 +816,12 @@ class Backend {
try {
const tabWindow = await new Promise((resolve, reject) => {
- chrome.windows.get(tab.windowId, {}, (tabWindow) => {
+ chrome.windows.get(tab.windowId, {}, (value) => {
const e = chrome.runtime.lastError;
if (e) {
reject(e);
} else {
- resolve(tabWindow);
+ resolve(value);
}
});
});
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 1f6810cf..558f3ceb 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -809,9 +809,9 @@ class Database {
for (const objectStoreName of objectStoreNames) {
const {primaryKey, indices} = stores[objectStoreName];
- const objectStoreNames = transaction.objectStoreNames || db.objectStoreNames;
+ const objectStoreNames2 = transaction.objectStoreNames || db.objectStoreNames;
const objectStore = (
- Database._listContains(objectStoreNames, objectStoreName) ?
+ Database._listContains(objectStoreNames2, objectStoreName) ?
transaction.objectStore(objectStoreName) :
db.createObjectStore(objectStoreName, primaryKey)
);
diff --git a/ext/bg/js/japanese.js b/ext/bg/js/japanese.js
index e8a6fa08..abb32da4 100644
--- a/ext/bg/js/japanese.js
+++ b/ext/bg/js/japanese.js
@@ -224,15 +224,15 @@ function jpDistributeFurigana(expression, reading) {
}
let isAmbiguous = false;
- const segmentize = (reading, groups) => {
+ const segmentize = (reading2, groups) => {
if (groups.length === 0 || isAmbiguous) {
return [];
}
const group = groups[0];
if (group.mode === 'kana') {
- if (jpKatakanaToHiragana(reading).startsWith(jpKatakanaToHiragana(group.text))) {
- const readingLeft = reading.substring(group.text.length);
+ if (jpKatakanaToHiragana(reading2).startsWith(jpKatakanaToHiragana(group.text))) {
+ const readingLeft = reading2.substring(group.text.length);
const segs = segmentize(readingLeft, groups.splice(1));
if (segs) {
return [{text: group.text}].concat(segs);
@@ -240,9 +240,9 @@ function jpDistributeFurigana(expression, reading) {
}
} else {
let foundSegments = null;
- for (let i = reading.length; i >= group.text.length; --i) {
- const readingUsed = reading.substring(0, i);
- const readingLeft = reading.substring(i);
+ for (let i = reading2.length; i >= group.text.length; --i) {
+ const readingUsed = reading2.substring(0, i);
+ const readingLeft = reading2.substring(i);
const segs = segmentize(readingLeft, groups.slice(1));
if (segs) {
if (foundSegments !== null) {
diff --git a/ext/bg/js/json-schema.js b/ext/bg/js/json-schema.js
index 3cf24c35..58f804fd 100644
--- a/ext/bg/js/json-schema.js
+++ b/ext/bg/js/json-schema.js
@@ -401,7 +401,7 @@ class JsonSchemaProxyHandler {
info.valuePush(i, propertyValue);
JsonSchemaProxyHandler.validate(propertyValue, propertySchema, info);
info.valuePop();
- for (let i = 0; i < schemaPath.length; ++i) { info.schemaPop(); }
+ for (let j = 0, jj = schemaPath.length; j < jj; ++j) { info.schemaPop(); }
}
}
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index 76a62b97..98e167ad 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -70,7 +70,7 @@ class DisplaySearch extends Display {
this.wanakanaEnable.checked = false;
}
this.wanakanaEnable.addEventListener('change', (e) => {
- const {queryParams: {query=''}} = parseUrl(window.location.href);
+ const {queryParams: {query: query2=''}} = parseUrl(window.location.href);
if (e.target.checked) {
window.wanakana.bind(this.query);
apiOptionsSet({general: {enableWanakana: true}}, this.getOptionsContext());
@@ -78,7 +78,7 @@ class DisplaySearch extends Display {
window.wanakana.unbind(this.query);
apiOptionsSet({general: {enableWanakana: false}}, this.getOptionsContext());
}
- this.setQuery(query);
+ this.setQuery(query2);
this.onSearchQueryUpdated(this.query.value, false);
});
}
diff --git a/ext/bg/js/settings/dictionaries.js b/ext/bg/js/settings/dictionaries.js
index 427f47f0..70a22a16 100644
--- a/ext/bg/js/settings/dictionaries.js
+++ b/ext/bg/js/settings/dictionaries.js
@@ -166,7 +166,7 @@ class SettingsDictionaryListUI {
delete n.dataset.dict;
$(n).modal('hide');
- const index = this.dictionaryEntries.findIndex((e) => e.dictionaryInfo.title === title);
+ const index = this.dictionaryEntries.findIndex((entry) => entry.dictionaryInfo.title === title);
if (index >= 0) {
this.dictionaryEntries[index].deleteDictionary();
}
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js
index 330a30fb..83813796 100644
--- a/ext/mixed/js/core.js
+++ b/ext/mixed/js/core.js
@@ -160,9 +160,9 @@ function promiseTimeout(delay, resolveValue) {
const resolve = (value) => complete(promiseResolve, value);
const reject = (value) => complete(promiseReject, value);
- const promise = new Promise((resolve, reject) => {
- promiseResolve = resolve;
- promiseReject = reject;
+ const promise = new Promise((resolve2, reject2) => {
+ promiseResolve = resolve2;
+ promiseReject = reject2;
});
timer = window.setTimeout(() => {
timer = null;