ESLint Plugin for AI Coding Mistakes

AI writes code that aces tests but bombs in production. One dev dissected 500 mistakes and forged an ESLint plugin to stop them cold.

500 AI Code Flubs Analyzed: The ESLint Plugin That Actually Fixes Them — theAIcatchup

Key Takeaways

  • AI code fails on edges despite passing tests; eslint-plugin-llm-core catches 20 key patterns.
  • Rules like no-async-array-callbacks teach fixes, improving future AI outputs.
  • Pair with typescript-eslint for full coverage — it's the new dev workflow essential.

Ever wonder why your AI-generated code sails through tests, only to choke spectacularly in production?

That’s the trap. eslint-plugin-llm-core just stepped in to spring it.

I dug into this after spotting the original post — a gritty analysis of 500 AI coding mistakes, distilled into 20 razor-sharp ESLint rules. Not fluffy best practices. Patterns LLMs regurgitate like clockwork: async map callbacks that spit out Promise graveyards, empty catch blocks gobbling errors whole, pyramids of ifs begging for early returns.

Look. LLMs crush syntax. They ace unit tests. But edge cases? Consistency? Those vanish. Studies back it: 15% miss corners, 20% misread prompts, 40%+ skip code blocks entirely.

The creator didn’t stop at griping. Built eslint-plugin-llm-core. Installs clean with npm, pairs with typescript-eslint like peanut butter and jelly — one’s spec cop, this one’s AI whisperer.

Why Do AI Coders Keep Screwing Up Async?

Take this classic:

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

It looks golden. Tests green. Then boom — array of Promises, not values. Production laughs last.

The plugin’s no-async-array-callbacks rule nails it:

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.

Educational, right? Not just “fix this.” Tells why, nudges to Promise.all. Next AI prompt? It remembers — or at least mimics better.

But here’s my angle, the one the original skips: this echoes the 1990s static analysis boom. Back then, tools like lint tamed human spaghetti code, slashing bugs 30-50% in shops like Microsoft. Now? LLMs are the sloppy interns. eslint-plugin-llm-core is their first real supervisor. Ignore it, and you’re betting farm on AI hype without the harness.

Does eslint-plugin-llm-core Beat TypeScript Linting Alone?

Short answer: yes, because it targets LLM pathologies.

typescript-eslint owns type safety, spec nitpicks. This? Observed idiocies. Empty catches (no-empty-catch). Magic numbers (no-magic-numbers). Throwing strings, not Errors (throw-error-objects). Deep nests screaming for prefer-early-return.

Rule LLM Bug It Slays
no-async-array-callbacks Promise array disasters
no-empty-catch Error black holes
prefer-early-return If-hell pyramids
no-magic-numbers Crypto-debugging hell
prefer-unknown-in-catch any-typed catches hiding sins

Twenty rules total. Recommended config? Zero fuss. Drop into eslint.config.js, done.

And the messages — they’re gold. “Unhandled errors make debugging difficult and can hide critical failures.” Developers read that, grok it. AI sees it in context, iterates.

Skeptical? Fair. LLMs evolve fast. But data doesn’t lie: PromptHub’s 558-snippet study, 333-bug teardown — patterns persist. This plugin? Empirical armor.

Production war stories abound. Silent failures from swallowed exceptions cost hours, days. Inconsistent exports tangle modules. Commented-out dead code? Refactor rot.

My bold call: within a year, every AI dev stack bundles this. GitHub Copilot shops first — or regret it when outages spike.

How Bad Are These AI Mistakes, Really?

Bad enough to table it.

Missing nulls. Generic vars like ‘data’ everywhere. Structured logging? Ha, AI spits console.logs willy-nilly.

One gem: prefer-unknown-in-catch. Catches ‘catch(e: any)’, pushes ‘unknown’ for safer handling. LLMs default sloppy.

Install snippet’s dead simple:

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, }, }, ];

Boom. Lint your AI slop, watch red lines teach.

Critique time — and it’s mild. Original post hypes “hundreds” from studies, but tables show slices. Still, reproducible. GitHub repo’s live: github.com/pertrai1/eslint-plugin-llm-core. Fork it, test your codebase. Bet it lights up.

Unique twist: this isn’t anti-AI. It’s pro-reality. LLMs hit 80% acceptance in code reviews now (per GitHub stats), but 20% bugs sneak through. This plugin? That 20% firewall.

Teams ignoring it risk the next Knight Capital — $460M glitch from unchecked code. AI amps volume; lint amps quality.


🧬 Related Insights

Frequently Asked Questions

What is eslint-plugin-llm-core?

ESLint plugin with 20 rules targeting common AI/LLM coding errors like async map misuse and empty catches.

How do you install eslint-plugin-llm-core?

npm install -D eslint-plugin-llm-core, then add to eslint.config.js with llmCore.configs.recommended.

Does eslint-plugin-llm-core replace typescript-eslint?

No — complements it. typescript-eslint for types, this for AI-specific patterns.

Aisha Patel
Written by

Former ML engineer turned writer. Covers computer vision and robotics with a practitioner perspective.

Frequently asked questions

What is eslint-plugin-llm-core?
ESLint plugin with 20 rules targeting common AI/LLM coding errors like async map misuse and empty catches.
How do you install eslint-plugin-llm-core?
npm install -D eslint-plugin-llm-core, then add to eslint.config.js with llmCore.configs.recommended.
Does eslint-plugin-llm-core replace typescript-eslint?
No — complements it. typescript-eslint for types, this for AI-specific patterns.

Worth sharing?

Get the best AI stories of the week in your inbox — no noise, no spam.

Originally reported by dev.to

Stay in the loop

The week's most important stories from theAIcatchup, delivered once a week.