Run linting and fix code quality issues
Runs linting and automatically fixes code quality issues across the codebase.
/plugin marketplace add citadelgrad/scott-claude-code/plugin install scott-claude-code@scott-ccclaude-sonnet-4-5misc/Run linting and fix code quality issues in the codebase.
$ARGUMENTS
JavaScript/TypeScript
# ESLint
npm run lint
npx eslint . --fix
# TypeScript Compiler
npx tsc --noEmit
# Prettier (formatting)
npx prettier --write .
Python
# pylint
pylint src/
# flake8
flake8 src/
# black (formatting)
black src/
# mypy (type checking)
mypy src/
Go
# golangci-lint
golangci-lint run
# gofmt (formatting)
gofmt -w .
# go vet
go vet ./...
Rust
# cargo clippy
cargo clippy --fix
# rustfmt (formatting)
cargo fmt
Other Languages
Type Safety Errors (where applicable)
any/untyped data structures usedCode Quality
Best Practices
Framework-Specific (adapt to your framework)
Safe Auto-Fixes
# Formatting (most languages have formatters)
# ESLint auto-fix
eslint --fix .
# Black (Python)
black src/
# gofmt (Go)
gofmt -w .
# rustfmt (Rust)
cargo fmt
Manual Fixes Needed
ESLint Config (.eslintrc.json for JS/TS)
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": "error",
"no-console": "warn"
}
}
Prettier Config (.prettierrc for JS/TS)
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}
pyproject.toml (Python - Black, pylint, etc.)
[tool.black]
line-length = 100
target-version = ['py39']
[tool.pylint]
max-line-length = 100
golangci.yml (Go)
linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
High Priority (fix immediately)
Medium Priority (fix before commit)
Low Priority (fix when convenient)
Install pre-commit hooks (adapt to your setup)
# For Node.js projects
npm install -D husky lint-staged
npx husky init
# For Python projects
pip install pre-commit
pre-commit install
# For Go projects
# Use git hooks directly or tools like pre-commit
Configure (adapt to your language/tools)
# .husky/pre-commit (Node.js)
npx lint-staged
# .pre-commit-config.yaml (Python)
repos:
- repo: local
hooks:
- id: black
name: black
entry: black
language: system
types: [python]
lint-staged config (package.json for JS/TS)
{
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
]
}
}
VSCode Settings (.vscode/settings.json)
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}
Remove Unused Imports
# Before
from lib import A, B, C
# After
from lib import A, C # B was unused
Add Type Annotations
# Before
def process(data):
return data.map(x => x.value)
# After
def process(data: List[DataItem]) -> List[int]:
return [x.value for x in data]
Fix Missing Keys (React/Vue)
// Before
{items.map(item => <div>{item.name}</div>)}
// After
{items.map(item => <div key={item.id}>{item.name}</div>)}
Focus on fixes that improve code quality and prevent bugs. Run linting before every commit. Use the linters and formatters appropriate for your language and framework.