npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

stay-in-your-lane

v0.1.0

Published

Enforce feature-based folder boundaries. No cross-feature imports.

Downloads

504

Readme

stay-in-your-lane

npm GitHub

Enforce feature-based folder boundaries. No cross-feature imports.

If your codebase is organized into feature folders — src/features/auth, src/features/billing, src/features/dashboard — this tool makes sure they don't reach into each other. Features can share a common layer, but they can't import from sibling features.

Install

npm install --save-dev stay-in-your-lane
# or
bun add -d stay-in-your-lane

Configure

Add a stay-in-your-lane key to your package.json pointing to the directories that contain your features:

{
  "stay-in-your-lane": {
    "features": ["src/features"]
  }
}

Each path in features is a directory whose immediate subdirectories are treated as feature boundaries. Imports between those subdirectories are violations.

Multiple feature roots are supported:

{
  "stay-in-your-lane": {
    "features": ["src/features", "src/modules"]
  }
}

TypeScript path aliases defined in tsconfig.json (including extended configs) are resolved automatically.

Usage

# Scan the entire project
npx stay-in-your-lane

# Scan specific files
npx stay-in-your-lane check src/features/auth/index.ts src/features/billing/utils.ts

# Scan only git-staged files (useful in a pre-commit hook)
npx stay-in-your-lane --staged

# Output violations as JSON
npx stay-in-your-lane --json

Exit code is 0 when no violations are found, 1 when violations exist, and 2 on a configuration error.

Example output

stay-in-your-lane: 2 violations found

  src/features/auth/LoginForm.tsx
    L12  → imports from billing  (../../billing/plans)

  src/features/dashboard/index.ts
    L4   → imports from auth  (@/features/auth/session)

Pre-commit hook

Pair with lint-staged to enforce boundaries on every commit:

{
  "lint-staged": {
    "*.{ts,tsx,js,jsx}": "stay-in-your-lane check"
  }
}

Or add a pre-commit script directly:

#!/bin/sh
npx stay-in-your-lane --staged

How it works

  1. Discover — finds all .ts, .tsx, .js, and .jsx files (or accepts an explicit list).
  2. Extract — parses each file with oxc-parser to collect static imports, re-exports, and static dynamic imports.
  3. Resolve — turns each import specifier into an absolute path, handling relative paths and TypeScript aliases.
  4. Check — if the importing file and the resolved path live in different immediate subdirectories of a configured feature root, it's a violation.
  5. Report — prints a grouped, human-readable summary (or JSON) and exits with the appropriate code.

License

MIT — github.com/hivinaynair/stay-in-your-lane