npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@holoscript/formatter

v2.1.0

Published

Code formatting tool for HoloScript (.holo) and HoloScript+ (.hsplus) files

Readme

@holoscript/formatter

Code formatting tool for HoloScript (.holo) and HoloScript+ (.hsplus) files.

Features

  • Indentation normalization - Consistent indentation with spaces or tabs
  • Brace style enforcement - Same-line, next-line, or Stroustrup brace style
  • Whitespace cleanup - Remove trailing spaces, normalize blank lines
  • Trailing comma handling - None, all, or multi-line only
  • Import sorting - Alphabetically sorted imports
  • Check mode - Verify files without modifying them
  • Configurable - JSON config file support

Installation

pnpm add @holoscript/formatter

CLI Usage

# Format and print to stdout
holoscript-format src/scene.holo

# Format directory recursively
holoscript-format src/

# Format and write to file
holoscript-format --write src/

# Check if files are formatted (exit 1 if not)
holoscript-format --check src/

# Use custom config file
holoscript-format --config .holoscriptrc src/

# Quiet mode (suppress output)
holoscript-format --quiet --write src/

Programmatic Usage

import { HoloScriptFormatter, format, check, createFormatter } from '@holoscript/formatter';

// Create formatter with custom config
const formatter = new HoloScriptFormatter({
  indentSize: 2,
  useTabs: false,
  maxLineLength: 100,
  braceStyle: 'same-line',
  trailingComma: 'multi-line',
  bracketSpacing: true,
  sortImports: true
});

// Format code
const result = formatter.format(code, 'holo');

console.log(result.formatted);      // Formatted code
console.log(result.changed);        // true if code was modified
console.log(result.errors);         // Array of formatting errors

// Check if formatted (returns boolean)
const isFormatted = formatter.check(code, 'holo');

// Convenience functions (use default config)
const result2 = format(code, 'hsplus');
const isFormatted2 = check(code, 'holo');

// Create formatter with factory function
const customFormatter = createFormatter({ indentSize: 4 });

Configuration

Create a .holoscriptrc, .holoscriptrc.json, or holoscript.config.json:

{
  "indentSize": 2,
  "useTabs": false,
  "maxLineLength": 100,
  "braceStyle": "same-line",
  "trailingComma": "multi-line",
  "bracketSpacing": true,
  "semicolons": false,
  "singleQuote": false,
  "sortImports": true,
  "maxBlankLines": 1,
  "blankLineBeforeComposition": true
}

Options

| Option | Default | Description | |--------|---------|-------------| | indentSize | 2 | Spaces per indent level | | useTabs | false | Use tabs instead of spaces | | maxLineLength | 100 | Maximum line length | | braceStyle | "same-line" | Brace style: "same-line", "next-line", "stroustrup" | | trailingComma | "multi-line" | Trailing commas: "none", "multi-line", "all" | | bracketSpacing | true | Spaces inside brackets [ 1, 2, 3 ] | | semicolons | false | Add semicolons (HSPlus) | | singleQuote | false | Use single quotes | | sortImports | true | Sort import statements alphabetically | | maxBlankLines | 1 | Maximum consecutive blank lines | | blankLineBeforeComposition | true | Blank line before composition blocks |

Examples

Before

composition "Example"{
template "Enemy"{
state{health:100}
action attack(target){target.health-=10}
}
spatial_group "Main"{
object "Goblin" using "Enemy"{position:[0,0,5]}
}}

After

composition "Example" {
  template "Enemy" {
    state { health: 100 }
    action attack(target) { target.health -= 10 }
  }

  spatial_group "Main" {
    object "Goblin" using "Enemy" { position: [ 0, 0, 5 ] }
  }
}

VSCode Integration

The formatter integrates with the HoloScript VSCode extension:

  1. Format on save: Enable editor.formatOnSave
  2. Format selection: Select code and press Shift+Alt+F
  3. Format document: Press Shift+Alt+F with no selection

Prettier Plugin

For projects using Prettier, use the Prettier plugin:

pnpm add prettier-plugin-holoscript
// .prettierrc
{
  "plugins": ["prettier-plugin-holoscript"],
  "overrides": [
    {
      "files": ["*.holo", "*.hsplus"],
      "options": {
        "parser": "holoscript"
      }
    }
  ]
}

License

Elastic License 2.0 - See LICENSE for details.