Shopify / Shopify/theme-tools

The node implementation of `getDefaultTranslationsFactory` is inefficient

Open
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tech debt
Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

https://github.com/Shopify/liquid-language-server/blob/main/packages/node/src/index.ts#L67-L92

Even though the body and parsed JSON is cached, we're re-reading the file contents on every call to runChecks.

A smarter approach would be to start a file watcher (presumably with chokidar to avoid weird node.js macos/windows file watch issues) and invalidate the cached value on file system file change.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/node/src/index.ts lines 67-92 and trace getDefaultTranslationsFactory through runChecks. Review how the body and parsed JSON are cached, then determine how file changes should invalidate that cache without rereading the file on every call. Done means file changes refresh the cached value while repeated runChecks calls avoid unnecessary reads.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
performance, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.