Skip to content

commandCode quality

Fix Lint Errors

Runs your linter, applies only safe fixes, then lists every remaining finding with a reason so nothing is silenced by accident.

npx workspacetemplates add fix-lint --tool claude-code

Writes 1 file to .claude/commands/

.claude/commands/fix-lint.md14 lines · 1.1 KBFile
---
description: Runs your linter, applies only safe fixes, then lists every remaining finding with a reason so nothing is silenced by accident.
argument-hint: "[path or leave empty for whole project]"
---

Fix lint problems in: $ARGUMENTS (whole project if empty).

1. Find the project's linter from package.json scripts, pyproject.toml, .golangci.yml or CI config. Use its own command, not a different tool. Run it first and record the count of errors and warnings.
2. Apply the tool's safe autofix only (for example `eslint --fix`, `ruff check --fix`). Do not use unsafe-fix flags.
3. Fix remaining findings by hand only when the change cannot alter behavior: unused imports and variables, missing await, wrong types in an annotation. Read the surrounding code before each edit.
4. Never add disable comments, loosen rules or edit the lint config to make errors vanish.
5. Re-run the linter and the test command. If tests fail, revert the last change and list it instead.

Report: before and after counts, the files changed, and a table of leftover findings with rule, location and why it needs a decision. Do not commit.

What it does

Lint cleanups go wrong when a tool is told to fix everything and starts changing behavior or adding disable comments. This command separates mechanical fixes from findings that need a human decision.

It runs the linter your project already configures, checks that fixes did not break the tests, and leaves the judgment calls in a short list.

Example

you › /fix-lint src/

agent › Before: 43 errors, 12 warnings. After: 5 errors, 0 warnings. Tests pass (212).
Left for you:
- src/api/user.ts:57 no-floating-promises: the call may be fire-and-forget on purpose.
- src/ui/Table.tsx:19 react-hooks/exhaustive-deps: adding the dependency re-fetches on every render.

Questions

Will it add eslint-disable comments?
Never. A finding it cannot fix safely goes on the leftover list.
Does it commit the result?
No. Review the diff and commit yourself.
  • Add Error Handling

    CommandCode quality

    Free
  • Add Logging

    CommandCode quality

    Free
  • Add Types

    CommandCode quality

    Free
  • Extract Function

    CommandCode quality

    Free