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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@yh-kim/eslint-plugin-fsd

v0.1.11

Published

ESLint plugin for Feature-Sliced Design architecture

Readme

@yh-kim/eslint-plugin-fsd

ESLint plugin for Feature-Sliced Design (FSD) architecture.

Installation

npm install --save-dev @yh-kim/eslint-plugin-fsd
# or
yarn add --dev @yh-kim/eslint-plugin-fsd
# or
pnpm add --save-dev @yh-kim/eslint-plugin-fsd

Usage

ESLint 9+ (Flat Config)

// eslint.config.js
import fsdPlugin from '@yh-kim/eslint-plugin-fsd';

export default [
  // Use recommended config
  fsdPlugin.configs['flat/recommended'],

  // Or configure manually
  {
    plugins: {
      fsd: fsdPlugin,
    },
    rules: {
      'fsd/no-cross-layer-import': 'error',
    },
  },
];

ESLint 8 and below (Legacy Config)

Add to your .eslintrc configuration file:

{
  "plugins": ["@yh-kim/fsd"],
  "extends": ["plugin:@yh-kim/fsd/recommended"]
}

Or configure rules individually:

{
  "plugins": ["@yh-kim/fsd"],
  "rules": {
    "@yh-kim/fsd/no-cross-layer-import": "error"
  }
}

With Options

{
  "plugins": ["@yh-kim/fsd"],
  "rules": {
    "@yh-kim/fsd/no-cross-layer-import": [
      "error",
      {
        "alias": "@",
        "ignorePatterns": ["\\.test\\.", "\\.spec\\."]
      }
    ]
  }
}

Configuration Presets

ESLint 9+ (Flat Config)

  • fsdPlugin.configs['flat/recommended'] - Recommended rules for FSD architecture
  • fsdPlugin.configs['flat/all'] - All available rules enabled

ESLint 8 and below (Legacy Config)

  • plugin:@yh-kim/fsd/recommended - Recommended rules for FSD architecture
  • plugin:@yh-kim/fsd/all - All available rules enabled

Expected Project Structure

This plugin expects the following project structure:

src/
├── app/
│   ├── App.tsx
│   └── providers/
├── pages/
│   ├── home/
│   └── profile/
├── widgets/
│   ├── header/
│   └── sidebar/
├── features/
│   ├── auth/
│   └── comments/
├── entities/
│   ├── user/
│   └── post/
└── shared/
    ├── ui/
    ├── lib/
    └── api/

Rules

Import Relationship Rules

| Rule | Description | Recommended | Level | |------|-------------|:-----------:|:-----:| | no-cross-layer-import | Enforces FSD layer hierarchy (upper layers can only import from lower layers) | ✅ | error |

FSD Layer Hierarchy

This plugin enforces the following FSD layer hierarchy:

app      (Top - Application initialization)
  ↓
pages    (Page routes)
  ↓
widgets  (Independent UI blocks)
  ↓
features (Business features)
  ↓
entities (Business entities)
  ↓
shared   (Bottom - Shared utilities)

Core Principle: Each layer can only import from layers below it in the hierarchy.

✅ Valid Examples

// ✅ Upper layer importing lower layer
import { HomePage } from '@/pages/home';      // app → pages
import { Header } from '@/widgets/header';    // pages → widgets
import { LoginForm } from '@/features/auth';  // widgets → features
import { User } from '@/entities/user';       // features → entities
import { Button } from '@/shared/ui';         // entities → shared

// ✅ Same layer imports
import { UserCard } from './UserCard';

// ✅ External packages
import React from 'react';

❌ Invalid Examples

// ❌ Lower layer importing upper layer (violates hierarchy)
import { config } from '@/app/config';        // pages → app ✗
import { HomePage } from '@/pages/home';      // widgets → pages ✗
import { Sidebar } from '@/widgets/sidebar';  // features → widgets ✗
import { login } from '@/features/auth';      // entities → features ✗
import { User } from '@/entities/user';       // shared → entities ✗

Why Use This Plugin?

  • 🏗️ Architecture Enforcement: Automatically enforce FSD architectural principles
  • 🔒 Prevent Circular Dependencies: Catch dependency violations before they become problems
  • 📚 Self-Documenting Code: Clear layer structure makes codebase easier to understand
  • ⚡ Scalability: Maintain clean architecture as your project grows
  • 🛡️ Type Safety: Works seamlessly with TypeScript projects

Contributing

See CONTRIBUTING.md for details on how to contribute.

License

MIT