aboutsummaryrefslogtreecommitdiff
path: root/ext/js/language
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-12-16 20:04:56 -0500
committerGitHub <noreply@github.com>2023-12-17 01:04:56 +0000
commitb249627434d3a94420ac4d98c3ce720767e57b43 (patch)
treeec46e2c020c5a63a5c2babf56376f53e288ed7f2 /ext/js/language
parentdecbc60f7734e739c0e5c41da294f65f9eec92fe (diff)
Update eslint spacing rules (#366)
* Add space-infix-ops rule * Add no-multi-spaces --------- Co-authored-by: Darius Jahandarie <djahandarie@gmail.com>
Diffstat (limited to 'ext/js/language')
-rw-r--r--ext/js/language/deinflector.js3
-rw-r--r--ext/js/language/dictionary-importer.js10
-rw-r--r--ext/js/language/sandbox/japanese-util.js12
-rw-r--r--ext/js/language/text-scanner.js12
4 files changed, 20 insertions, 17 deletions
diff --git a/ext/js/language/deinflector.js b/ext/js/language/deinflector.js
index b7a235d0..537a4556 100644
--- a/ext/js/language/deinflector.js
+++ b/ext/js/language/deinflector.js
@@ -103,6 +103,8 @@ export class Deinflector {
}
}
+
+/* eslint-disable no-multi-spaces */
/** @type {Map<string, import('translation-internal').DeinflectionRuleFlags>} */
// eslint-disable-next-line no-underscore-dangle
Deinflector._ruleTypes = new Map([
@@ -114,3 +116,4 @@ Deinflector._ruleTypes = new Map([
['adj-i', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b00100000)], // Adjective i
['iru', /** @type {import('translation-internal').DeinflectionRuleFlags} */ (0b01000000)] // Intermediate -iru endings for progressive or perfect tense
]);
+/* eslint-enable no-multi-spaces */
diff --git a/ext/js/language/dictionary-importer.js b/ext/js/language/dictionary-importer.js
index 08fcf86b..dfbd9590 100644
--- a/ext/js/language/dictionary-importer.js
+++ b/ext/js/language/dictionary-importer.js
@@ -112,11 +112,11 @@ export class DictionaryImporter {
const dataBankSchemas = this._getDataBankSchemas(version);
// Files
- const termFiles = this._getArchiveFiles(fileMap, 'term_bank_?.json');
- const termMetaFiles = this._getArchiveFiles(fileMap, 'term_meta_bank_?.json');
- const kanjiFiles = this._getArchiveFiles(fileMap, 'kanji_bank_?.json');
+ const termFiles = this._getArchiveFiles(fileMap, 'term_bank_?.json');
+ const termMetaFiles = this._getArchiveFiles(fileMap, 'term_meta_bank_?.json');
+ const kanjiFiles = this._getArchiveFiles(fileMap, 'kanji_bank_?.json');
const kanjiMetaFiles = this._getArchiveFiles(fileMap, 'kanji_meta_bank_?.json');
- const tagFiles = this._getArchiveFiles(fileMap, 'tag_bank_?.json');
+ const tagFiles = this._getArchiveFiles(fileMap, 'tag_bank_?.json');
// Load data
this._progressNextStep(termFiles.length + termMetaFiles.length + kanjiFiles.length + kanjiMetaFiles.length + tagFiles.length);
@@ -538,7 +538,7 @@ export class DictionaryImporter {
*/
const createError = (message) => {
const {expression, reading} = entry;
- const readingSource = reading.length > 0 ? ` (${reading})`: '';
+ const readingSource = reading.length > 0 ? ` (${reading})` : '';
return new Error(`${message} at path ${JSON.stringify(path)} for ${expression}${readingSource} in ${dictionary}`);
};
diff --git a/ext/js/language/sandbox/japanese-util.js b/ext/js/language/sandbox/japanese-util.js
index 6f4fc8e0..9d36497a 100644
--- a/ext/js/language/sandbox/japanese-util.js
+++ b/ext/js/language/sandbox/japanese-util.js
@@ -88,7 +88,7 @@ const JAPANESE_RANGES = [
[0xff1a, 0xff1f], // Fullwidth punctuation 2
[0xff3b, 0xff3f], // Fullwidth punctuation 3
[0xff5b, 0xff60], // Fullwidth punctuation 4
- [0xffe0, 0xffee] // Currency markers
+ [0xffe0, 0xffee] // Currency markers
];
const SMALL_KANA_SET = new Set(Array.from('ぁぃぅぇぉゃゅょゎァィゥェォャュョヮ'));
@@ -235,7 +235,7 @@ export class JapaneseUtil {
/**
* @param {?import('wanakana')|import('../../../lib/wanakana.js')} wanakana
*/
- constructor(wanakana=null) {
+ constructor(wanakana = null) {
/** @type {?import('wanakana')} */
this._wanakana = /** @type {import('wanakana')} */ (wanakana);
}
@@ -386,7 +386,7 @@ export class JapaneseUtil {
* @param {boolean} [keepProlongedSoundMarks]
* @returns {string}
*/
- convertKatakanaToHiragana(text, keepProlongedSoundMarks=false) {
+ convertKatakanaToHiragana(text, keepProlongedSoundMarks = false) {
let result = '';
const offset = (HIRAGANA_CONVERSION_RANGE[0] - KATAKANA_CONVERSION_RANGE[0]);
for (let char of text) {
@@ -469,7 +469,7 @@ export class JapaneseUtil {
* @param {?import('../../general/text-source-map.js').TextSourceMap} [sourceMap]
* @returns {string}
*/
- convertHalfWidthKanaToFullWidth(text, sourceMap=null) {
+ convertHalfWidthKanaToFullWidth(text, sourceMap = null) {
let result = '';
// This function is safe to use charCodeAt instead of codePointAt, since all
@@ -516,7 +516,7 @@ export class JapaneseUtil {
* @param {?import('../../general/text-source-map.js').TextSourceMap} sourceMap
* @returns {string}
*/
- convertAlphabeticToKana(text, sourceMap=null) {
+ convertAlphabeticToKana(text, sourceMap = null) {
let part = '';
let result = '';
@@ -679,7 +679,7 @@ export class JapaneseUtil {
* @param {?import('../../general/text-source-map.js').TextSourceMap} [sourceMap]
* @returns {string}
*/
- collapseEmphaticSequences(text, fullCollapse, sourceMap=null) {
+ collapseEmphaticSequences(text, fullCollapse, sourceMap = null) {
let result = '';
let collapseCodePoint = -1;
const hasSourceMap = (sourceMap !== null);
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js
index 3de16f54..800e3697 100644
--- a/ext/js/language/text-scanner.js
+++ b/ext/js/language/text-scanner.js
@@ -31,12 +31,12 @@ export class TextScanner extends EventDispatcher {
constructor({
node,
getSearchContext,
- ignoreElements=null,
- ignorePoint=null,
- searchTerms=false,
- searchKanji=false,
- searchOnClick=false,
- searchOnClickOnly=false
+ ignoreElements = null,
+ ignorePoint = null,
+ searchTerms = false,
+ searchKanji = false,
+ searchOnClick = false,
+ searchOnClickOnly = false
}) {
super();
/** @type {HTMLElement|Window} */