LibreChat/scripts/eslint
Marco Beretta 06065af0f3
🧱 feat: Catch Module-Load Use of Mocked Packages in @librechat/chat (#17539)
* feat: Reject Module-Load Use of Other Packages in the Chat Package

App specs mock whole packages (@librechat/client, librechat-data-provider), so a package module that calls into one or reads a member of one while it loads throws before any test runs. chat/boundary now reports a call, new, tagged template or member read through an external import at module scope in packages/chat/src outside specs; React and Jotai are exempt through a loadSafe option.

* fix: Count Immediately Invoked Functions and Computed Field Keys as Module Load

* fix: See Through Erased TypeScript Wrappers in the Module-Load Check

* fix: Count Destructuring, Spreads and Wrapped IIFEs as Module-Load Reads

* refactor: Judge Every Load-Time Reference to an External Import

The check now walks each external import's references once and reports any that runs on load outside an inert position, instead of listing the node types that read an import. Class heritage, in, instanceof and iteration are reported with no new visitor.

* fix: Follow Branches to Their Consumer and Skip Erased Heritage Types

* fix: Count Constructed Classes and Destructuring Assignments as Module Load

* fix: Count Constructors of Constructed Classes and Branch-Fed IIFEs as Module Load

* fix: Follow Const Aliases of External Imports in the Module-Load Check

* fix: Find Aliases Behind Wrappers and Branches

* fix: Track require Bindings, Skip Writes and Defer Generator Bodies in the Module-Load Check

* fix: Follow Assignment Aliases of External Imports

* fix: Collect require Bindings From Exported Declarations

* refactor: Cover Module-Load Failures With a Mocked-Dependency Load Spec

A packages/chat spec now loads the index, react and components entries with every package the sources import (React and Jotai aside) mocked to a module whose exports are missing, the way an app spec's factory mock leaves it, and asserts nothing throws. That covers aliases, require, invoked functions and the rest at runtime, so chat/boundary keeps only the plain case: a call, new, tagged template or member read through a direct import binding at module scope.

* chore: Retest Against Current Dev

* fix: Exempt Spec Support Files and Node Built-ins From the Module-Load Check
2026-10-29 09:53:59 +01:00
..
chat.mjs 🧱 feat: Catch Module-Load Use of Mocked Packages in @librechat/chat (#17539) 2026-10-29 09:53:59 +01:00
chat.test.mjs 🧱 feat: Catch Module-Load Use of Mocked Packages in @librechat/chat (#17539) 2026-10-29 09:53:59 +01:00
design.mjs 🧪 fix: Close css-colors Triplet and Disabled-Recipe Rule Gaps (#17358) 2026-10-24 15:09:30 +02:00
design.test.mjs 🧪 fix: Close css-colors Triplet and Disabled-Recipe Rule Gaps (#17358) 2026-10-24 15:09:30 +02:00