en un clic
linter-agent
Linter Agent. Use when relevant to this domain.
Menu
Linter Agent. Use when relevant to this domain.
Code Agent. Use when relevant to this domain.
Deploy Agent. Use when relevant to this domain.
Planning Agent. Use when relevant to this domain.
Research Agent. Use when relevant to this domain.
Review Agent. Use when relevant to this domain.
Browser automation with AI — Playwright, Puppeteer, browser-use library. Navigate, extract, interact with web pages autonomously
| name | linter-agent |
| description | Linter Agent. Use when relevant to this domain. |
| domain | agents |
Autonomous linting agent that detects and fixes code style violations, enforces project conventions, and ensures consistent formatting across the codebase. This agent works in bulk -- fix everything, not just the file you touched.
code-agent)refactor-agent)code-agent)security-agent)perf-agent)Follow these steps in order. Each step builds on the previous one.
Find and read the project's linting setup:
# Common config files
cat .eslintrc.json # ESLint (JS/TS)
cat .eslintrc.js # ESLint (JS/TS)
cat eslint.config.js # ESLint flat config
cat prettier.config.js # Prettier
cat .flake8 # Python
cat pyproject.toml # Python (ruff, black, isort)
cat setup.cfg # Python
cat .golangci.yml # Go
cat .rubocop.yml # Ruby
cat .stylelintrc.json # CSS/SCSS
# Check package.json for scripts
cat package.json | jq '.scripts | with_entries(select(.key | test("lint|format|check")))'
If no configuration exists, set it up based on the project's tech stack.
Run all linters to understand the scope of issues:
# JavaScript/TypeScript
npx eslint . --ext .ts,.tsx,.js,.jsx
npx prettier --check .
# Python
ruff check . # Fast linter (replaces flake8, isort, etc.)
ruff format --check .
# OR
flake8 .
black --check .
isort --check-only .
# Go
golangci-lint run ./...
# TypeScript type checking
tsc --noEmit
# CSS/SCSS
npx stylelint "**/*.css"
Analyze the output:
## Lint Diagnostic Summary
- **Total violations**: [count]
- **Auto-fixable**: [count] (can be fixed automatically)
- **Manual fix needed**: [count] (requires code changes)
- **By rule**:
- rule-name: count (description)
- rule-name: count (description)
Apply auto-fixes for all fixable violations:
# ESLint auto-fix
npx eslint . --fix --ext .ts,.tsx,.js,.jsx
# Prettier auto-format
npx prettier --write .
# Python auto-fix
ruff check --fix .
ruff format .
# Go
golangci-lint run --fix ./...
After auto-fix, re-run to see remaining issues:
# Check what is left
npx eslint . --ext .ts,.tsx,.js,.jsx 2>&1 | tail -5
For issues that cannot be auto-fixed, fix them one rule at a time:
## Manual Fix Strategy
1. Group remaining violations by rule
2. Fix the most impactful rule first (unused imports, then type errors, then style)
3. For each rule:
- Understand why the rule exists
- Find all occurrences
- Apply consistent fix
- Re-run linter to verify
Common Manual Fixes:
// unused imports -- remove them
// BEFORE:
import { useState, useEffect, useMemo, useRef } from 'react';
// AFTER (if only useState and useEffect are used):
import { useState, useEffect } from 'react';
// any types -- add proper types
// BEFORE:
const data: any = fetchSomething();
// AFTER:
const data: UserResponse = fetchSomething();
// unused variables -- remove or prefix with underscore
// BEFORE:
const [data, setData, options] = useState();
// AFTER:
const [data, _setData, options] = useState();
When a rule does not fit the project, configure it explicitly:
## Rule Decision Framework
1. Is this a real issue? -> Fix it
2. Is this a false positive? -> Configure exception
3. Is this a style preference? -> Add to prettier/format config
4. Does this rule conflict with project patterns? -> Disable with comment explaining why
## Disabling Rules (last resort)
Disable rules only when the pattern is intentional and documented.
# ESLint: disable for specific line
// eslint-disable-next-line no-console -- logging is intentional here
console.log('Debug info');
# Python: noqa
import unused_module # noqa: F401 -- needed for monkey-patching
# TypeScript: ignore specific error
// @ts-expect-error -- third-party type mismatch, see issue #123
const result = legacyFunction(input);
Prevent lint violations from being committed:
# Install husky + lint-staged (Node.js)
npm install -D husky lint-staged
npx husky init
echo "npx lint-staged" > .husky/pre-commit
# package.json
{
"lint-staged": {
"*.{ts,tsx,js,jsx}": ["eslint --fix", "prettier --write"],
"*.{css,scss}": ["prettier --write"],
"*.py": ["ruff check --fix", "ruff format"]
}
}
Reference configurations for common linter setups.
// .eslintrc.json
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"no-console": ["warn", { "allow": ["warn", "error"] }],
"prefer-const": "error",
"no-var": "error"
}
}
# pyproject.toml
[tool.ruff]
line-length = 100
target-version = "py311"
[tool.ruff.lint]
select = ["E", "F", "W", "I", "N", "UP", "B", "A", "SIM", "TCH"]
ignore = ["E501"] # line length handled by formatter
[tool.ruff.lint.isort]
known-first-party = ["myapp"]
| Rationalization | Reality |
|---|---|
| "Lint rules are annoying, disable them" | Rules exist because that pattern caused real bugs. Disable the rule only if you understand why and document the exception. |
| "I will fix lint in a separate PR" | Lint debt compounds. Fix it now while context is fresh. A separate PR means a separate review, separate merge conflicts, separate risk. |
| "Auto-formatting changes too many lines" | Consistent formatting reduces cognitive load for every future reader. The git blame noise is a one-time cost. |
| "This rule does not apply to my code" | If it truly does not, configure the exception explicitly with a comment. "I do not want to" is not a valid reason. |
| "Linting is not real engineering" | Linting catches bugs, prevents security issues, and enforces consistency. It is engineering hygiene. |
| "The codebase is too messy to lint" | That is exactly when you need it most. Start with auto-fixable rules, then tackle manual fixes progressively. |
eslint-disable at file level without justification)ignore rules instead of fixing the underlying issueAfter linting, confirm:
--fix returns zero changes)eslint-disable or # noqa without a comment explaining why