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

eslint-plugin-ddd

v0.5.2

Published

ESLint plugin to enforce Domain-Driven Design principles

Downloads

926

Readme

eslint-plugin-ddd

ESLint plugin to enforce Domain-Driven Design (DDD) principles in your JavaScript and TypeScript projects.

Installation

pnpm add -D eslint-plugin-ddd

Usage

Add ddd to the plugins section of your .eslintrc configuration file:

{
  "plugins": ["ddd"]
}

Then configure the rules you want to use:

{
  "rules": {
    "ddd/require-spec-file": "error"
  }
}

Using Recommended Config

Alternatively, you can use the recommended configuration:

{
  "extends": ["plugin:ddd/recommended"]
}

Or the strict configuration:

{
  "extends": ["plugin:ddd/strict"]
}

Rules

require-spec-file

Enforces that every .js or .ts file containing logic has a corresponding .spec.js or .spec.ts file in the same directory.

Rule Details

This rule ensures test coverage by requiring spec files alongside implementation files that contain logic, promoting test-driven development and maintaining test organization.

What counts as "logic":

  • Functions with implementations (not just type signatures)
  • Classes with method implementations
  • Executable code

Files automatically excluded (no logic):

  • Type-only files (interfaces, types, enums)
  • Constant-only files
  • Simple re-export files

The rule automatically matches the file extension:

  • .js files require .spec.js files
  • .ts files require .spec.ts files

Examples of incorrect code:

// src/user-service.js exists
// but src/user-service.spec.js does NOT exist
// ❌ ESLint will report an error
// src/product-repository.ts exists
// but src/product-repository.spec.ts does NOT exist
// ❌ ESLint will report an error

Examples of correct code:

// src/user-service.js exists with logic
// AND src/user-service.spec.js exists
// ✅ No error
// src/product-repository.ts exists with logic
// AND src/product-repository.spec.ts exists
// ✅ No error
// src/constants.js exists with ONLY constants (no logic)
// ✅ No spec file required
export const API_URL = 'https://api.example.com';
export const MAX_RETRIES = 3;
// src/types.ts exists with ONLY types (no logic)
// ✅ No spec file required
export interface User {
  id: string;
  name: string;
}

Options

This rule accepts an options object with the following properties:

  • excludePatterns (array of strings): Glob patterns to exclude from the spec file requirement

Default exclude patterns:

  • **/*.spec.js - JavaScript spec files
  • **/*.spec.ts - TypeScript spec files
  • **/*.test.js - JavaScript test files
  • **/*.test.ts - TypeScript test files
  • **/index.js - JavaScript index files
  • **/index.ts - TypeScript index files
  • **/*.d.ts - TypeScript declaration files

Example configuration:

{
  "rules": {
    "ddd/require-spec-file": ["error", {
      "excludePatterns": [
        "**/*.spec.js",
        "**/*.spec.ts",
        "**/*.test.js",
        "**/*.test.ts",
        "**/config/**",
        "**/*.config.js",
        "**/*.config.ts"
      ]
    }]
  }
}

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Lint the code
pnpm lint

Releasing

This project uses release-it for automated releases.

Setup

  1. Copy the .env.example file to .env:

    cp .env.example .env
  2. Add your tokens to the .env file:

Create a Release

pnpm release

This will:

  • Run linting and tests
  • Bump the version
  • Create a git commit and tag
  • Push to GitHub
  • Create a GitHub release
  • Publish to npm

License

MIT