eslint-fix
TypeScript/ESLint error fix guide, helps AI quickly locate and fix common lint errors, prioritizing auto-fix commands for formatting issues.
When & Why to Use This Skill
This Claude skill provides a specialized TypeScript and ESLint error-fixing guide designed to streamline code quality management and debugging workflows. It empowers AI agents to efficiently locate, prioritize, and resolve linting issues by leveraging automated fix commands and enforcing specific coding standards. By standardizing the error-correction process—from automated formatting to manual syntax optimizations like nullish coalescing—it significantly reduces technical debt and ensures a clean, consistent codebase.
Use Cases
- Automated Code Formatting: Quickly resolving common linting issues such as import ordering, indentation, and trailing commas using CLI-based auto-fix commands.
- TypeScript Syntax Optimization: Guiding the transition to modern coding patterns, such as replacing logical OR operators with nullish coalescing (??) for safer default values.
- Code Style Enforcement: Maintaining high documentation standards by identifying and moving forbidden end-of-line comments to dedicated lines above statements.
- Efficient Error Troubleshooting: Providing a prioritized workflow for AI agents to handle persistent linting errors that cannot be resolved by automated tools alone.
| name | eslint-fix |
|---|---|
| description | TypeScript/ESLint error fix guide, helps AI quickly locate and fix common lint errors, prioritizing auto-fix commands for formatting issues. |
Fix Workflow
Step 1: Run Lint Command
Before manual fixes, MUST run project lint command first:
pnpm lint
These issues are auto-fixed, no manual action needed:
- Import order
- Code formatting
- Whitespace/indentation
- Trailing commas
Step 2: Manually Fix Remaining Errors
Common Fix Rules
undefined Replacement
Use void 0 instead of undefined:
// bad
const value = undefined
// good
const value = void 0
No End-of-Line Comments
Comments MUST be above statements, absolutely forbidden at line end:
// bad
const name = 'test' // this is name
// good
// this is name
const name = 'test'
Nullish Coalescing
Prefer ?? over ||:
// bad
const value = input || 'default'
// good
const value = input ?? 'default'
Config Files
Do NOT modify eslint.config.js or eslint.config.ts unless necessary.
If config issues arise, only suggest modifications to user, do not edit config files directly.
Error Troubleshooting Priority
- Run
pnpm lintfor auto-fix - Check if above rules are violated
- Read specific error messages to locate issues
- If config adjustment needed, suggest user to modify manually