prettier-plugin-perline weekly downloads statistics
By q04515240 · npm · Prettier plugins
Prettier plugin that forces object properties and array elements onto separate lines.
prettier-plugin-perline has 3 recorded weekly downloads on npm, a decrease of 57.1% over the past 30 days, ranking #2243 of 2,322 tracked listings.
About prettier-plugin-perline
prettier-plugin-perline
这是一个 Prettier 插件,用于在满足条件时强制对象和数组按“每行一个成员”进行格式化。
安装
npm i -D prettier-plugin-perline
构建
该包以 dist 目录作为发布产物,发布前请先构建:
npm run build
构建后入口产物为:dist/index.mjs
测试
项目内置了回归测试脚本,用于防止历史 bug(例如箭头函数简写返回对象时丢失圆括号)再次出现。
npm run test:regression
如需执行当前仓库全部测试,可运行:
npm run test
接入方式
在 .prettierrc 的 plugins 中添加:
{
"plugins": ["prettier-plugin-perline"]
}
配置项
objectPerLineMinProperties(数字,默认值:2)- 当对象属性数量大于等于该值时,强制每行一个属性。
arrayPerLineMinElements(数字,默认值:-1)- 当数组元素数量大于等于该值时,强制每行一个元素。
- 设为
-1表示关闭该规则。
htmlMustacheBracketSpacing(布尔值,默认值:true)- 当值为
true时,格式化.html文件中的 Mustache 表达式时会规范为{{ msg }}形式。 - 当值为
false时,不会执行该 Mustache 空格规则。
- 当值为
特殊规则:当文件名命中
.*rc、*.jsonc、*.json时,若未显式覆盖上述两个选项,则插件会自动按1处理,从而强制“一个字段一行 / 一个元素一行”。
HTML Mustache 空格规则
当格式化 .html 文件时,若命中 Mustache 插值表达式,插件会统一规范为双大括号内两侧各保留一个空格。
<div>{{msg}}</div>
会被格式化为:
<div>{{ msg }}</div>
如需关闭该规则,可在配置中设置:
{
"htmlMustacheBracketSpacing": false
}
示例(JSON/JSONC/RC 强制单成员分行)
{
"overrides": [
{
"files": [".*rc", "*.jsonc"],
"options": {
"parser": "jsonc"
}
},
{
"files": ["*.json"],
"options": {
"parser": "json"
}
}
]
}
源码目录:src/(包含入口 src/index.mjs)。
Description from the npm listing.
- prettier
- prettier-plugin
- object
- array
- format
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-perline 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-perline. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.