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

@libar-dev/eslint-plugin-directives

v0.2.0

Published

ESLint plugin for architectural directives — self-documenting, structured alternatives to eslint-disable comments

Readme

@libar-dev/eslint-plugin-directives

ESLint plugin for architectural directives — self-documenting, structured alternatives to eslint-disable comments.

What are Architectural Directives?

Instead of suppressing lint errors with // eslint-disable-next-line, architectural directives document why a deviation exists:

// Bad: opaque suppression
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Wrapper<T extends any> = { value: T };

// Good: self-documenting directive
// @architectural-directive: library-generic-constraint
// Reason: Generic constraint requires any for library-level type abstraction
type Wrapper<T extends any> = { value: T };

Directives serve as both documentation and ESLint suppressions — no eslint-disable needed.

Installation

npm install --save-dev @libar-dev/eslint-plugin-directives

Peer dependencies: eslint ^8.0.0 || ^9.0.0, @typescript-eslint/parser ^8.18.0

Usage

ESLint Flat Config

import directivesPlugin from '@libar-dev/eslint-plugin-directives';

export default [
  {
    plugins: { directives: directivesPlugin },
    rules: {
      'directives/no-explicit-any': 'error',
      'directives/no-eslint-disable': 'error',
      'directives/no-unused-type-imports': 'warn',
    },
  },
];

Using the Recommended Config

import directivesPlugin from '@libar-dev/eslint-plugin-directives';

export default [
  {
    plugins: { directives: directivesPlugin },
    rules: {
      ...directivesPlugin.configs.recommended.rules,
    },
  },
];

The recommended config enables no-explicit-any and no-eslint-disable at "error" severity.

Rules

directives/no-eslint-disable

Prevents // eslint-disable comments. Requires architectural directives instead.

Built-in allowed directives: adapter-contract, library-generic-constraint, spec-driven-stub

// Error: eslint-disable without directive
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const x: any = value;

// OK: architectural directive present
// @architectural-directive: adapter-contract
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const x: any = externalApi.getValue();

directives/no-explicit-any

Prevents explicit any types in TypeScript annotations, as any casts, z.any(), and v.any().

Built-in allowed directives: library-generic-constraint, test-any-type-handling, intersection-fallback, adapter-contract, spec-driven-stub

For v.any(): schema-compatibility For z.any(): test-any-type-handling, schema-compatibility

// Error
const x: any = 5;
const y = value as any;

// OK: directive present
// @architectural-directive: library-generic-constraint
type Wrapper<T extends any> = { value: T };

Automatically skips test files (.test.ts, .spec.ts) and generated files (.d.ts, _generated/).

directives/no-unused-type-imports

Detects unused import type declarations.

Built-in allowed directives: spec-driven-stub

// Error: Foo is never used
import type { Foo } from './types.js';

// OK: directive documents intentional stub
// @architectural-directive: spec-driven-stub
// Reason: Types defined per feature spec, used when implementation completes
import type { FutureEvent } from './types.js';

Custom Directives

All rules accept an additionalDirectives option for project-specific directives:

rules: {
  'directives/no-explicit-any': ['error', {
    additionalDirectives: ['convex-compatibility', 'legacy-api-workaround'],
  }],
  'directives/no-eslint-disable': ['error', {
    additionalDirectives: ['environment-access-safe'],
  }],
}

Then in your code:

// @architectural-directive: convex-compatibility
// Reason: Convex type system requires any for this field
const schema = v.any();

Built-in Directive Types

| Directive | Category | Used By | |-----------|----------|---------| | library-generic-constraint | type-level | no-explicit-any, no-eslint-disable | | intersection-fallback | type-level | no-explicit-any | | test-any-type-handling | testing | no-explicit-any | | adapter-contract | behavioral | no-explicit-any, no-eslint-disable | | schema-compatibility | validation | no-explicit-any | | spec-driven-stub | design | no-unused-type-imports, no-eslint-disable |

API Exports

The package also exports utilities for building custom ESLint rules with directive support:

import {
  // Directive detection
  hasArchitecturalDirective,
  hasPrecedingDirective,

  // File context analysis
  analyzeFileContext,

  // Registry
  ARCHITECTURAL_DIRECTIVES,
  getDirectiveMetadata,
  getDirectivesByCategory,
  isValidDirectiveType,
} from '@libar-dev/eslint-plugin-directives';

// Types
import type {
  FileContext,
  DirectiveType,
  DirectiveCategory,
  DirectiveMetadata,
} from '@libar-dev/eslint-plugin-directives';

License

MIT