A code formatter for BrightScript and BrighterScript, a superset of Roku's BrightScript language, written in JavaScript. Current stable version is 1.7.26, with regular releases. It provides CLI and Node API for formatting, supports configurable formatting options via bsfmt.json, and integrates with editor tools. Key differentiators: specifically designed for Roku development, supports BrighterScript syntax, and offers flexibility in formatting rules.
npm install brighterscript-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of formatCode and setFormatterOptions with TypeScript imports.
Set includeCompilerVersion: false in options to restore previous behavior.
Explicitly set keywordCase: 'lower' in bsfmt.json or API options if you want the old default.
Add formatIndent: false to bsfmt.json or API options to skip indentation changes.
Replace format with formatCode in your code.
Use the 'insertFinalNewline' option (if available) to control trailing newline behavior; check documentation for current options.
Always commit or backup files before using --write, or use --check first to preview changes.
Use import { formatCode } from 'brighterscript-formatter'; or if using require, use const { formatCode } = require('brighterscript-formatter');Run npm install brighterscript-formatter --save-dev
Ensure glob patterns are correct, e.g., 'source/**/*.brs' and include extension. Use absolute paths if needed with --absolute flag.