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

@gergelyszerovay/eslint-plugin-path-boundary-imports

v1.0.6

Published

The code is based on https://github.com/qdanik/eslint-plugin-path

Readme

The code is based on https://github.com/qdanik/eslint-plugin-path

An ESLint plugin for enforcing consistent imports across project.

Installation

pnpm install -D @gergelyszerovay/eslint-plugin-path-boundary-imports

ESlint 9+

If you are using ESLint 9 or later, you can use the plugin without any additional configuration. Just install it and add it to your ESLint configuration.

import eslintPluginPathBoundaryImports from "@gergelyszerovay/eslint-plugin-path-boundary-imports";

export default [
  {
    files: ["*.{js,ts,jsx,tsx}"],
    plugins: {
      path: eslintPluginPathBoundaryImports,
    },
    rules: {
      "path/enforce-import-pattern": [
        "error",
        {
          levels: 2,
        },
      ],
    },
  },
];

Custom tsconfig/jsconfig paths

If you are using custom paths in your tsconfig.json file, you can specify the path to the configuration file in the ESLint configuration file. You can do this by adding the following lines to your config file:

{
  "settings": {
    "path": {
      "config": "tsconfig.json"
    }
  }
}

Rule: eslint-plugin-path-boundary-imports/enforce-import-pattern

Enforces a consistent import pattern across feature boundaries. This rule ensures that imports between features use path aliases, while imports within the same feature use relative paths.

Fixable: This rule is automatically fixable using the --fix command line option.

Example

These examples have the following project structure and path alias configuration:

project
└─── src
    └─── features
        └─── user-management
        └─── payment-processing
// tsconfig.json
{
  "compilerOptions": {
    "paths": {
      "@features/*": ["./src/features/*"]
    }
  }
}

The Rule in Action

Cross-Feature Imports

When importing from a different feature, use the path alias:

Pass

// inside "src/features/user-management/user.ts"
import { processPayment } from "@features/payment-processing/pay";

Fail

// inside "src/features/user-management/user.ts"
import { processPayment } from "../payment-processing/pay"; // Should use path alias

Within-Feature Imports

When importing from within the same feature, use relative paths:

Pass

// inside "src/features/user-management/user.ts"
import { userData } from "./internal/data";

Fail

// inside "src/features/user-management/user.ts"
import { userData } from "@features/user-management/internal/data"; // Should use relative path

Options

This rule supports the following options:

levels: number:

  • default: 2

Determines how many levels of the path structure define a feature boundary. For a typical @features/feature-name structure, 2 is the correct setting (counting @features as level 1 and the feature name as level 2).

Configuration Example

{
  "rules": {
    "path/enforce-import-pattern": ["error", { "levels": 2 }]
  }
}

Why Use This Rule?

This rule helps maintain a consistent import pattern in your codebase, which provides several benefits:

  1. Clear Feature Boundaries: By using path aliases for cross-feature imports, the codebase clearly indicates when module boundaries are crossed
  2. Refactoring Safety: Relative imports within features make it easier to move files within a feature without breaking imports
  3. Improved Readability: The import pattern makes the relationship between modules more immediately apparent to developers