script-utils/nano-staged-config
Shared nano-staged configuration for pre-commit hooks.
Functions
Section titled “Functions”| Function | Description |
|---|---|
| getNanoStagedConfig | Resolves the nano-staged configuration to use, honoring a per-developer opt-out. Loads a gitignored .env if present (via Node’s own process.loadEnvFile, so it behaves the same on every platform and shell), then — when NANO_STAGED is set to an off value (0, false, off, or no) — prints a notice and exits the process successfully so the pre-commit checks are skipped. This mirrors husky’s own HUSKY=0 switch, but scoped to the nano-staged step (so the commit-msg hook still runs). Otherwise it returns obsidianDevUtilsConfig. This is a function rather than module-level code so importing the package barrel never triggers the .env read or the process exit; call it from the thin scripts/nano-staged-config.ts entry. |
Variables
Section titled “Variables”| Variable | Description |
|---|---|
| obsidianDevUtilsConfig | Nano-staged configuration that runs file-based lint, format, and spellcheck on staged files. Only includes tools that can operate on individual files. Whole-project checks (TypeScript compilation, unit tests) are left to CI. Commands use npm run ... -- so nano-staged file paths are forwarded as CLI arguments. |