prettier-plugin-sh weekly downloads statistics
By un-ts (5 listings) · npm · Prettier plugins
An opinionated `shellscript` formatter plugin for Prettier, also support simple format of `Dockerfile`, `properties`, `gitignore`, `dotenv`, `hosts`, `jvmoptions`...
prettier-plugin-sh has 428,004 recorded weekly downloads on npm, a decrease of 3.3% over the past 30 days, ranking #419 of 3,247 tracked listings.
About prettier-plugin-sh
prettier-plugin-sh

An opinionated
shellscriptformatter plugin for [Prettier][], also support simple format ofDockerfile,properties,gitignore,dotenv,hosts,jvmoptions...
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing, taking various rules into account.
This plugin adds support for various file formats through [mvdan-sh][] via [sh-syntax][] and [dockerfmt][].
Notice
This plugin is still under development, its printer just wraps [mvdan-sh][]'s default printer with powered by [sh-syntax][]. Of course it should just work, but may not match [prettier][]'s format sometimes.
[!WARNING]
ignorefiles are not officially supported by [mvdan-sh][] what means only basic and simpleignoreusage cases can be handled correctly. We cannot do much on our side. See also https://github.com/un-ts/prettier/issues/336.
Requirements
prettier-plugin-sh is an evergreen module. 🌲 This module requires an LTS Node version (v16.0.0+).
Install
Using npm:
# npm
npm i -D prettier prettier-plugin-sh
# yarn
yarn add -D prettier prettier-plugin-sh
Usage
Once installed, Prettier plugins must be added to .prettierrc:
{
"plugins": ["prettier-plugin-sh"]
}
Then:
# npx
npx prettier --write script.sh
# yarn
yarn prettier --write script.sh
Parser Options
interface ShOptions {
// parser
/**
* KeepComments makes the parser parse comments and attach them to nodes, as
* opposed to discarding them.
*/
keepComments?: boolean
/**
* LangVariant describes a shell language variant to use when tokenizing and
* parsing shell code. The zero value is [LangBash].
*/
variant?: LangVariant
/**
* StopAt configures the lexer to stop at an arbitrary word, treating it as if
* it were the end of the input. It can contain any characters except
* whitespace, and cannot be over four bytes in size.
*
* This can be useful to embed shell code within another language, as one can
* use a special word to mark the delimiters between the two.
*
* As a word, it will only apply when following whitespace or a separating
* token. For example, StopAt("$$") will act on the inputs "foo $$" and
* "foo;$$", but not on "foo '$$'".
*
* The match is done by prefix, so the example above will also act on "foo
* $$bar".
*/
stopAt?: string
/**
* RecoverErrors allows the parser to skip up to a maximum number of errors in
* the given input on a best-effort basis. This can be useful to tab-complete
* an interactive shell prompt, or when providing diagnostics on slightly
* incomplete shell source.
*
* Currently, this only helps with mandatory tokens from the shell grammar
* which are not present in the input. They result in position fields or nodes
* whose position report [Pos.IsRecovered] as true.
*
* For example, given the input
*
* (foo |
*
* The result will contain two recovered positions; first, the pipe requires a
* statement to follow, and as [Stmt.Pos] reports, the entire node is
* recovered. Second, the subshell needs to be closed, so [Subshell.Rparen] is
* recovered.
*/
recoverErrors?: number
/**
* KeepComments makes the parser parse comments and attach them to nodes, as
* opposed to discarding them.
*
* @default true
*/
keepComments: boolean
/**
* LangVariant describes a shell language variant to use when tokenizing and
* parsing shell code. The zero value is [LangBash].
*/
variant: LangVariant
/**
* StopAt configures the lexer to stop at an arbitrary word, treating it as if
* it were the end of the input. It can contain any characters except
* whitespace, and cannot be over four bytes in size.
*
* This can be useful to embed shell code within another language, as one can
* use a special word to mark the delimiters between the two.
*
* As a word, it will only apply when following whitespace or a separating
* token. For example, StopAt("$$") will act on the inputs "foo $$" and
* "foo;$$", but not on "foo '$$'".
*
* The match is done by prefix, so the example above will also act on "foo
* $$bar".
*/
stopAt: string
/**
* RecoverErrors allows the parser to skip up to a maximum number of errors in
* the given input on a best-effort basis. This can be useful to tab-complete
* an interactive shell prompt, or when providing diagnostics on slightly
* incomplete shell source.
*
* Currently, this only helps with mandatory tokens from the shell grammar
* which are not present in the input. They result in position fields or nodes
* whose position report [Pos.IsRecovered] as true.
*
* For example, given the input
*
* (foo |
*
* The result will contain two recovered positions; first, the pipe requires a
* statement to follow, and as [Stmt.Pos] reports, the entire node is
* recovered. Second, the subshell needs to be closed, so [Subshell.Rparen] is
* recovered.
*/
recoverErrors: number…
Description from the npm listing.
- dockerfile
- ini
- properties
- sh
- shell
- shellscript
- plugin
- prettier
- prettier-plugin
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm Prettier plugins plugins
All 20 prettier-plugin-sh alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/prettier-plugin-sh. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.