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-salesforce

v0.1.0

Published

Prettier plugin for Salesforce Apex, metadata XML, Visualforce, Aura, and LWC template files.

Readme

prettier-plugin-salesforce

Prettier plugin for Salesforce Apex, Visualforce, Aura, LWC templates, and Salesforce metadata XML.

Site and playground: https://mattsimonis.github.io/prettier-plugin-salesforce/

Install

pnpm add -D prettier prettier-plugin-salesforce

Use the matching command for npm or Yarn if your project uses one of those package managers.

Configure

Add the plugin to .prettierrc:

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

Format Salesforce source:

pnpm prettier --write "force-app/**/*"

Check formatting in CI:

pnpm prettier --check "force-app/**/*"

Do not set a top-level parser in a shared Prettier config. Use targeted overrides only when a file family needs a parser forced.

Supported files

| Surface | Files | | ------------------------------------- | ---------------------------------------------------------------------------------------- | | Apex | .cls, .trigger, anonymous .apex files | | Visualforce | .page, .component | | Aura markup | .cmp, .intf, .tokens, .evt, .design, .auradoc, Aura .app | | LWC templates | .html files under an lwc path segment | | LWC, Aura, and static resource assets | Delegated JS, TS, CSS, JSON, YAML, Markdown, and HTML text assets | | Salesforce metadata XML | *-meta.xml, .labels, known metadata family suffix files, and metadata XML paths | | Salesforce payload text | .email, .resource, .asset, .forceignore, and known Salesforce payload text paths |

The plugin owns Salesforce paths only. Ordinary project files stay with Prettier core, another plugin, or no parser.

Options

| Option | Default | Use | | -------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | salesforceSortLabelsByFullName | false | Sort <labels> blocks in CustomLabels metadata by nested <fullName>. | | salesforceFinalNewline | true | Print one trailing newline at the end of Salesforce-formatted files. | | salesforceTestVisiblePlacement | "own-line" | Print Apex @TestVisible on its own line. Use "inline" to keep it with the declaration. | | salesforceBlankLineBeforeLineComment | false | Add an empty line before standalone Apex // comments, except first comments in a block and comments directly after block comments. | | salesforceLogicalOperatorPosition | "end-of-line" | Put wrapped Apex logical operators at the end of the previous line. Use "start-of-line" for leading operators. |

Example:

{
  "plugins": ["prettier-plugin-salesforce"],
  "printWidth": 120,
  "salesforceSortLabelsByFullName": false,
  "salesforceLogicalOperatorPosition": "end-of-line"
}

Parser overrides

Most projects should let Prettier infer parsers. If your repo has broad parser overrides, put Salesforce-specific overrides later so they win:

{
  "plugins": ["prettier-plugin-salesforce"],
  "overrides": [
    { "files": "**/*-meta.xml", "options": { "parser": "html" } },
    {
      "files": ["**/*-meta.xml", "**/*.labels", "**/*.labels-meta.xml"],
      "options": { "parser": "salesforce-metadata-xml" }
    }
  ]
}

Available parser names:

| Parser | Use | | --------------------------- | ------------------------------------------------------------------------------------------- | | salesforce-apex | Apex classes and triggers. | | salesforce-apex-anonymous | Anonymous Apex scripts. | | salesforce-markup | Visualforce and Aura markup. | | salesforce-metadata-xml | Salesforce metadata XML and metadata suffix files. | | salesforce-router-by-path | Path-aware router for shared extensions such as .html, .md, .xml, .svg, and .app. |

Config audit APIs

The package exports helpers for finding risky Prettier overrides in Salesforce workspaces. The source repository also has a local audit:configs script for maintainers.

Programmatic APIs

import { routeFile } from "prettier-plugin-salesforce";
import { auditPrettierConfig } from "prettier-plugin-salesforce/config-audit";
import { scanPrettierConfigAuditReports } from "prettier-plugin-salesforce/config-audit/scan";
  • routeFile(filePath) returns the Salesforce route for a path.
  • auditPrettierConfig(config) reports risky parser overrides.
  • scanPrettierConfigAuditReports(root) scans a workspace tree.

For repository development, release checks, playground use, and deep routing notes, see the project README and docs/ directory.