A fast, helpful, and open-source document parser
fix some lint issues
Logan Markewich73cec66a7dc9
diff --git a/src/core/parser.ts b/src/core/parser.tsindex 3046db3..fd2da05 100644--- a/src/core/parser.ts+++ b/src/core/parser.ts@@ -43,10 +43,6 @@ export class LiteParse {if (!quiet) console.error(msg); // Progress goes to stderr};- // Convert to PDF if needed- let pdfPath = filePath;- let needsCleanup = false;-log(`Processing file: ${filePath}`);const conversionResult = await convertToPdf(filePath);@@ -64,8 +60,9 @@ export class LiteParse {};}- pdfPath = conversionResult.pdfPath;- needsCleanup = pdfPath !== filePath;+ // Convert to PDF if needed+ const pdfPath = conversionResult.pdfPath;+ const needsCleanup = pdfPath !== filePath;if (needsCleanup) {log(`Converted ${conversionResult.originalExtension} to PDF`);diff --git a/src/engines/pdf/pdfjs.ts b/src/engines/pdf/pdfjs.tsindex 786a756..16a3bf1 100644--- a/src/engines/pdf/pdfjs.ts+++ b/src/engines/pdf/pdfjs.ts@@ -230,7 +230,7 @@ export class PdfJsEngine implements PdfEngine {const pages: PageData[] = [];// Parse target pages if specified- let pageNumbers: number[] = [];+ let pageNumbers: number[];if (targetPages) {pageNumbers = this.parseTargetPages(targetPages, numPages);} else {diff --git a/src/processing/cleanText.ts b/src/processing/cleanText.tsindex d651909..13a5b98 100644--- a/src/processing/cleanText.ts+++ b/src/processing/cleanText.ts@@ -82,6 +82,7 @@ export function cleanRawText(pages: ParsedPage[], _config: LiteParseConfig): voi// Remove null charactersfor (const page of pages) {+ // eslint-disable-next-line no-control-regexpage.text = page.text.replace(/\u0000/g, " ");}}diff --git a/src/processing/gridProjection.ts b/src/processing/gridProjection.tsindex 4b05817..d173e8e 100644--- a/src/processing/gridProjection.ts+++ b/src/processing/gridProjection.ts@@ -1047,15 +1047,14 @@ export function projectToGrid(// calculate median textBox width/heightconst pageMedianSizes = getMedianTextBoxSize(projectionBoxes);let medianWidth = pageMedianSizes.width;- let medianHeight = pageMedianSizes.height;+ const medianHeight = pageMedianSizes.height;- let { verticalLines, horizontalLines } = getVerticalAndHorizontalLinesFromPagePaths(- config,- page.paths- );+ const { verticalLines: rawVerticalLines, horizontalLines: _horizontalLines } =+ getVerticalAndHorizontalLinesFromPagePaths(config, page.paths);// filter vertical and horizontal lines are less than 80% of page.width / height- verticalLines = verticalLines.filter((line) => line.height > page.height * 0.8);- horizontalLines = horizontalLines.filter((line) => line.width > page.width * 0.8);+ const verticalLines = rawVerticalLines.filter((line) => line.height > page.height * 0.8);+ // horizontalLines filtered but not currently used - reserved for future detection+ void _horizontalLines.filter((line) => line.width > page.width * 0.8);// Save original bboxes (including OCR) for text attributionconst attributionBboxes: ProjectionTextBox[] = [];@@ -1175,7 +1174,8 @@ export function projectToGrid(const sizes = getMedianTextBoxSize(lines.slice(block.start, block.end).flat());medianWidth = sizes.width;- medianHeight = sizes.height;+ // medianHeight updated but not currently used per-block - reserved for future use+ void sizes.height;}// compute snapsdiff --git a/src/processing/pathUtils.ts b/src/processing/pathUtils.tsindex 4686357..6e58337 100644--- a/src/processing/pathUtils.ts+++ b/src/processing/pathUtils.ts@@ -9,8 +9,8 @@ export interface Line {height: number;}-export interface VerticalLine extends Line {}-export interface HorizontalLine extends Line {}+export type VerticalLine = Line;+export type HorizontalLine = Line;/*** Extract vertical and horizontal lines from PDF paths