LWC Space CleanerA VS Code extension that safely removes trailing spaces and converts leading indentation
spaces → tabs only in Lightning Web Component Author: Monoranjan Choudhury Why it is safeJavaScript is not Apex — whitespace can be part of a string's value. This extension is JS-aware: a line is only modified when its leading/trailing whitespace is in code context. Lines inside template literals, block comments or strings are never touched, so string values can never change. Features
Settings (
|
| Setting | Default | Meaning |
|---|---|---|
enabledOnSave |
true |
Clean LWC .js automatically on save. |
tabSize |
4 |
Spaces treated as one tab level. |
convertLeadingSpacesToTabs |
true |
Convert leading spaces to tabs on safe lines. |
removeTrailingSpaces |
true |
Remove trailing spaces on safe lines. |
showSaveNotification |
true |
Show a notification when a clean runs. |
logEverySave |
true |
Log every save to the output channel. |
feedbackWhenNoChange |
true |
Show the table + notification even when nothing changed. |
Install from the .vsix
- Extensions view → ⋮ → Install from VSIX... → pick
lwc-space-cleaner-1.0.0.vsix. - Reload Window, then open any LWC
.js.
Build / package
npm install
npm run compile
npm run package # → lwc-space-cleaner-1.0.0.vsix