Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Pretty ConstNew to Visual Studio Code? Get it now.
Pretty Const

Pretty Const

bridgerosepetal

|
4 installs
| (0) | Free
Format selected JavaScript const objects using project Prettier config.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Pretty Const

A small VS Code extension for repos where JavaScript const objects live inside templates or mixed-language files.

Marketplace

Install

Open the VS Code command palette with F1, run Extensions: Install Extensions, then search for Pretty Const.

In Jade/Pug files, save the file or run Pretty Const: Format Const to format all unambiguous - const object/array declarations.

You can also run Pretty Const: Format Const on a selection that is either:

- const cards = [{title: 'One', href: '/one'}, {title: 'Two', href: '/two'}]

or just the initializer:

;[
	{ title: 'One', href: '/one' },
	{ title: 'Two', href: '/two' },
]

The extension:

  • formats only selected const declarations or selected object/array initializers;
  • uses the workspace-local prettier package when one exists;
  • loads the project Prettier config via resolveConfig;
  • falls back to the bundled Prettier package with options derived from VS Code editor settings when no project Prettier is found.

No keybinding is registered by default. Add your own VS Code keybinding for prettyConst.format if you want one.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft