Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

eslint-rule-dev

БесплатноБез исполняемых скриптовНе проверен

ESLint custom rule development - AST traversal, rule testing, plugins, and flat config When user creates ESLint rules, develops ESLint plugins, works with…

shepherdjerredот shepherdjerred★ 85 звёзд на GitHub

Об этом скилле

ESLint Rule Development Agent

What's New in ESLint 9+ (2024-2025)

  • Flat config: eslint.config.js replaces .eslintrc.*
  • ESM support: Native ES modules in configs and rules
  • defineConfig() helper: Type-safe configuration with autocomplete
  • Stricter plugin format: Plugins must use new object structure
  • Removed formatters: Many built-in formatters moved to packages

Rule Structure

Every ESLint rule exports an object with meta and create:

export default {
  meta: {
    type: "problem", // "problem" | "suggestion" | "layout"
    docs: {
      description: "Disallow foo assigned to anything other than bar",
      recommended: true,
      url: "https://example.com/rules/no-foo",
    },
    fixable: "code", // "code" | "whitespace" | null
    hasSuggestions: true,
    schema: [], // JSON Schema for rule options
    messages: {
      avoidFoo: "Avoid using 'foo' - use 'bar' instead.",
      suggestBar: "Replace with 'bar'.",
    },
  },

  create(context) {
    return {
      // Visitor methods for AST nodes
      Identifier(node) {
        if (node.name === "foo") {
          context.report({
            node,
            messageId: "avoidFoo",
          });
        }
      },
    };
  },
};

Meta Properties

Property Purpose
type Rule category: "problem", "suggestion", "layout"
docs.description Short description for documentation
docs.recommended Include in recommended config
docs.url Link to full documentation
fixable Enable auto-fix ("code" or "whitespace")
hasSuggestions Rule provides suggestions
schema JSON Schema for options validation
messages Message templates with IDs
defaultOptions Default values for options
deprecated Mark rule as deprecated

The Context Object

The context object passed to create() provides:

Properties

create(context) {
  // Rule configuration
  context.id              // Rule ID (e.g., "no-console")
  context.options         // Array of configured options
  context.settings        // Shared settings from config

  // File information
  context.filename        // Current file path
  context.cwd             // Current working directory

  // Source code access
  context.sourceCode      // SourceCode object for analysis

  // Language configuration
  context.languageOptions // Parser options, globals, etc.
}

Methods

// Report a problem
context.report({
  node,
  messageId: "myMessage",
  data: { name: "foo" },
  fix: (fixer) => fixer.replaceText(node, "bar"),
});

AST Node Visitors

Rules work by defining visitor functions for AST node types:

create(context) {
  return {
    // Called when entering a node
    CallExpression(node) {
      // Analyze call expressions
    },

    // Called when exiting a node (use ":exit" suffix)
    "FunctionDeclaration:exit"(node) {
      // Run after all children processed
    },

    // Selector syntax for complex matching
    "CallExpression[callee.name='require']"(node) {
      // Only matches require() calls
    },
  };
}

Common Node Types

Node Type Matches
Identifier Variable names, function names
Literal Strings, numbers, booleans
CallExpression Function calls
MemberExpression Property access (a.b, a['b'])
FunctionDeclaration Named function declarations
ArrowFunctionExpression Arrow functions
VariableDeclaration let, const, var declarations
ImportDeclaration import statements
ExportDefaultDeclaration export default

AST Selectors

ESLint supports CSS-like selectors for targeting nodes:

// Basic selectors
"Identifier"; // Any identifier
"CallExpression"; // Any function call

// Attribute selectors
"Identifier[name='foo']"; // Identifier named "foo"
"Literal[value=123]"; // Literal with value 123
"CallExpression[callee.name='require']"; // require() calls

// Descendant selectors
"FunctionDeclaration Identifier"; // Identifiers inside functions

// Child selectors
"CallExpression > MemberExpression"; // Direct child

// Sibling selectors
"VariableDeclaration ~ VariableDeclaration"; // Following sibling

// Pseudo-classes
":first-child"; // First child node
":last-child"; // Last child node
":nth-child(2)"; // Second child
":not(Literal)"; // Not
Полный SKILL.md на GitHub

Установить eslint-rule-dev в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл eslint-rule-dev?

ESLint custom rule development - AST traversal, rule testing, plugins, and flat config When user creates ESLint rules, develops ESLint plugins, works with AST, or mentions RuleTester

Как установить скилл eslint-rule-dev?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл eslint-rule-dev запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить eslint-rule-dev с