diff options
author | James Maa <jmaa@berkeley.edu> | 2024-05-31 08:06:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 15:06:52 +0000 |
commit | 76ca08bd59f0e8bfa1bb20ac813f48e7ab241265 (patch) | |
tree | bdba43d9ba704885383c7f308c6fe3f574c647c5 /ext/js/data | |
parent | b3f54747eb2694bdc90bce72e5532e99d374ef08 (diff) |
Allow trailing commas in ESLint (#1013)
* Update comma-dangle rule
* Fix dangling commas
Diffstat (limited to 'ext/js/data')
-rw-r--r-- | ext/js/data/anki-note-builder.js | 18 | ||||
-rw-r--r-- | ext/js/data/anki-note-data-creator.js | 64 | ||||
-rw-r--r-- | ext/js/data/anki-template-util.js | 4 | ||||
-rw-r--r-- | ext/js/data/json-schema.js | 16 | ||||
-rw-r--r-- | ext/js/data/options-util.js | 62 | ||||
-rw-r--r-- | ext/js/data/permissions-util.js | 2 |
6 files changed, 83 insertions, 83 deletions
diff --git a/ext/js/data/anki-note-builder.js b/ext/js/data/anki-note-builder.js index aec8cdd9..f7d4a12a 100644 --- a/ext/js/data/anki-note-builder.js +++ b/ext/js/data/anki-note-builder.js @@ -59,7 +59,7 @@ export class AnkiNoteBuilder { resultOutputMode = 'split', glossaryLayoutMode = 'default', compactTags = false, - mediaOptions = null + mediaOptions = null, }) { let duplicateScopeDeckName = null; let duplicateScopeCheckChildren = false; @@ -116,9 +116,9 @@ export class AnkiNoteBuilder { duplicateScopeOptions: { deckName: duplicateScopeDeckName, checkChildren: duplicateScopeCheckChildren, - checkAllModels: duplicateScopeCheckAllModels - } - } + checkAllModels: duplicateScopeCheckAllModels, + }, + }, }; return {note, errors: allErrors, requirements: [...uniqueRequirements.values()]}; } @@ -134,7 +134,7 @@ export class AnkiNoteBuilder { resultOutputMode = 'split', glossaryLayoutMode = 'default', compactTags = false, - marker + marker, }) { const commonData = this._createData(dictionaryEntry, mode, context, resultOutputMode, glossaryLayoutMode, compactTags, void 0); return await this._templateRenderer.getModifiedData({marker, commonData}, 'ankiNote'); @@ -191,7 +191,7 @@ export class AnkiNoteBuilder { resultOutputMode, glossaryLayoutMode, compactTags, - media + media, }; } @@ -314,7 +314,7 @@ export class AnkiNoteBuilder { templateItems.push({ type: /** @type {import('anki-templates').RenderMode} */ ('ankiNote'), commonData, - datas + datas, }); } items.push({template, templateItems}); @@ -439,7 +439,7 @@ export class AnkiNoteBuilder { audioDetails, screenshotDetails, clipboardDetails, - dictionaryMediaDetails + dictionaryMediaDetails, ); const {audioFileName, screenshotFileName, clipboardImageFileName, clipboardText, dictionaryMedia: dictionaryMediaArray, errors} = injectedMedia; const textFurigana = textFuriganaPromise !== null ? await textFuriganaPromise : []; @@ -463,7 +463,7 @@ export class AnkiNoteBuilder { clipboardText: (typeof clipboardText === 'string' ? {value: clipboardText} : void 0), selectionText: (typeof selectionText === 'string' ? {value: selectionText} : void 0), textFurigana, - dictionaryMedia + dictionaryMedia, }; return {media, errors}; } diff --git a/ext/js/data/anki-note-data-creator.js b/ext/js/data/anki-note-data-creator.js index fbeb8cee..11618524 100644 --- a/ext/js/data/anki-note-data-creator.js +++ b/ext/js/data/anki-note-data-creator.js @@ -32,7 +32,7 @@ export function createAnkiNoteData(marker, { glossaryLayoutMode, compactTags, context, - media + media, }) { const definition = createCachedValue(getDefinition.bind(null, dictionaryEntry, context, resultOutputMode)); const uniqueExpressions = createCachedValue(getUniqueExpressions.bind(null, dictionaryEntry)); @@ -50,7 +50,7 @@ export function createAnkiNoteData(marker, { clipboardText: void 0, selectionText: void 0, textFurigana: [], - dictionaryMedia: {} + dictionaryMedia: {}, }; } /** @type {import('anki-templates').NoteData} */ @@ -72,13 +72,13 @@ export function createAnkiNoteData(marker, { get phoneticTranscriptions() { return getCachedValue(phoneticTranscriptions); }, get context() { return getCachedValue(context2); }, media, - dictionaryEntry + dictionaryEntry, }; Object.defineProperty(result, 'dictionaryEntry', { configurable: false, enumerable: false, writable: false, - value: dictionaryEntry + value: dictionaryEntry, }); return result; } @@ -165,8 +165,8 @@ function getPublicContext(context) { query, fullQuery, document: { - title: documentTitle - } + title: documentTitle, + }, }; } @@ -255,7 +255,7 @@ function getPitches(dictionaryEntry) { devoicePositions, tags: convertPitchTags(tags), exclusiveExpressions: exclusiveTerms, - exclusiveReadings + exclusiveReadings, }); } results.push({dictionary, pitches}); @@ -284,7 +284,7 @@ function getPhoneticTranscriptions(dictionaryEntry) { ipa, tags, exclusiveExpressions: exclusiveTerms, - exclusiveReadings + exclusiveReadings, }); } results.push({dictionary, phoneticTranscriptions}); @@ -350,7 +350,7 @@ function getKanjiDefinition(dictionaryEntry, context) { get frequencyHarmonic() { return getCachedValue(frequencyHarmonic); }, get frequencyAverage() { return getCachedValue(frequencyAverage); }, url, - get cloze() { return getCachedValue(cloze); } + get cloze() { return getCachedValue(cloze); }, }; } @@ -379,7 +379,7 @@ function convertKanjiStat({name, category, content, order, score, dictionary, va order, score, dictionary, - value + value, }; } @@ -396,10 +396,10 @@ function getKanjiFrequencies(dictionaryEntry) { dictionary, dictionaryOrder: { index: dictionaryIndex, - priority: dictionaryPriority + priority: dictionaryPriority, }, character, - frequency: displayValue !== null ? displayValue : frequency + frequency: displayValue !== null ? displayValue : frequency, }); } return results; @@ -453,7 +453,7 @@ function getTermDefinition(dictionaryEntry, context, resultOutputMode) { get dictionary() { return getCachedValue(dictionaryNames)[0]; }, dictionaryOrder: { index: dictionaryIndex, - priority: dictionaryPriority + priority: dictionaryPriority, }, get dictionaryNames() { return getCachedValue(dictionaryNames); }, get expression() { @@ -477,7 +477,7 @@ function getTermDefinition(dictionaryEntry, context, resultOutputMode) { sourceTermExactMatchCount, url, get cloze() { return getCachedValue(cloze); }, - get furiganaSegments() { return getCachedValue(furiganaSegments); } + get furiganaSegments() { return getCachedValue(furiganaSegments); }, }; } @@ -530,7 +530,7 @@ function getTermDictionaryEntryCommonInfo(dictionaryEntry, type) { dictionary, glossary: entries, definitionTags: definitionTags2, - only + only, }); } @@ -538,7 +538,7 @@ function getTermDictionaryEntryCommonInfo(dictionaryEntry, type) { uniqueTerms, uniqueReadings, definitionTags, - definitions: hasDefinitions ? definitions : void 0 + definitions: hasDefinitions ? definitions : void 0, }; } @@ -557,12 +557,12 @@ function getTermFrequencies(dictionaryEntry) { dictionary, dictionaryOrder: { index: dictionaryIndex, - priority: dictionaryPriority + priority: dictionaryPriority, }, expression: term, reading, hasReading, - frequency: displayValue !== null ? displayValue : frequency + frequency: displayValue !== null ? displayValue : frequency, }); } return results; @@ -585,11 +585,11 @@ function getTermPitches(dictionaryEntry) { dictionary, dictionaryOrder: { index: dictionaryIndex, - priority: dictionaryPriority + priority: dictionaryPriority, }, expression: term, reading, - get pitches() { return getCachedValue(cachedPitches); } + get pitches() { return getCachedValue(cachedPitches); }, }); } return results; @@ -605,7 +605,7 @@ function getTermPitchesInner(pitches) { const cachedTags = createCachedValue(convertTags.bind(null, tags)); results.push({ position, - get tags() { return getCachedValue(cachedTags); } + get tags() { return getCachedValue(cachedTags); }, }); } return results; @@ -628,11 +628,11 @@ function getTermPhoneticTranscriptions(dictionaryEntry) { dictionary, dictionaryOrder: { index: dictionaryIndex, - priority: dictionaryPriority + priority: dictionaryPriority, }, expression: term, reading, - get phoneticTranscriptions() { return termPhoneticTranscriptions; } + get phoneticTranscriptions() { return termPhoneticTranscriptions; }, }); } @@ -649,7 +649,7 @@ function getTermPhoneticTranscriptionsInner(phoneticTranscriptions) { const cachedTags = createCachedValue(convertTags.bind(null, tags)); results.push({ ipa, - get tags() { return getCachedValue(cachedTags); } + get tags() { return getCachedValue(cachedTags); }, }); } return results; @@ -678,7 +678,7 @@ function getTermExpressions(dictionaryEntry) { get pitches() { return getCachedValue(pitches); }, get furiganaSegments() { return getCachedValue(furiganaSegments); }, get termFrequency() { return getCachedValue(termFrequency); }, - wordClasses + wordClasses, }; results.push(item); } @@ -702,12 +702,12 @@ function getTermExpressionFrequencies(dictionaryEntry, i) { dictionary, dictionaryOrder: { index: dictionaryIndex, - priority: dictionaryPriority + priority: dictionaryPriority, }, expression: term, reading, hasReading, - frequency: displayValue !== null ? displayValue : frequency + frequency: displayValue !== null ? displayValue : frequency, }); } return results; @@ -732,11 +732,11 @@ function getTermExpressionPitches(dictionaryEntry, i) { dictionary, dictionaryOrder: { index: dictionaryIndex, - priority: dictionaryPriority + priority: dictionaryPriority, }, expression: term, reading, - get pitches() { return getCachedValue(cachedPitches); } + get pitches() { return getCachedValue(cachedPitches); }, }); } return results; @@ -807,7 +807,7 @@ function convertTag({name, category, content, order, score, dictionaries, redund order, score, dictionary: (dictionaries.length > 0 ? dictionaries[0] : ''), - redundant + redundant, }; } @@ -835,7 +835,7 @@ function convertPitchTag({name, category, content, order, score, dictionaries, r score, content: [...content], dictionaries: [...dictionaries], - redundant + redundant, }; } @@ -881,7 +881,7 @@ function getCloze(dictionaryEntry, context) { prefix: text.substring(0, offset), body: text.substring(offset, offset + originalText.length), bodyKana: textSegments.join(''), - suffix: text.substring(offset + originalText.length) + suffix: text.substring(offset + originalText.length), }; } diff --git a/ext/js/data/anki-template-util.js b/ext/js/data/anki-template-util.js index 1c74d747..0051e3b5 100644 --- a/ext/js/data/anki-template-util.js +++ b/ext/js/data/anki-template-util.js @@ -63,7 +63,7 @@ export function getStandardFieldMarkers(type) { 'sentence', 'sentence-furigana', 'tags', - 'url' + 'url', ]; case 'kanji': return [ @@ -91,7 +91,7 @@ export function getStandardFieldMarkers(type) { 'sentence-furigana', 'stroke-count', 'tags', - 'url' + 'url', ]; default: throw new Error(`Unsupported type: ${type}`); diff --git a/ext/js/data/json-schema.js b/ext/js/data/json-schema.js index 0a2b8d82..65bbe8ce 100644 --- a/ext/js/data/json-schema.js +++ b/ext/js/data/json-schema.js @@ -355,8 +355,8 @@ export class JsonSchema { schema: propertySchema, stack: [ {schema: properties, path: 'properties'}, - {schema: propertySchema, path: property} - ] + {schema: propertySchema, path: property}, + ], }; } } @@ -380,8 +380,8 @@ export class JsonSchema { schema: itemSchema, stack: [ {schema: prefixItems, path: 'prefixItems'}, - {schema: itemSchema, path: index} - ] + {schema: itemSchema, path: index}, + ], }; } } @@ -395,15 +395,15 @@ export class JsonSchema { schema: itemSchema, stack: [ {schema: items, path: 'items'}, - {schema: itemSchema, path: index} - ] + {schema: itemSchema, path: index}, + ], }; } } } else { return { schema: items, - stack: [{schema: items, path: 'items'}] + stack: [{schema: items, path: 'items'}], }; } } @@ -517,7 +517,7 @@ export class JsonSchema { const {schema: schema2, stack: stack2} = this._getReference(ref); return { schema: schema2, - stack: [...stack, ...stack2] + stack: [...stack, ...stack2], }; } } diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index 2dc23229..074beb4e 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -82,7 +82,7 @@ export class OptionsUtil { profiles.push({ name: 'Default', options: defaultProfileOptions, - conditionGroups: [] + conditionGroups: [], }); } @@ -257,12 +257,12 @@ export class OptionsUtil { const replacements = [ [ '{{#*inline "audio"}}{{/inline}}', - '{{#*inline "audio"}}\n {{~#if definition.audioFileName~}}\n [sound:{{definition.audioFileName}}]\n {{~/if~}}\n{{/inline}}' + '{{#*inline "audio"}}\n {{~#if definition.audioFileName~}}\n [sound:{{definition.audioFileName}}]\n {{~/if~}}\n{{/inline}}', ], [ '{{#*inline "tags"}}\n {{~#each definition.definitionTags}}{{name}}{{#unless @last}}, {{/unless}}{{/each~}}\n{{/inline}}', - '{{#*inline "tags"}}\n {{~#mergeTags definition group merge}}{{this}}{{/mergeTags~}}\n{{/inline}}' - ] + '{{#*inline "tags"}}\n {{~#mergeTags definition group merge}}{{this}}{{/mergeTags~}}\n{{/inline}}', + ], ]; for (const [pattern, replacement] of replacements) { @@ -278,7 +278,7 @@ export class OptionsUtil { } options.anki.fieldTemplates = fieldTemplates; - } + }, ]; } @@ -321,7 +321,7 @@ export class OptionsUtil { showPitchAccentGraph: false, showIframePopupsInRootFrame: false, useSecurePopupFrameUrl: true, - usePopupShadowDom: true + usePopupShadowDom: true, }, audio: { @@ -330,7 +330,7 @@ export class OptionsUtil { volume: 100, autoPlay: false, customSourceUrl: '', - textToSpeechVoice: '' + textToSpeechVoice: '', }, scanning: { @@ -348,7 +348,7 @@ export class OptionsUtil { enableOnPopupExpressions: false, enableOnSearchPage: true, enableSearchTags: false, - layoutAwareScan: false + layoutAwareScan: false, }, translation: { @@ -357,7 +357,7 @@ export class OptionsUtil { convertAlphabeticCharacters: 'false', convertHiraganaToKatakana: 'false', convertKatakanaToHiragana: 'variant', - collapseEmphaticSequences: 'false' + collapseEmphaticSequences: 'false', }, dictionaries: {}, @@ -367,7 +367,7 @@ export class OptionsUtil { enableMecabParser: false, selectedParser: null, termSpacing: true, - readingMode: 'hiragana' + readingMode: 'hiragana', }, anki: { @@ -379,8 +379,8 @@ export class OptionsUtil { terms: {deck: '', model: '', fields: {}}, kanji: {deck: '', model: '', fields: {}}, duplicateScope: 'collection', - fieldTemplates: null - } + fieldTemplates: null, + }, }; } @@ -544,7 +544,7 @@ export class OptionsUtil { this._updateVersion34, this._updateVersion35, this._updateVersion36, - this._updateVersion37 + this._updateVersion37, ]; /* eslint-enable @typescript-eslint/unbound-method */ if (typeof targetVersion === 'number' && targetVersion < result.length) { @@ -560,8 +560,8 @@ export class OptionsUtil { _updateVersion1(options) { options.global = { database: { - prefixWildcardsSupported: false - } + prefixWildcardsSupported: false, + }, }; } @@ -618,7 +618,7 @@ export class OptionsUtil { scanOnPenHover: true, scanOnPenPress: true, scanOnPenRelease: false, - preventTouchScrolling: true + preventTouchScrolling: true, }); for (const {options: profileOptions} of options.profiles) { profileOptions.general.usePopupWindow = false; @@ -628,7 +628,7 @@ export class OptionsUtil { onWebPages: false, onPopupPages: false, onSearchPages: false, - onSearchQuery: false + onSearchQuery: false, }; const {modifier, middleMouse} = profileOptions.scanning; @@ -651,21 +651,21 @@ export class OptionsUtil { include: modifierInput, exclude: 'mouse0', types: {mouse: true, touch: false, pen: false}, - options: createInputDefaultOptions() + options: createInputDefaultOptions(), }); if (middleMouse) { scanningInputs.push({ include: 'mouse2', exclude: '', types: {mouse: true, touch: false, pen: false}, - options: createInputDefaultOptions() + options: createInputDefaultOptions(), }); } scanningInputs.push({ include: '', exclude: '', types: {mouse: false, touch: true, pen: true}, - options: createInputDefaultOptions() + options: createInputDefaultOptions(), }); profileOptions.scanning.inputs = scanningInputs; } @@ -775,7 +775,7 @@ export class OptionsUtil { for (const profile of options.profiles) { profile.options.translation.textReplacements = { searchOriginal: true, - groups: [] + groups: [], }; profile.options.sentenceParsing = { scanExtent: profile.options.anki.sentenceExt, @@ -792,8 +792,8 @@ export class OptionsUtil { {enabled: true, character1: '。', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true}, {enabled: true, character1: '!', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true}, {enabled: true, character1: '?', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true}, - {enabled: true, character1: '…', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true} - ] + {enabled: true, character1: '…', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true}, + ], }; delete profile.options.anki.sentenceExt; profile.options.general.popupActionBarLocation = 'top'; @@ -815,8 +815,8 @@ export class OptionsUtil { {action: 'addNoteTermKana', key: 'KeyR', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true}, {action: 'playAudio', key: 'KeyP', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true}, {action: 'viewNote', key: 'KeyV', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true}, - {action: 'copyHostSelection', key: 'KeyC', modifiers: ['ctrl'], scopes: ['popup'], enabled: true} - ] + {action: 'copyHostSelection', key: 'KeyC', modifiers: ['ctrl'], scopes: ['popup'], enabled: true}, + ], }; /* eslint-enable @stylistic/no-multi-spaces */ profile.options.anki.suspendNewCards = false; @@ -828,14 +828,14 @@ export class OptionsUtil { useLeft: false, useTop: false, windowType: 'popup', - windowState: 'normal' + windowState: 'normal', }; profile.options.audio.customSourceType = 'audio'; profile.options.clipboard = { enableBackgroundMonitor: profile.options.general.enableClipboardPopups, enableSearchPageMonitor: false, autoSearchContent: true, - maximumSearchLength: profile.options.general.maximumClipboardSearchLength + maximumSearchLength: profile.options.general.maximumClipboardSearchLength, }; delete profile.options.general.enableClipboardPopups; delete profile.options.general.enableClipboardMonitor; @@ -974,7 +974,7 @@ export class OptionsUtil { _updateVersion14(options) { for (const profile of options.profiles) { profile.options.accessibility = { - forceGoogleDocsHtmlRendering: false + forceGoogleDocsHtmlRendering: false, }; } } @@ -1022,7 +1022,7 @@ export class OptionsUtil { character1: character, character2: null, includeCharacterAtStart: false, - includeCharacterAtEnd: true + includeCharacterAtEnd: true, }); } } @@ -1190,7 +1190,7 @@ export class OptionsUtil { 'convertAlphabeticCharacters', 'convertHiraganaToKatakana', 'convertKatakanaToHiragana', - 'collapseEmphaticSequences' + 'collapseEmphaticSequences', ]; for (const {options: profileOptions} of options.profiles) { @@ -1259,7 +1259,7 @@ export class OptionsUtil { for (const profile of options.profiles) { profile.options.inputs.hotkeys.push( {action: 'profilePrevious', key: 'Minus', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true}, - {action: 'profileNext', key: 'Equal', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true} + {action: 'profileNext', key: 'Equal', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true}, ); } } diff --git a/ext/js/data/permissions-util.js b/ext/js/data/permissions-util.js index 1ccc630f..6da67486 100644 --- a/ext/js/data/permissions-util.js +++ b/ext/js/data/permissions-util.js @@ -131,7 +131,7 @@ export function hasRequiredPermissionsForOptions(permissions, options) { } const fieldsList = [ options.anki.terms.fields, - options.anki.kanji.fields + options.anki.kanji.fields, ]; for (const fields of fieldsList) { for (const fieldValue of Object.values(fields)) { |