Instructions for Linting and Fixing Code Issues
Objective
Run bun check to identify linting errors and warnings, then fix ALL issues using idiomatic solutions. Do NOT disable rules, ignore warnings, or suppress errors.
Step-by-Step Process
1. Initial Lint Check
bash
bun check
- •Run this command in the project root
- •Carefully read and document ALL errors and warnings
- •Note the file paths, line numbers, and specific rule violations
2. Analyze Each Issue
For each error or warning:
- •Understand WHY the linter is flagging this issue
- •Research the idiomatic/best practice solution for this specific problem
- •Consider the broader codebase context when determining the fix
3. Fix Issues Idiomatically
Common Fixes and Their Idiomatic Solutions:
Unused Variables
- •Remove genuinely unused variables
- •If needed later, implement the functionality now
- •For intentionally unused parameters, use underscore prefix:
_unusedParam
Missing Type Annotations
- •Add explicit type annotations
- •Use proper TypeScript types, not
any - •Define interfaces/types for complex objects
Formatting Issues
- •Apply the project's formatting rules
- •Maintain consistent indentation, spacing, and line breaks
- •Follow the style guide implied by the linter configuration
Import/Export Issues
- •Use proper import syntax for the module system
- •Remove unused imports
- •Organize imports logically (external deps, then internal)
Async/Await Issues
- •Add
awaitfor Promise-returning functions - •Mark functions as
asyncwhen usingawait - •Handle Promise rejections properly with try/catch
Null/Undefined Handling
- •Add proper null checks
- •Use optional chaining (
?.) and nullish coalescing (??) - •Initialize variables that might be undefined
4. Verification Process
After fixing each file:
- •Run
bun checkagain to verify the specific file is clean - •Test that your changes haven't broken functionality
- •Ensure no new warnings were introduced
5. Final Validation
Once all issues are addressed:
bash
bun check
- •Should return with zero errors and zero warnings
- •If any issues remain, repeat the fix process
Important Guidelines
DO:
- •Fix the root cause of each issue
- •Maintain code functionality while fixing style issues
- •Follow the project's established patterns
- •Add meaningful variable names when renaming
- •Properly handle edge cases exposed by linter warnings
- •Add error handling where the linter indicates it's missing
- •Use type-safe solutions
DO NOT:
- •Add
// eslint-disablecomments - •Add
@ts-ignoreor@ts-expect-errorcomments - •Change linter configuration to hide issues
- •Use
anytype to bypass TypeScript errors - •Remove functionality to satisfy the linter
- •Ignore warnings thinking they're not important
Example Fixes
Bad (Suppressing):
javascript
// eslint-disable-next-line no-unused-vars const data = fetchData();
Good (Fixing):
javascript
const data = fetchData(); processData(data); // Actually use the variable
Bad (Ignoring):
typescript
// @ts-ignore const result = someFunction(wrongType);
Good (Fixing):
typescript
const result = someFunction(correctType as ExpectedType); // Or better: fix the type at its source
Success Criteria
The task is complete when:
- •
bun checkreturns with exit code 0 - •No errors or warnings are reported
- •All fixes follow idiomatic patterns
- •Code functionality is preserved or improved
- •No lint rules have been disabled or ignored
Remember: Every warning and error exists for a reason. Your job is to understand that reason and address it properly, not to silence the linter.