Skip to content

[Payment due][$250] Centralize ExpensiMark usage with a dedicated Parser module #44451

@blazejkustra

Description

@blazejkustra

Proposal:

  • Create a Parser lib, where ExpensiMark is going to be imported and initialized only once
  • Forbid importing ExpensiMark from expensify-common globally (can be easily done with ESLint)
  • (optional) Pass Onyx context with a new ExpensiMark method instead of wrapping parseHtmlToText, parseHtmlToMarkdown like in src/libs/OnyxAwareParser.ts.

This way, there will be only one instance of ExpensiMark, and src/libs/Parser will be used throughout the codebase. This will potentially prevent regressions like this going forward.

Problems

  1. ExpensiMark methods (parseHtmlToText, parseHtmlToMarkdown) should always be used with Onyx context. Otherwise server is spammed with a lot of errors like this.
  2. We introduced OnyxAwareParser a while ago, but we can't expect everybody to know it's mandatory to use it. Instead contributors often import ExpensiMark, initialize it and use it's methods, which causes problems (like here).
  3. ExpensiMark is initialized 14 times in E/App.
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ddda297d9f5526e7
  • Upwork Job ID: 1813359382413182920
  • Last Price Increase: 2024-07-16
  • Automatic offers:
    • hoangzinh | Reviewer | 103148367
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @kadiealexander

Metadata

Metadata

Labels

AutoAssignerNewDotQualityUsed to assign quality issues to engineersAwaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions