indent-doctor
v1.0.0
Published
A simple tool to analyze file indentation (tabs/spaces) built with Bun
Maintainers
Readme
indent-doctor
A simple tool to analyze file indentation (tabs/spaces) built with Bun.
Requirements: This package requires Bun runtime to be installed.
Features
- Detects tabs, spaces, and mixed indentation
- Automatically determines space indent size
- Supports Biome and VSCode configuration output formats
- Supports reading from stdin
- English output messages for international use
Installation
First, make sure you have Bun installed:
# Install Bun (if not already installed)
curl -fsSL https://bun.sh/install | bash
# Install indent-doctor globally
bun install -g indent-doctor
# Or use with bunx (no installation needed)
bunx indent-doctorUsage
Local Development
# Analyze file indentation
bun run src/cli/index.ts src/index.ts
# Output in Biome format
bun run src/cli/index.ts -f biome src/index.ts
# Output in VSCode format
bun run src/cli/index.ts -f vscode src/index.ts
# Read from stdin
cat src/index.ts | bun run src/cli/index.ts
# Direct execution is also possible
./src/cli/index.ts --helpUsing with bunx
# Analyze file indentation
bunx indent-doctor src/index.ts
# Output in Biome format
bunx indent-doctor -f biome src/index.ts
# Output in VSCode format
bunx indent-doctor -f vscode src/index.tsUsing after global installation
# Analyze file indentation
indent-doctor src/index.ts
# Output in Biome format
indent-doctor -f biome src/index.ts
# Output in VSCode format
indent-doctor -f vscode src/index.tsOutput Formats
Default Format
Provides detailed analysis with statistics and recommendations:
=== Indent Analysis Results ===
Indent Type: Spaces
Indent Size: 2 spaces
--- Statistics ---
Total Lines: 10
Indented Lines: 8
- Spaces: 8 lines
- Tabs: 0 lines
- Mixed: 0 lines
--- Recommendations ---
✅ Indentation is consistent using Spaces.Biome Format (-f biome)
Outputs Biome configuration JSON:
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto"
}
}VSCode Format (-f vscode)
Outputs VSCode settings JSON:
{
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.detectIndentation": false
}Development
Run tests:
bun testDocumentation
License
MIT
