LWC & Aura Smart Cleaner
A Visual Studio Code extension for cleaning Salesforce Aura and Lightning Web Components (LWC) JavaScript files.
Features
- Automatically removes console statements when saving files.
- Removes supported
console.* methods.
- Removes
console.memory property statements.
- Removes
debugger; statements.
- Removes standalone debugger comments.
- Converts every four leading spaces into a tab.
- Removes trailing whitespace.
- Removes consecutive blank lines.
- Generates detailed cleanup reports.
- Provides function/method-wise character size reports.
- Supports cleaning the current file or the entire workspace.
Supported Console Methods
- support for all console method
Supported Components
Aura
- Controller JavaScript
- Helper JavaScript
- Renderer JavaScript
- Other JavaScript files inside Aura component folders
LWC
- Component JavaScript files
- Other JavaScript files inside LWC component folders
Available Commands
| Command |
Description |
lwcAuraSmartCleaner.removeCurrentFile |
Clean the currently open file |
lwcAuraSmartCleaner.removeWorkspace |
Clean all Aura/LWC JavaScript files in the workspace |
lwcAuraSmartCleaner.showOutput |
Display the cleaner Output panel |
Automatic Cleanup
The extension automatically processes supported Aura and LWC JavaScript files when they are saved.
Cleanup Report
The Output panel displays:
- Component Type
- File Name
- Console Statements Removed
- Debugger Statements Removed
- Total Items Removed
- Characters Before and After
- Leading Spaces Converted
- Tabs Inserted
- Trailing Whitespace Removed
- Excess Blank Lines Removed
- Whitespace Characters Removed
- Total Characters Removed
- Function / Method Wise Size
- Total JavaScript File Size
Function / Method Wise Size
Aura: Calculates method body size for methods using:
methodName: function (...) { ... }
LWC: Calculates method body size for:
- Class methods
- Getters and setters
- Named functions
- Block-bodied arrow functions
Opening { and closing } braces are excluded from the character count.
Workspace Cleanup
The extension searches for JavaScript files inside Aura and LWC directories, asks for confirmation, and processes the matching files.
The workspace summary displays:
- Files scanned
- Files changed
- Total items removed
- Console statements removed
- Debugger statements removed
- Whitespace cleanup statistics
- Failed files
Output Channel
Output channel name:
LWC & Aura Smart Cleaner
Important Notes
- Only standalone console/debugger statements are removed.
- Strings, template literals, and comments are skipped during code scanning.
- Only the listed console methods are supported.
- Workspace cleanup requires user confirmation.
- Review changes using source control before publishing.
Changelog
See the CHANGELOG.md file shipped inside this project folder.
License
This project can be distributed under the MIT License.
Developed for Salesforce LWC and Aura Developers
Extension Name: LWC % Aura Smart Cleaner
Primary Purpose: LWC & Aura Code Cleanup and Automatic Technical Documentation Generation.