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

prettier-plugin-flatbuffers

v0.2.0

Published

Prettier plugin that formats FlatBuffers (.fbs) schemas via the flatbuffers-format engine.

Readme

prettier-plugin-flatbuffers

If you use Prettier, this plugin gives you canonical FlatBuffers schema formatting with no extra commands. It's a thin shim over flatbuffers-format — same output, same guarantees, just Prettier-routed. Install it, add it to your .prettierrc, and .fbs files start formatting alongside everything else your editor already touches.

Install

npm i -D prettier prettier-plugin-flatbuffers flatbuffers-format

flatbuffers-format is a regular runtime dependency, so npm will pull it in for you — the third entry above is just for clarity in your package.json.

Activate

.prettierrc:

{
  "plugins": ["prettier-plugin-flatbuffers"]
}

That's it. Any .fbs file Prettier sees from then on is formatted by this plugin.

npx prettier --write 'src/**/*.fbs'

Editor integrations (VS Code, Neovim, etc.) pick up the plugin automatically as long as Prettier itself does.

Behavior

If a .flatbuffers-format.json applies to the file (the nearest one in its directory or any parent), the plugin uses it and ignores Prettier's options below, so Prettier formats exactly as the flatbuffers-format CLI and the other editor plugins do. See the config file docs.

Without one, the plugin maps Prettier's options to flatbuffers-format's FormatOptions:

| Prettier option | Effect | |----------------------------|---------------------------------------------------------------------------------| | tabWidth (default 2) | Forwarded as the engine's indent (count of indent characters per level). | | useTabs (default false)| One tab per indent level, as in Prettier; tabWidth then only sets how wide a tab looks in your editor. | | printWidth (default 80)| Forwarded as the engine's lineWidth. Drives the "does it fit on one line" decision for small enums/unions/single-field bodies and for line-comment wrapping. | | trailingComma (default "all") | "all" and "es5" put a comma after the last value of an expanded enum or union; "none" leaves it off. | | bracketSpacing (default true) | { A, B } or {A, B} for bodies on one line. | | objectWrap (default "preserve") | "preserve" keeps a body expanded when the source has a line break after its {; "collapse" puts every body that fits on one line. | | endOfLine | Handled by Prettier itself ("lf", "crlf", "cr", "auto"). The engine always emits \n; Prettier post-processes the output to the requested line ending. | | requirePragma, checkIgnorePragma, insertPragma | Work as in Prettier: the pragmas are @format / @prettier and @noformat / @noprettier in a comment at the top of the file. |

A .flatbuffers-format.json with requirePragma: true should not be combined with Prettier's insertPragma: true. Prettier inserts the pragma before the plugin can read the config file, so every file gets formatted. Set requirePragma in Prettier's own config instead, or drop insertPragma.

// prettier-ignore above a declaration keeps it as written. Other Prettier options (singleQuote, semi, …) are ignored, as .fbs has no syntax for them.

How it works

Prettier 3 plugins normally define a parse function that builds an AST and a print function that turns it back into a Doc tree. That's the right shape when the formatter is of Prettier, not just plugged into it. Here, the canonical form is defined entirely by flatbuffers-format, so we use Prettier's preprocess hook to run format() on the source. The text Prettier's printer receives is already canonical; the printer just returns it verbatim. No AST round-tripping, no risk of drift between the engine and a duplicated Prettier-side implementation.

For everything about the formatting rules themselves (idempotency guarantees, what's preserved, what's normalized, comment handling, the cookbook of before/after examples) see the flatbuffers-format README.

Development setup

Inside the monorepo, the flatbuffers-format dependency is wired to the sibling project via a relative file: install:

"dependencies": {
  "flatbuffers-format": "file:../flatbuffers-formatter"
}

That means the sibling must be built first:

cd flatbuffers-formatter && npm ci && npm run build
cd ../prettier-plugin-flatbuffers && npm ci && npm run build && npm test

When this plugin is published to npm, the file: reference will be swapped for a pinned ^0.1 range against the published flatbuffers-format package.

Releases

Releases are automated via release-please. Land a Conventional Commit on main → a release PR appears → merging it tags and publishes.

License

MIT. See LICENSE.