---
title: "How to Fix ESLint Violations with AI Assistance"
description: "An LLM can produce correct fixes for ESLint violations once it has tools that supply minimal, precise context."
url: "https://swe.quest/articles/how-to-fix-eslint-violations-with-ai-assistance-74d040edadf71958"
canonical: "https://www.docker.com/blog/how-to-fix-eslint-violations-with-ai-assistance/"
source: "Docker"
published: "2024-08-26"
difficulty: "medium"
kind: "Research"
reading_minutes: 8
tags: ["ai-coding","ai-agents","static-analysis","typescript","llms"]
---

# How to Fix ESLint Violations with AI Assistance

A post on [Docker](https://swe.quest/sources/docker.md), published 2024-08-26, 8 min read, Research. Original: [https://www.docker.com/blog/how-to-fix-eslint-violations-with-ai-assistance/](https://www.docker.com/blog/how-to-fix-eslint-violations-with-ai-assistance/)

## Summary

An LLM can produce correct fixes for ESLint violations once it has tools that supply minimal, precise context. ESLint's JSON output for even 100 violations exceeds 10,000 characters, so the full report is written to an ephemeral Docker volume and read through condensed or per-file parse tools rather than passed through the model's context. A Dockerized Tree-sitter tool then fetches the AST node and surrounding code for a given line. Violations are grouped by whether they need source context and human supervision. The agent fixed individual violations such as floating promises and unused vars, but it would not loop through multiple violations unless each prompt named a specific rule.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Static analysis](https://swe.quest/tags/static-analysis.md) (Engineering practices)
- [TypeScript](https://swe.quest/tags/typescript.md) (Languages)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- ESLint
- LLM tool calling ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- abstract syntax trees

## Keywords

ESLint, Tree-sitter, Docker, Docker Labs GenAI, TypeScript

## Related posts

- [Adding the ESLint Tool to an AI Assistant: Improving Recommendations for JS/TS Projects](https://swe.quest/articles/adding-the-eslint-tool-to-an-ai-assistant-improving-recommendations-for-js-ts-d83ca2ba37ac984c.md): Docker · 2024-08-12 · Medium · 7 min read · AI for coding, Static analysis, JavaScript, TypeScript, Containers
  An AI assistant gets better at linting JavaScript and TypeScript projects when it is given ESLint tooling instead of relying on the LLM's built-in knowledge.
- [Using Docker AI Tools for Devs to Provide Context for Better Code Fixes](https://swe.quest/articles/using-docker-ai-tools-for-devs-to-provide-context-for-better-code-fixes-c0163de9f3027f93.md): Docker · 2024-10-21 · Medium · 8 min read · AI for coding, AI agents, Static analysis, Containers, Python
  LLMs fix lint violations far better when given the surrounding code, so Docker Labs built a prompt-driven pipeline where each step runs in a container: Pylint produces a violation report, violations are loaded into SQLite, and Tree-sitter parses the project into an AST whose top-level statement ranges are indexed alongside the source.
- [Using an AI Assistant to Script Tools](https://swe.quest/articles/using-an-ai-assistant-to-script-tools-714a1e238504d1ea.md): Docker · 2024-10-07 · Medium · 5 min read · AI agents, Sandboxing & isolation, Containers, LLMs
  Instead of feeding large datasets like Pylint violation JSON through an LLM to transform them into SQL INSERT statements, the assistant can be prompted to write a JavaScript program that performs the transformation, then run it through a tool call.
- [Publish a lint rule, get a prize](https://swe.quest/articles/publish-a-lint-rule-get-a-prize-2ae3e207b85c2da6.md): Deno · 2025-02-25 · Medium · 4 min read · Static analysis, TypeScript, Developer tools, JavaScript
  Deno 2.2 adds a plugin system for \`deno lint\`, letting anyone write custom lint rules in TypeScript using either an ESLint-style AST visitor API or CSS-like node selectors, with types under the \`Deno.lint\` namespace.
- [Fixing security vulnerabilities with AI](https://swe.quest/articles/fixing-security-vulnerabilities-with-ai-6cf393c64f079c26.md): GitHub Engineering · 2024-02-14 · Medium · 10 min read · AI for coding, Static analysis, Application security, LLMs, Evaluation
  Copilot Autofix turns CodeQL security alerts into LLM-suggested fixes by building a prompt from the query help, the alert message, and code snippets along the data-flow path.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
