# @anolilab/prettier-config 中文文档

规范地址：https://npmcn.com/package/%40anolilab/prettier-config/

版本：11\.0\.0
npm 元数据更新时间：2026-10-21T19:59:39.585Z
中文译文更新时间：2026-11-06T05:34:59.524Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40anolilab/prettier-config
原文对照：https://npmcn.com/package/%40anolilab/prettier-config/?lang=original
项目主页：https://anolilab.com/nodejs/packages/prettier-config
源码仓库：https://github.com/anolilab/javascript-style-guide

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：46.1 kB，10 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=22\.12\.0 \<=25\.\*
- 运行依赖：0 个
- peer 依赖：prettier 3\.9\.10
- 首次发布：2021-02-15T12:21:53.745Z
- 最新版本发布：2026-10-21T19:59:39.185Z
- 近 30 天下载量：81448（2026-10-06 至 2026-11-04，npm 官方下载统计）
- 已发布版本数：68（近 12 个月 13 个）

## 中文简介

Anolilab 的可共享配置 .

## 安装

```sh
npm install @anolilab/prettier-config
```

也可以使用：`pnpm add @anolilab/prettier-config`、`yarn add @anolilab/prettier-config`、`bun add @anolilab/prettier-config`

## README

[![prettier-config](https://npmcn.com/package/%40anolilab/prettier-config/__assets__/package-og.svg)](https://github.com/anolilab/semantic-release)

### Anolilab 的可共享配置 .

  

[![typescript-image](https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript)](https://www.typescriptlang.org/) [![mit licence](https://img.shields.io/npm/l/@anolilab/prettier-config?style=for-the-badge)](https://github.com/anolilab/javascript-style-guide/blob/main/LICENSE) [![npm downloads](https://img.shields.io/npm/dm/@anolilab/prettier-config?style=for-the-badge)](https://www.npmjs.com/package/@anolilab/prettier-config) [![Chat](https://img.shields.io/discord/902465130518949899.svg?style=for-the-badge)](https://discord.com/invite/4VuvwWGaaB) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge)](https://github.com/anolilab/javascript-style-guide/blob/main/.github/CONTRIBUTING.md)

* * *

Daniel Bannert的开源工作得到了社区的支持 [GitHub 赞助商](https://github.com/sponsors/prisis)

* * *

## 安装

```sh
npm install @anolilab/prettier-config
```

```sh
yarn add @anolilab/prettier-config
```

```sh
pnpm add @anolilab/prettier-config
```

## 使用量

如果你没有 `.prettierrc.js` 或支持的其他文件名和 `.prettierignore`,我们可以在安装后为您创建文件 `@anolilab/prettier-config`电话 `pnpm prettier-config:install`。 。 。 .

> 注意: 如果脚本检测到已有的 `.prettierrc.js` 文件,它不会覆盖它.

\`.prettierrc.js'的文件内容

```js
module.exports = {
    // brackets are required for arrow function parameter, even when there is only one parameter
    arrowParens: "always",
    // spaces are required at the beginning and end of the braces
    bracketSpacing: true,
    // formats quoted code embedded
    embeddedLanguageFormatting: "auto",
    // lf for newline
    endOfLine: "lf",
    // decide whether to break the html according to the display style
    htmlWhitespaceSensitivity: "css",
    // No need to automatically insert @prettier at the beginning of the file
    insertPragma: false,
    // use double quotes instead of single quotes in jsx
    jsxSingleQuote: false,
    // max 160 characters per line
    printWidth: 160,
    // use default break criteria
    proseWrap: "preserve",
    // object's key is quoted only when necessary
    quoteProps: "as-needed",
    rangeEnd: Number.POSITIVE_INFINITY,
    // format the entire contents of the file
    rangeStart: 0,
    // no need to write the beginning @prettier of the file
    requirePragma: false,
    // semicolon at the end of the line
    semi: true,
    // use single quotes
    singleQuote: false,
    // use 4 spaces for indentation
    tabWidth: 4,
    // all comma at the end
    trailingComma: "all",
    // use spaces instead of indentations
    useTabs: false,
    // vue files script and style tags indentation
    vueIndentScriptAndStyle: false,
};
```

## 相关

## 支持的节点.js版本

这一生态系统中的图书馆尽最大努力追踪 [Node.js的释放时间表](https://github.com/nodejs/release#release-schedule)。 。 。 .

这里 [关于为什么我们认为这很重要的文章](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a)。 。 。 .

## 捐款

如果你愿意帮忙看看 [问题清单](https://github.com/anolilab/javascript-style-guide/issues) 看看我们 [捐款](https://npmcn.com/package/%40anolilab/prettier-config/.github/CONTRIBUTING.md) 准则.

> **说明:** 请注意,该项目已连同《协助者行为守则》一起公布。 通过参加这个项目,你同意遵守其条款.

## 贷项

-   [丹尼尔·班纳特](https://github.com/prisis)
    
-   [所有贡献者](https://github.com/anolilab/javascript-style-guide/graphs/contributors)
    

## 在阿诺利拉布制造的

这是一个开源项目,将永远可以自由使用。 如果你觉得很酷. [阿诺利拉布](https://anolilab.com/open-source) 是一个开发与AI工作室。 联系时间: [你好@anolilab.com](mailto:hello@anolilab.com) 如果你需要帮助 这些技术 或者想打个招呼!

## 许可证

Anolilab 更漂亮的配置是开源软件,许可使用 [麻省理工学院](https://opensource.org/licenses/MIT)

## 常见问题

### @anolilab/prettier-config 是什么？

Anolilab 的可共享配置 \.

### 如何安装 @anolilab/prettier-config？

在项目目录运行 npm install @anolilab/prettier-config，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：prettier（3\.9\.10）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @anolilab/prettier-config 支持 TypeScript 吗？

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

### @anolilab/prettier-config 支持 ESM 还是 CommonJS？

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

### @anolilab/prettier-config 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=22\.12\.0 \<=25\.\*。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @anolilab/prettier-config 可以商用吗？

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

### @anolilab/prettier-config 的下载量有多少？

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

### @anolilab/prettier-config 还在维护吗？

最新版本 11\.0\.0 发布于 2026/10/22（15 天前）；至今共发布 68 个版本，其中过去 12 个月发布了 13 个；首次发布于 2021/02/15。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

