FSD Guard for VS Code
Catch Feature-Sliced Design import-rule
violations right in your editor — as you type, before they ever reach a pull request.
FSD Guard checks your imports against the Feature-Sliced Design methodology and
surfaces problems inline: a squiggle on the offending import, a hover that
explains why it's a problem and how to fix it, and quick fixes where a
safe correction exists. No ESLint config, no CI setup — install and go.
This is the editor companion to the FSD Guard browser extension,
which checks the same rules inside GitHub & GitLab Pull/Merge Requests. Both
share the same analysis engine, so results are consistent everywhere.
Features
- Inline diagnostics — violating imports are underlined in
.ts, .tsx,
.js, .jsx files, live as you edit.
- Dedicated sidebar panel — an FSD Guard icon in the Activity Bar opens a
Violations view grouped by file. Expand a finding to read why it's a
problem, how to fix it, open the FSD docs, or jump to the line; filter by
rule, and a badge on the icon shows the total count.
- Explain, don't just flag — hover any finding for why it's a problem,
how to fix it, and a link to the exact FSD docs section.
- Quick fixes — trim a public-API-bypassing deep import down to its index
(
⌘. / Ctrl+.), or jump straight to the docs.
- Scan the whole workspace — one command audits every source file into the
Problems panel.
- Zero-config — import aliases are auto-detected from
tsconfig.json /
jsconfig.json; sensible FSD defaults out of the box.
- Six languages — messages in English, Russian, Ukrainian, German, French
and Italian (follows your VS Code display language).
Rules
| Rule |
What it catches |
| Layer hierarchy |
Importing from a higher layer (entities → features). |
| Slice isolation |
Cross-slice imports within the same layer (auth → cart). |
| Public API |
Deep imports that bypass a slice/segment index. |
@x cross-import |
Misuse of the @x cross-import notation. |
| Import locality (opt-in) |
Absolute aliases used inside your own slice instead of relative paths. |
| Deprecated layers |
Use of the deprecated processes layer. |
Usage
- Open a project that follows Feature-Sliced Design.
- Violations appear automatically in open files and in the Problems panel.
- Hover a squiggle to understand it; press
⌘. / Ctrl+. for quick fixes.
- Run “FSD Guard: Scan whole workspace” from the Command Palette
(
⌘⇧P) to audit the entire project at once.
Commands
| Command |
Description |
FSD Guard: Scan whole workspace |
Audit every source file into the panel. |
FSD Guard: Filter by rule |
Show only selected rule types in the panel. |
FSD Guard: Refresh |
Re-lint all open files. |
FSD Guard: Clear all diagnostics |
Remove all reported violations. |
FSD Guard: Enable / disable |
Toggle the extension for the workspace. |
Settings
All settings live under fsdGuard.* (Settings → Extensions → FSD Guard):
| Setting |
Default |
Description |
fsdGuard.enable |
true |
Turn checking on/off. |
fsdGuard.root |
"src" |
Folder that holds the layers (empty = repo root). |
fsdGuard.aliases |
{ "@": "src", "~": "src" } |
Import aliases → path (merged over tsconfig). |
fsdGuard.useTsconfigPaths |
true |
Auto-detect aliases from tsconfig/jsconfig. |
fsdGuard.layers |
(7 FSD layers) |
Layer definitions { name, rank, sliced }. |
fsdGuard.severity |
"warning" |
error | warning | information | hint. |
fsdGuard.language |
"auto" |
Message language. |
fsdGuard.rules.layerImports |
true |
Layer hierarchy rule. |
fsdGuard.rules.sliceIsolation |
true |
Slice isolation rule (understands @x). |
fsdGuard.rules.publicApi |
true |
Public-API rule. |
fsdGuard.rules.importLocality |
false |
Import-locality rule (opt-in). |
fsdGuard.rules.noDeprecatedLayers |
true |
Warn about processes. |
Example (.vscode/settings.json)
{
"fsdGuard.root": "src",
"fsdGuard.aliases": { "@": "src" },
"fsdGuard.rules.importLocality": true,
"fsdGuard.severity": "warning"
}
How it works
FSD Guard performs fast, static, per-line analysis of import statements — it
never executes your code and sends nothing anywhere. Everything runs locally in
the extension host. It is a heuristic aid, not a substitute for code review.
Support
FSD Guard is free and open-source. If it saves you time, you can support its
development: ☕ Support me.
License
MIT © developer.living