CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-eslint-plugin-eslint-plugin

An ESLint plugin for linting ESLint plugins with 32 rules, preset configurations, and utility functions for rule development.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

index.mddocs/

ESLint Plugin ESLint Plugin

Overview

ESLint Plugin ESLint Plugin is a comprehensive ESLint plugin designed specifically for linting ESLint plugins themselves. It provides 32 specialized rules divided into two categories: 26 rules for linting ESLint rule files and 6 rules for linting ESLint test files. The rules ensure code quality and consistency in ESLint rule development, supporting rules written in CommonJS, ES modules, and TypeScript.

Package Information

  • Package Name: eslint-plugin-eslint-plugin
  • Package Type: npm
  • Language: TypeScript/JavaScript
  • Installation: npm install eslint-plugin-eslint-plugin --save-dev
  • Peer Dependency: eslint >=9.0.0
  • Node Versions: ^20.19.0 || ^22.13.1 || >=24.0.0

Core Imports

import eslintPlugin from 'eslint-plugin-eslint-plugin';

For CommonJS:

const eslintPlugin = require('eslint-plugin-eslint-plugin');

Basic Usage

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

export default [
  eslintPlugin.configs.recommended,
  {
    files: ['lib/rules/*.js'],
    rules: {
      'eslint-plugin/require-meta-type': 'error',
      'eslint-plugin/require-meta-docs-url': 'error'
    }
  }
];

For legacy .eslintrc configuration:

{
  "plugins": ["eslint-plugin"],
  "extends": ["plugin:eslint-plugin/recommended"],
  "rules": {
    "eslint-plugin/require-meta-type": "error"
  }
}

Architecture

ESLint Plugin ESLint Plugin is built around several key components:

  • Plugin Object: Main export containing metadata, rules, and preset configurations
  • Rules Collection: 32 specialized rules divided into Rules (26) and Tests (6) categories
  • Configuration Presets: 7 preset configurations for different use cases
  • Utility Functions: Comprehensive helper functions for analyzing ESLint rule code
  • Type System: Full TypeScript support with detailed type definitions

Capabilities

Plugin Configuration

Core plugin object with metadata, rules, and preset configurations for various ESLint plugin development scenarios.

interface ESLintPlugin {
  meta: {
    name: string;
    version: string;
  };
  rules: Record<string, Rule.RuleModule>;
  configs: {
    all: Linter.Config;
    'all-type-checked': Linter.Config;
    recommended: Linter.Config;
    rules: Linter.Config;
    tests: Linter.Config;
    'rules-recommended': Linter.Config;
    'tests-recommended': Linter.Config;
  };
}

Plugin Configuration

Rule Linting

26 specialized rules for linting ESLint rule files, ensuring proper metadata, message handling, and best practices.

// Key rule examples
const rules = {
  'require-meta-type': Rule.RuleModule;
  'require-meta-docs-url': Rule.RuleModule;
  'no-deprecated-context-methods': Rule.RuleModule;
  'prefer-message-ids': Rule.RuleModule;
  'require-meta-schema': Rule.RuleModule;
  // ... 19 more rules
};

Rule Linting

Test Linting

6 specialized rules for linting ESLint test files, ensuring test case consistency and proper test structure.

// Key test rules
const testRules = {
  'consistent-output': Rule.RuleModule;
  'no-identical-tests': Rule.RuleModule;
  'no-only-tests': Rule.RuleModule;
  'test-case-property-ordering': Rule.RuleModule;
  'test-case-shorthand-strings': Rule.RuleModule;
  'prefer-output-null': Rule.RuleModule;
};

Test Linting

Utility Functions

Comprehensive helper functions for analyzing ESLint rule code, extracting metadata, and working with AST nodes.

// Core utility functions
function getRuleInfo(sourceCode: {
  ast: Program;
  scopeManager: Scope.ScopeManager;
}): RuleInfo | null;

function getTestInfo(
  context: Rule.RuleContext,
  ast: Program
): TestInfo[];

function getContextIdentifiers(
  scopeManager: Scope.ScopeManager,
  ast: Program
): Set<Identifier>;

Utility Functions

Types

interface RuleInfo {
  create: FunctionExpression | ArrowFunctionExpression | FunctionDeclaration;
  isNewStyle: boolean;
  meta?: Expression | Pattern | FunctionDeclaration;
}

interface TestInfo {
  invalid: (Expression | SpreadElement | null)[];
  valid: (Expression | SpreadElement | null)[];
}

interface FunctionInfo {
  codePath: Rule.CodePath | null;
  hasReturnWithFixer?: boolean;
  hasYieldWithFixer?: boolean;
  node: Node | null;
  shouldCheck: boolean;
  upper: FunctionInfo | null;
}

interface ViolationAndSuppressionData {
  messageId?: Expression | SpreadElement | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern;
  message?: Expression | SpreadElement | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern;
  data?: Expression | SpreadElement | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern;
  fix?: Expression | SpreadElement | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern;
}

interface MetaDocsProperty {
  docsNode: Property | undefined;
  metaNode: Node | undefined;
  metaPropertyNode: Property | undefined;
}

docs

index.md

plugin-configuration.md

rule-linting.md

test-linting.md

utility-functions.md

tile.json