prettier-plugin-sieve weekly downloads statistics
By jaiew · npm · Prettier plugins
Prettier plugin for Sieve email filtering scripts (RFC 5228)
prettier-plugin-sieve has 4 recorded weekly downloads on npm, a decrease of 50.0% over the past 30 days, ranking #2211 of 2,322 tracked listings.
About prettier-plugin-sieve
prettier-plugin-sieve
A Prettier plugin for formatting Sieve email filtering scripts (RFC 5228).
Features
- Formats
.sieve/.sivfiles via Prettier - Hand-rolled Peggy.js PEG grammar for RFC 5228 core language
- Supports:
require,if/elsif/else, all standard tests (address,header,envelope,allof,anyof,not,size,exists,true,false), all standard actions (fileinto,redirect,keep,discard,stop,reject,vacation,addflag,setflag,removeflag) - Idempotent — formatting twice gives the same result
- Works with Prettier 3.x
- IntelliJ IDEA + VS Code Prettier extension compatible
Installation
npm install --save-dev prettier prettier-plugin-sieve
Configuration
.prettierrc
{
"plugins": ["prettier-plugin-sieve"]
}
VS Code (settings.json)
{
"prettier.documentSelectors": ["**/*.sieve", "**/*.siv"],
"[sieve]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
}
IntelliJ IDEA
Go to Settings → Languages & Frameworks → JavaScript → Prettier:
- Enable "Run on save"
- Add
**/*.sieveto the "Run for files" glob
Usage
# Format all .sieve files
npx prettier --write "**/*.sieve"
# Check formatting without writing
npx prettier --check "**/*.sieve"
Example
Input (messy):
require ["fileinto","reject","vacation"];
if anyof(header :contains "Subject" "URGENT",address :is "From" "boss@example.com"){fileinto "Priority";}
elsif header:contains "Subject" "[SPAM]"{discard;}
else{keep;}
Output (formatted):
require ["fileinto", "reject", "vacation"];
if anyof (
header :contains "Subject" "URGENT",
address :is "From" "boss@example.com"
) {
fileinto "Priority";
} elsif header :contains "Subject" "[SPAM]" {
discard;
} else {
keep;
}
Project Structure
prettier-plugin-sieve/
├── src/
│ ├── index.ts # Plugin entry: languages, parsers, printers
│ ├── types.ts # Full TypeScript AST node interfaces
│ ├── printer.ts # Prettier Doc builder / printer
│ └── parser/
│ ├── index.ts # parse(), locStart(), locEnd() exports
│ └── sieve.pegjs # Peggy PEG grammar for RFC 5228
├── tests/
│ └── format.test.ts # Jest end-to-end formatting tests
├── package.json
└── tsconfig.json
Architecture
1 · Grammar (src/parser/sieve.pegjs)
A Peggy PEG grammar that directly encodes RFC 5228 syntax. Each grammar rule returns a typed AST node with a loc (source location) property. The grammar is compiled at runtime the first time parse() is called (or can be pre-compiled via npm run generate-parser for production builds).
2 · Parser adapter (src/parser/index.ts)
Wraps Peggy's parse() to:
- Return a
Scriptroot node - Expose
locStart/locEndso Prettier can attach comments - Surface grammar errors with human-readable messages
3 · Printer (src/printer.ts)
Converts the Sieve AST into Prettier's Doc IR using the doc.builders API:
| Doc primitive | Where used |
|---|---|
hardline | Between top-level commands and block contents |
softline | Inside string lists, test argument lists |
group | All commands and tests — allows line-breaking when over printWidth |
indent | Block bodies, multi-line list arguments |
join | Comma-separated string lists and test lists |
Building
# Compile TypeScript → dist/
npm run build
# Optionally pre-compile the Peggy grammar to JS for faster startup
npm run generate-parser
Testing
npm test
Extending
To add support for Sieve extensions (e.g. RFC 5232 sieve-imap-flags, RFC 5230 vacation):
- Add new rules to
src/parser/sieve.pegjs - Add new AST interfaces to
src/types.ts - Add
casebranches toprintAction/printTestinsrc/printer.ts
License
MIT
Description from the npm listing.
- prettier
- prettier-plugin
- sieve
- filter
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 (122)Similar npm Prettier plugins plugins
All 20 prettier-plugin-sieve 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-sieve. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.