fix-lint-errors

Remove unused variables and imports from JavaScript and TypeScript files.

11|2|Updated Apr 4, 2025
One-click install
npx skills add https://github.com/forcedotcom/apex-language-support --skill fix-lint-errors
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fix-lint-errors
Source: https://github.com/forcedotcom/apex-language-support/tree/main/.cursor/skills/fix-lint-errors
Command: npx skills add https://github.com/forcedotcom/apex-language-support --skill fix-lint-errors

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers eliminate lint errors caused by unused variables, parameters, and imports by removing the unused code rather than suppressing warnings, improving code clarity and preventing compilation or runtime surprises.

Core Features & Use Cases

  • Remove unused variables: Identify and delete variables that are declared but never referenced to satisfy linter rules.
  • Remove unused imports: Clean up module imports that are not used anywhere in the file to avoid import-related lint warnings.
  • Handle parameters and destructured values: Remove unused function parameters and destructured properties when they are genuinely unnecessary, while preserving required signatures for interfaces and callbacks.
  • Use Case: Apply during development, pre-commit checks, code review, or when addressing compilation issues flagged by a linter in TypeScript or JavaScript projects.

Quick Start

Remove unused variables and imports from the target file as suggested by the linter and run npm run lint to confirm the errors are resolved.

Frequently Asked Questions about fix-lint-errors

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix lint errors for unused imports and variables in TypeScript?

To fix lint errors for unused imports and variables in TypeScript, you can remove the unused code rather than suppressing warnings. This improves code clarity and prevents compilation issues by deleting only truly unused declarations.

How do I remove unused variables from JavaScript code without breaking program behavior?

Remove unused variables from JavaScript code by deleting only genuinely unnecessary declarations while preserving required signatures for interfaces and callbacks. This ensures program behavior remains intact while satisfying linter rules during development.

Should I remove unused code or suppress linter warnings during code review?

You should remove unused code rather than suppress linter warnings during code review. Preferring removal over underscore suppression improves code clarity and prevents potential compilation or runtime surprises in your project.

Can I clean up unused destructured properties and function parameters in JavaScript?

Yes, you can clean up unused destructured properties and function parameters in JavaScript. Remove them when they are genuinely unnecessary, while carefully preserving required signatures for interfaces and callbacks to maintain program behavior.

How do I validate code changes after removing unused imports?

To validate code changes after removing unused imports, rerun your project's linter using a command like npm run lint. This confirms that the unused-variable and unused-import warnings are fully resolved without introducing new issues.