packlets
Installation
SKILL.md
Packlets are a nice way to keep your JavaScript codebase somewhat loosely-coupled, without having to separate things into different npm packages.
You follow these 5 rules:
- Packlets live in
./src/packlets/<name>/and the entry point isindex.ts. - Files outside a packlet can only import from packlet’s entry point,
index.ts. - Files inside a packlet may not import its own entry point,
index.ts. - Packlets can import other packlets but cannot create circular dependencies.
- Packlets can only import other packlets and npm packages.
There is an ESLint plugin to enforce these rules.
About packlets
Source: https://github.com/microsoft/rushstack/edit/main/eslint/eslint-plugin-packlets/README.md
Motivation
When building a large application, it's a good idea to organize source files into modules, so that their dependencies can be managed. For example, suppose an application's source files can be grouped as follows: