steiger-rust
v0.1.0
Published
Fast native Feature-Sliced Design architecture linter
Downloads
173
Maintainers
Readme
Steiger for Rust
A native, Node.js-free rewrite of feature-sliced/steiger: a project-architecture linter for Feature-Sliced Design.
The current implementation follows Steiger 0.6.0 and @feature-sliced/steiger-plugin 0.7.0. It contains the same 20 FSD rules, enables the same 17-rule recommended preset, keeps the familiar CLI flags, and uses Oxc to analyze JavaScript and TypeScript imports.
Quick start
npm install --save-dev steiger-rust
npx steiger ./srcThe npm meta-package downloads only the native package for the current operating system and architecture. That platform package exposes steiger as the Rust executable itself: invoking the CLI does not start Node.js or a JavaScript launcher. npm is only used to install the package.
To build from source instead:
cargo install --path . --locked
steiger ./srcWhen no path is provided, Steiger selects ./src, then ./app, then the current folder.
steiger ./src --watch
steiger ./src --fix
steiger ./src --reporter json
steiger ./src --fail-on-warnings
steiger ./src --baseline ./fsd-errors.json
steiger --list-rulesThe exit code is 1 when errors remain, or when warnings remain together with --fail-on-warnings. Invalid input or configuration returns 2.
Supported platforms
GitHub Releases and npm provide native binaries for:
| Operating system | Architectures | Runtime variant | | --- | --- | --- | | macOS | x64, arm64 | Darwin | | Linux | x64, arm64 | glibc and musl | | Windows | x64, arm64 | MSVC |
Other Rust targets can still be built from source when the dependencies support them.
Validate against existing FSD debt
For gradual migrations, --baseline accepts the checked-in fsd-errors.json format used by Terminal: a JSON object whose keys are rule names and whose values are arrays of paths. Paths are resolved relative to the baseline file.
steiger ./src --baseline ./fsd-errors.json
# --fsd-errors is an alias for --baselineKnown (rule, path) diagnostics are hidden. The command exits with 0 when no new diagnostics appear and 1 when the current result contains a pair absent from the baseline, making it suitable for pre-push hooks and CI. A reduction in existing diagnostics succeeds without rewriting the committed file.
Configuration
The native binary works without a configuration file. It searches the current folder and its parents for steiger.toml, .steiger.toml, steiger.config.toml, steiger.json, .steiger.json, or steiger.config.json.
Example steiger.toml:
global_ignores = ["**/__mocks__/**"]
[rules]
"fsd/no-processes" = "warn"
[[overrides]]
files = ["./src/shared/**"]
[overrides.rules]
"fsd/public-api" = "off"
[[overrides]]
files = ["./src/widgets/**"]
ignores = ["**/discount-offers/**"]
[overrides.rules]
"fsd/no-segmentless-slices" = "off"JSON also accepts a Steiger-style flat array. Rules are built into the binary, so plugin objects are omitted:
[
{ "ignores": ["**/__mocks__/**"] },
{
"files": ["./src/shared/**"],
"rules": { "fsd/public-api": "off" }
}
]Later matching overrides take precedence. A folder diagnostic receives the highest effective severity of the files below that folder, matching upstream Steiger's file-glob behavior.
JavaScript and TypeScript configuration files are intentionally not evaluated: doing that would make the native binary depend on Node.js. Use TOML or JSON, or pass a file explicitly with --config.
Language and module support
- JavaScript, JSX, TypeScript, TSX, MJS, CJS, MTS, and CTS through Oxc
import,import(), andrequire()dependencies- Vue and Svelte
<script>blocks - Astro frontmatter
- relative imports, directory indexes, TypeScript
baseUrl/paths,extends, and project references throughoxc_resolver .gitignore,.ignore,.git,node_modules, and Rusttargetexclusions
Rules
Run steiger --list-rules for the machine-readable list. The recommended preset includes:
fsd/ambiguous-slice-namesfsd/excessive-slicingfsd/forbidden-importsfsd/inconsistent-namingfsd/insignificant-slicefsd/no-layer-public-apifsd/no-public-api-sidestepfsd/no-reserved-folder-namesfsd/no-segmentless-slicesfsd/no-segments-on-sliced-layersfsd/no-ui-in-appfsd/public-apifsd/repetitive-namingfsd/segments-by-purposefsd/shared-lib-groupingfsd/typo-in-layer-namefsd/no-processes
The upstream-compatible split rules fsd/no-cross-imports, fsd/no-higher-level-imports, and fsd/import-locality are available but disabled by default.
Development
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-targets
cargo build --releaseThe npm packaging has a separate integration test. It installs local tarballs and verifies that .bin/steiger resolves directly to a native executable:
cargo build --release
node --test tests/npm_native_cli.mjs
node scripts/prepare-npm-release.mjs --check v0.1.0See CONTRIBUTING.md for pull request guidance and RELEASING.md for the tag-based GitHub/npm release process.
License and upstream relationship
This project is an independent Rust implementation derived from the behavior and tests of the MIT-licensed upstream Steiger project.
Released under the MIT License.
