I Analyzed AI Coding Mistakes and Built an ESLint Plugin to…
    Neura MarketNeura Market/Stable Diffusion
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityStable DiffusionStable Diffusion
    DeepSeekDeepSeekCoPilotCoPilotMidjourneyMidjourney
    View All Directories
    OverviewPromptsBlogVideosGuidesCoursesCommunityModelsLoRAsComfyUI WorkflowsTrending
    Stable DiffusionBlogI Analyzed AI Coding Mistakes and Built an ESLint Plugin to Catch Them
    Back to Blog
    I Analyzed AI Coding Mistakes and Built an ESLint Plugin to Catch Them
    typescript

    I Analyzed AI Coding Mistakes and Built an ESLint Plugin to Catch Them

    Rob Simpson April 4, 2026
    0 views

    After reviewing empirical studies on LLM-generated bugs, I built eslint-plugin-llm-core — 20 rules designed to catch the mistakes AI coding assistants make most often.


    title: "I Analyzed AI Coding Mistakes and Built an ESLint Plugin to Catch Them" published: true description: "After reviewing empirical studies on LLM-generated bugs, I built eslint-plugin-llm-core — 20 rules designed to catch the mistakes AI coding assistants make most often." tags: [typescript, eslint, ai, llm] cover_image:

    Here's a pattern you've probably seen:

    const results = items.map(async (item) => {
      return await fetchItem(item);
    });
    

    Looks fine, right? Your AI assistant wrote it. Tests pass. Code review approves it.

    Then production hits, and results is an array of Promises — not the values you expected. The await on line 2 does nothing. You needed Promise.all(items.map(...)) or a for...of loop.

    This isn't a TypeScript bug. It's a common LLM coding mistake — one of hundreds I found when I started researching AI-generated code quality.

    The Problem: AI Writes Code That Works, Not Code That's Right

    LLMs are excellent at writing code that passes tests. They're terrible at writing code that handles edge cases, maintains consistency, and follows best practices under the hood.

    After reviewing several empirical studies on LLM-generated code bugs — including an analysis of 333 bugs and PromptHub's study of 558 incorrect snippets — I found clear patterns emerging:

    Bug TypeFrequency
    Missing corner cases15.3%
    Misinterpretations20.8%
    Hallucinated objects/APIs9.6%
    Incorrect conditionsHigh
    Missing code blocks40%+

    The most frustrating part? Many of these are preventable at lint time.

    The Solution: ESLint Rules Designed for AI-Generated Code

    I built eslint-plugin-llm-core — an ESLint plugin with 20 rules specifically designed to catch the mistakes AI coding assistants make most often.

    Not just generic best practices, but patterns I've seen repeatedly in AI-generated codebases:

    • Async/await misuse
    • Inconsistent error handling
    • Missing null checks
    • Magic numbers instead of named constants
    • Deep nesting instead of early returns
    • Empty catch blocks that swallow errors
    • Generic variable names that obscure intent

    Example: The Async Array Callback Trap

    // ❌ AI often writes this
    const userIds = users.map(async (user) => {
      return await db.getUser(user.id);
    });
    // userIds is Promise<User>[] — not User[]
    
    // ✅ What you actually need
    const userIds = await Promise.all(
      users.map((user) => db.getUser(user.id))
    );
    

    The plugin catches this with no-async-array-callbacks:

    57:27  error  Avoid passing async functions to array methods  llm-core/no-async-array-callbacks
    
      This pattern returns an array of Promises, not the resolved values.
      Consider using Promise.all() or a for...of loop instead.
    

    Notice the error message? It's designed to teach, not just complain. The goal is to help developers (and their AI assistants) understand why it's wrong.

    Example: The Empty Catch Anti-Pattern

    // ❌ AI often generates this
    try {
      await processData(data);
    } catch (e) {
      // TODO: handle error
    }
    

    The no-empty-catch rule catches this:

    63:11  error  Empty catch block silently swallows errors  llm-core/no-empty-catch
    
      Unhandled errors make debugging difficult and can hide critical failures.
      Either handle the error, rethrow it, or log it with context.
    

    Example: Deep Nesting Instead of Early Returns

    // ❌ AI loves nesting
    function processData(data: Data | null) {
      if (data) {
        if (data.items) {
          if (data.items.length > 0) {
            return data.items.map(processItem);
          }
        }
      }
      return [];
    }
    
    // ✅ Early returns are cleaner
    function processData(data: Data | null) {
      if (!data?.items?.length) return [];
      return data.items.map(processItem);
    }
    

    The prefer-early-return rule encourages the flatter pattern.

    The Research Behind the Rules

    Each rule is backed by observed patterns in LLM-generated code:

    RuleBug Pattern Addressed
    no-async-array-callbacksMissing Promise.all, incorrect async flow
    no-empty-catchSilent error swallowing
    no-magic-numbersUnmaintainable constants
    prefer-early-returnDeep nesting, unclear control flow
    prefer-unknown-in-catchany typed catch params
    throw-error-objectsThrowing strings instead of Error instances
    structured-loggingInconsistent log formats
    consistent-exportsMixed default/named exports
    explicit-export-typesMissing return types on public functions
    no-commented-out-codeDead code accumulation

    Full rule documentation: github.com/pertrai1/eslint-plugin-llm-core

    Why Not Just Use typescript-eslint?

    Great question. typescript-eslint is excellent — this plugin is designed to complement it, not replace it.

    The difference is focus:

    typescript-eslinteslint-plugin-llm-core
    FocusTypeScript language correctnessAI coding pattern prevention
    Error messagesTechnical, spec-focusedEducational, context-rich
    Rule designLanguage spec complianceObserved LLM bug patterns

    You should use both. typescript-eslint catches TypeScript-specific issues. llm-core catches patterns that LLMs repeatedly get wrong — regardless of whether they're technically valid TypeScript.

    Getting Started

    npm install -D eslint-plugin-llm-core
    
    // eslint.config.js
    import llmCore from 'eslint-plugin-llm-core';
    
    export default [
      {
        plugins: {
          'llm-core': llmCore,
        },
        rules: {
          ...llmCore.configs.recommended.rules,
        },
      },
    ];
    

    That's it. Zero config for the recommended ruleset.

    The Bigger Picture: Teaching AI Better Habits

    Here's the interesting part: these rules don't just catch mistakes. They teach.

    When your AI assistant sees the error messages:

    Avoid passing async functions to array methods.
    This pattern returns an array of Promises, not the resolved values.
    Consider using Promise.all() or a for...of loop instead.
    

    It learns. Next time, it writes the correct pattern.

    In looped agent workflows — where AI iteratively writes, tests, and fixes code — this feedback loop compounds. Each lint error becomes a teaching moment.

    What's Next

    The plugin is early but functional. Current focus areas:

    • Auto-fixes for fixable rules
    • More logging library detection (Pino, Winston, Bunyan)
    • Additional rules based on ongoing research
    • Evidence gathering on whether rules actually improve AI-generated code quality

    If you're working with AI coding assistants — Cursor, Claude Code, Copilot, or others — I'd love your feedback on what patterns you've seen them get wrong.

    Try It

    npm install -D eslint-plugin-llm-core
    

    GitHub: pertrai1/eslint-plugin-llm-core

    npm: eslint-plugin-llm-core


    Built this? Hate it? Have ideas for rules I missed? Open an issue or reach out. I'm actively looking for contributors who've seen AI write weird code.

    Tags

    typescripteslintaillm

    Comments

    More Blog

    View all
    Context bankruptcy: The case for strategic forgetting for AI Agentsai

    Context bankruptcy: The case for strategic forgetting for AI Agents

    Most of us have seen a coding agent fail to complete a task we know it can do. We just don't...

    J
    James O'Reilly
    Parallel Compliance Engine: Drive-to-Sheets Multi-Agent Orchestrationgooglecloud

    Parallel Compliance Engine: Drive-to-Sheets Multi-Agent Orchestration

    When building Generative AI applications, developers often encounter a massive bottleneck: sequential...

    A
    Aryan Irani
    Is It Ethical to Post and Ask About Circuits on Dev.to?discuss

    Is It Ethical to Post and Ask About Circuits on Dev.to?

    I’ve been thinking about sharing some electronic circuit posts on Dev.to — small circuits, DIY...

    C
    codebunny20
    The One-Click Exporter: AI Studio Antigravity, Probed to Its Limitsagents

    The One-Click Exporter: AI Studio Antigravity, Probed to Its Limits

    What nobody tells you about exporting your multi-agent prototype to a local workspace. Every...

    L
    leslysandra
    Guarding the till while autonomous data agents do the diggingagenticarchitect

    Guarding the till while autonomous data agents do the digging

    Autonomous agents are genuinely good at answering messy business questions. Give one an LLM and a set...

    S
    Sireesha Pulipati
    Return on Attention: Why AI Code Reviews Are Wearing Us Outai

    Return on Attention: Why AI Code Reviews Are Wearing Us Out

    PR volume went up, ticket quality didn't, and the gap got filled with LLMs on both sides of the review: bots reviewing, bots replying, bots occasionally arguing with bots about priorities that only existed in a teammate's head. Our CEO named the actual problem, and it's bigger than code review.

    C
    christine

    Stay up to date

    Get the latest Stable Diffusion prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for Stable Diffusion and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this Stable Diffusion resource

    • Automate WordPress Blog Creation with Google Sheets and AI-Generated Contentmake · Free · Uses make
    • Optimize YouTube uploads with AI-generated descriptions and tags from Dropboxmake · Free · Uses make
    • Streamline YouTube uploads with AI-generated descriptions and tags from Google Drivemake · Free · Uses make
    • Automate Instagram Post Creation with ChatGPT-Generated Captionsmake · Free · Uses make
    Browse all workflows