@btmills/prettier

中文文档
3.3.3发布于 2024/07/29MITTypeScriptESM + CJS零依赖近 30 天下载 1.5万

Pretier 是一个有观点的代码

中文使用文档
文档目录8 节
  1. 使用量
  2. 释放
  3. 预览代码
  4. 介绍
  5. 投入
  6. 产出
  7. 徽标
  8. 捐款

:叉 和 刀:这是叉.

比较 prettier, (中文(简体) ), @btmills/prettier 将二进制运算符移动到长表达式中的新行开头,而不是上行的结尾。 就是这样.

// prettier:
const before =
  bom.length >= 2 &&
  ((bom.charCodeAt(0) === 0xff && bom.charCodeAt(1) === 0xfe) ||
    (bom.charCodeAt(0) === 0xfe && bom.charCodeAt(1) === 0xff));

// @btmills/prettier:
const after =
  bom.length >= 2
  && ((bom.charCodeAt(0) === 0xff && bom.charCodeAt(1) === 0xfe)
    || (bom.charCodeAt(0) === 0xfe && bom.charCodeAt(1) === 0xff));

使用量

使用别名安装( I)无, (中文(简体) ), 线条所以,这样 require('prettier') 透明地决定了这个分叉:

npm install --save-dev prettier@npm:@btmills/prettier
yarn add --dev prettier@npm:@btmills/prettier

此软件包将像 prettier,编辑集成器应该用它来当真.

释放

叉套件的放出是通过重置 line-before-operator 在最近版本标签上方的分支 main。 。 。 .

# Get the latest changes and update the main branch:
git checkout main
git pull
git push fork

# Rebase the release branch on the latest version:
git checkout line-before-operator
git rebase x.y.z

# Fix conflicts as necessary.
git rebase --continue
# There will be a merge conflict in `yarn.lock`. To resolve it:
yarn && yarn dedupe && yarn dedupe --check
# If any conflicts in snapshots, discard and update automatically:
yarn test -u

# With rebasing done, run tests, push tags, build, and publish:
yarn run lint
yarn test
git tag x.y.z-fork
git push --force-with-lease
git push --tags
yarn run build
yarn run test:dist
cd dist
npm publish

Prettier Banner

预览代码

Java 脚本 类型脚本 流动 联合来文X • JSON
支助科 • 常设委员会 减
HTML 语言 · 韦 角 角
图QL 降级 - 也门
你最喜欢的语言?

Github Actions Build Status Github Actions Build Status Github Actions Build Status Codecov Coverage Status Blazing Fast
npm version weekly downloads from npm code style: prettier Follow Prettier on Twitter

介绍

Pretier是一个有观点的代码 对于物质。 它通过解析你的代码并用自己的规则重新打印来执行一个一致的样式,这些规则考虑到了最大行长,必要时会包接代码.

投入

foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());

产出

foo(
  reallyLongArg(),
  omgSoManyParameters(),
  IShouldRefactorThis(),
  isThereSeriouslyAnotherOne(),
);

Pretier 可以运行 在编辑器中 保存,在一个 承诺前钩,或在 CI 环境 保证你的代码库有一致的风格 不再让devs在代码审查上贴出一首非选评论!


文档

安装 • 妇女 选项 • 妇女 国 际 • 妇女 API 密码

游戏场


徽标

向世界展示你的用法 高级 → code style: prettier

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

捐款

见 捐款额。 。 。 .

版本与发布记录

@btmills/prettier 共发布 65 个版本,首次发布于 2018/11/02;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.3.3latest2024/07/292 年前
3.3.22024/07/292 年前
3.3.12024/07/292 年前
3.3.02024/07/292 年前
3.2.52024/02/262 年前
3.2.42024/02/012 年前

关于 @btmills/prettier 的常见问题

@btmills/prettier 是什么?

Pretier 是一个有观点的代码

如何安装 @btmills/prettier?

在项目目录运行 npm install @btmills/prettier,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 prettier,可以用 npx prettier 直接运行。

@btmills/prettier 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@btmills/prettier 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@btmills/prettier 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=14。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@btmills/prettier 可以商用吗?

@btmills/prettier 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@btmills/prettier 的下载量有多少?

根据 npm 官方下载统计,@btmills/prettier 在 2026/10/09 – 2026/11/07 这 30 天内被下载 15,112 次,日均约 504 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@btmills/prettier 还在维护吗?

最新版本 3.3.3 发布于 2024/07/29(2 年前);至今共发布 65 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/11/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。