Keeps your .tf files clean with three automatic checks.
What it checks
1. Empty lines at the start of a file
If your .tf file begins with one or more blank lines before any content, those lines are flagged. Terraform files should start immediately with content.
2. Empty lines at the end of a file
More than one trailing blank line at the end of a .tf file is flagged. One trailing newline is fine (it's standard), anything beyond that gets a warning.
3. Consecutive empty lines
Two or more blank lines in a row anywhere in a .tf file are flagged. One blank line for spacing is fine — you never need two.
4. Unused locals
Any local defined in locals.tf that is never referenced as local.<name> in any other .tf file in your workspace gets flagged directly on the definition line.
Installation
Option A — Install the .vsix directly
Download tf-linter-1.0.0.vsix
Open VS Code
Ctrl+Shift+P → Extensions: Install from VSIX...
Select the file
Option B — Run from source
Clone / copy the tf-linter folder
Open it in VS Code
Press F5 — this opens an Extension Development Host with the extension active
Usage
The extension runs automatically whenever you open or edit a .tf file. All issues appear in:
The Problems panel (Ctrl+Shift+M)
As yellow squiggly underlines in the editor
You can also manually trigger the unused locals check from the Command Palette:
Ctrl+Shift+P → TF Linter: Check Unused Locals in Workspace
Settings
Setting
Default
Description
tfLinter.enableEmptyLineChecks
true
Toggle empty line warnings
tfLinter.enableUnusedLocalsCheck
true
Toggle unused locals warnings
Notes
The unused locals check compares locals.tf against all other .tf files in the workspace. It uses the pattern local.<name> so it won't false-positive on variable names that happen to match.
The check respects currently open (unsaved) files — it reads from VS Code's in-memory buffer, not just disk.
The extension activates on any workspace containing .tf files, so you don't need to open a .tf file first.