From 7fc1508db3d956d06697754d474e34d3900ff3bd Mon Sep 17 00:00:00 2001 From: Balearica Date: Sat, 26 Oct 2024 23:36:42 -0700 Subject: [PATCH] Ran linter --- js/export/export.js | 4 +++- js/generalWorkerMain.js | 2 -- js/import/convertPageBlocks.js | 5 +++-- js/import/convertPageStext.js | 1 - js/utils/miscUtils.js | 4 ++-- scribe.js | 4 +++- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/js/export/export.js b/js/export/export.js index 37ac9c6..0d22081 100644 --- a/js/export/export.js +++ b/js/export/export.js @@ -1,5 +1,7 @@ import { inputData, opt } from '../containers/app.js'; -import { layoutDataTables, layoutRegions, ocrAll, pageMetricsArr } from '../containers/dataContainer.js'; +import { + layoutDataTables, layoutRegions, ocrAll, pageMetricsArr, +} from '../containers/dataContainer.js'; import { ImageCache } from '../containers/imageContainer.js'; import { reorderOcrPage } from '../modifyOCR.js'; import { saveAs } from '../utils/miscUtils.js'; diff --git a/js/generalWorkerMain.js b/js/generalWorkerMain.js index e7585f1..d13144c 100644 --- a/js/generalWorkerMain.js +++ b/js/generalWorkerMain.js @@ -15,7 +15,6 @@ export async function initGeneralWorker() { } return new Promise((resolve, reject) => { - const errorHandler = (err) => { console.error(err); }; @@ -35,7 +34,6 @@ export async function initGeneralWorker() { workerPromises['0'] = { resolve: innerResolve, reject: innerReject, func: 'ready' }; }); - const messageHandler = async (data) => { if (workerPromises[data.id]) { if (data.status === 'reject') { diff --git a/js/import/convertPageBlocks.js b/js/import/convertPageBlocks.js index 0f9676c..94c11d1 100644 --- a/js/import/convertPageBlocks.js +++ b/js/import/convertPageBlocks.js @@ -3,8 +3,9 @@ import ocr from '../objects/ocrObjects.js'; import { pass2, pass3 } from './convertPageShared.js'; import { LayoutDataTablePage } from '../objects/layoutObjects.js'; -import { ascCharArr, getTextScript, mean50, xCharArr } from '../utils/miscUtils.js'; - +import { + ascCharArr, getTextScript, mean50, xCharArr, +} from '../utils/miscUtils.js'; const baselineCharArr = [...xCharArr, ...ascCharArr]; diff --git a/js/import/convertPageStext.js b/js/import/convertPageStext.js index 66b4801..dd08758 100644 --- a/js/import/convertPageStext.js +++ b/js/import/convertPageStext.js @@ -146,7 +146,6 @@ export async function convertPageStext({ ocrStr, n }) { const fontSizeStrI = fontStr?.match(/size=['"]([^'"]*)/)?.[1]; const baseline = parseFloat(letterOrFontArr[j][6]); if (fontNameStrI && fontSizeStrI) { - // While small caps can be printed using special "small caps" fonts, they can also be printed using a regular font with a size change. // This block of code detects small caps printed in title case by checking for a decrease in font size after the first letter. // TODO: This logic currently fails when: diff --git a/js/utils/miscUtils.js b/js/utils/miscUtils.js index dc72f2b..72c5473 100644 --- a/js/utils/miscUtils.js +++ b/js/utils/miscUtils.js @@ -77,8 +77,8 @@ export function quantile(arr, ntile) { } /** - * - * @param {Array} arr + * + * @param {Array} arr * @returns {number} * This function returns `null` if the array is empty, however the TypeScript definition does not reflect this. * Needing to implement type checks on every result is cumbersome, and generally not useful, diff --git a/scribe.js b/scribe.js index bf2956f..e11806a 100644 --- a/scribe.js +++ b/scribe.js @@ -33,7 +33,9 @@ import { import { calcWordMetrics } from './js/utils/fontUtils.js'; import { getImageBitmap, imageStrToBlob } from './js/utils/imageUtils.js'; import { countSubstringOccurrences, getRandomAlphanum, replaceSmartQuotes } from './js/utils/miscUtils.js'; -import { calcConf, checkOcrWordsAdjacent, mergeOcrWords, splitOcrWord } from './js/utils/ocrUtils.js'; +import { + calcConf, checkOcrWordsAdjacent, mergeOcrWords, splitOcrWord, +} from './js/utils/ocrUtils.js'; import { assignParagraphs } from './js/utils/reflowPars.js'; import { writeXlsx } from './js/export/writeTabular.js'; import { calcColumnBounds } from './js/utils/detectTables.js';