ESLint InterlaceESLint Interlace
Plugin: modularity

Overview

ESLint rules for clean module boundaries and dependency management

Live from GitHub

This content is fetched directly from README.md on GitHub and cached for 1 hour.

Clean Modules

Enforce clean module boundaries and prevent circular dependencies.


ESLint Interlace Logo

Security-focused ESLint plugin.

NPM VersionNPM DownloadsPackage LicenseCodecovSince Dec 2025

Description

This plugin provides Security-focused ESLint plugin. By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.

Philosophy

Interlace fosters strength through integration. Instead of stacking isolated rules, we interlace security directly into your workflow to create a resilient fabric of code. We believe tools should guide rather than gatekeep, providing educational feedback that strengthens the developer with every interaction.

Getting Started

npm install eslint-plugin-modularity --save-dev

โš™๏ธ Configuration Presets

PresetDescription
recommendedBalanced DDD and architecture enforcement
strictAll rules as errors for strict enforcement

๐Ÿข Usage Example

// eslint.config.js
import modularity from 'eslint-plugin-modularity';

export default [
  modularity.configs.recommended,

  // Apply strict DDD enforcement to domain layer
  {
    files: ['src/domain/**/*.ts'],
    ...modularity.configs.strict,
  },
];

Why These Rules?

ddd-anemic-domain-model

Detects domain entities that are just data containers without behavior โ€” a common anti-pattern.

// โŒ Bad: Anemic model, no behavior
class Order {
  id: string;
  items: OrderItem[];
  status: OrderStatus;
}

// โœ… Good: Rich domain model with behavior
class Order {
  id: string;
  private items: OrderItem[];
  private status: OrderStatus;

  addItem(item: OrderItem): void {
    /* ... */
  }
  submit(): void {
    /* ... */
  }
  cancel(reason: string): void {
    /* ... */
  }
}

ddd-value-object-immutability

Value objects should be immutable. This rule catches mutable value objects.

// โŒ Bad: Mutable value object
class Money {
  amount: number; // Can be mutated!
}

// โœ… Good: Immutable value object
class Money {
  readonly amount: number;
  readonly currency: string;

  add(other: Money): Money {
    return new Money(this.amount + other.amount, this.currency);
  }
}

no-external-api-calls-in-utils

Utility modules should be pure functions without side effects like API calls.

// โŒ Bad: Utils with external dependencies
// src/utils/formatters.ts
import axios from 'axios';

export async function fetchAndFormat(id: string) {
  const data = await axios.get(`/api/${id}`); // External API call!
  return format(data);
}

// โœ… Good: Pure utility function
export function format(data: Data): FormattedData {
  return {
    /* pure transformation */
  };
}

Rules

Legend

IconDescription
๐Ÿ’ผRecommended: Included in the recommended preset.
โš ๏ธWarns: Set towarn in recommended preset.
๐Ÿ”งAuto-fixable: Automatically fixable by the --fix CLI option.
๐Ÿ’กSuggestions: Providing code suggestions in IDE.
๐ŸšซDeprecated: This rule is deprecated.
RuleCWEOWASPCVSSDescription๐Ÿ’ผโš ๏ธ๐Ÿ”ง๐Ÿ’ก๐Ÿšซ
ddd-anemic-domain-modelESLint rule documentation for ddd-anemic-domain-model
ddd-value-object-immutabilityESLint rule documentation for ddd-value-object-immutability
enforce-namingESLint rule documentation for enforce-naming
enforce-rest-conventionsESLint rule documentation for enforce-rest-conventions
no-external-api-calls-in-utilsESLint rule documentation for no-external-api-calls-in-utils

Part of the Interlace ESLint Ecosystem โ€” AI-native security plugins with LLM-optimized error messages:

PluginDownloadsDescription
eslint-plugin-secure-codingGeneral security rules & OWASP guidelines.
eslint-plugin-pgPostgreSQL security & best practices.
eslint-plugin-cryptoNodeJS Cryptography security rules.
eslint-plugin-jwtJWT security & best practices.
eslint-plugin-browser-securityBrowser-specific security & XSS prevention.
eslint-plugin-express-securityExpress.js security hardening rules.
eslint-plugin-lambda-securityAWS Lambda security best practices.
eslint-plugin-nestjs-securityNestJS security rules & patterns.
eslint-plugin-mongodb-securityMongoDB security best practices.
eslint-plugin-vercel-ai-securityVercel AI SDK security hardening.
eslint-plugin-import-nextNext-gen import sorting & architecture.

๐Ÿ“„ License

MIT ยฉ Ofri Peretz

ESLint Interlace Plugin

View README.md on GitHub โ†’

On this page

No Headings