@aleph-alpha/prettier-config-frontend

中文文档
2.1.1发布于 2026/08/10Apache-2.0ES Module零依赖近 30 天下载 1.5万

Shared Prettier configuration for Aleph Alpha frontend projects.

原始使用文档
文档目录4 节
  1. Install
  2. Usage
  3. What this config sets
  4. Versioning

@aleph-alpha/prettier-config-frontend

Shared Prettier configuration for Aleph Alpha frontend projects.

Install

pnpm add -D @aleph-alpha/prettier-config-frontend prettier

prettier (>=3.3 <4) is a peer dependency. Install it alongside this package.

Usage

Create a .prettierrc.mjs in your project root:

import config from '@aleph-alpha/prettier-config-frontend';

export default config;

To override individual options, spread and replace:

import config from '@aleph-alpha/prettier-config-frontend';

export default {
  ...config,
  printWidth: 80,
};

What this config sets

OptionValueWhat it does
arrowParens'always'Always wrap arrow function parameters in parentheses, even single ones
bracketSameLinefalseMulti-line HTML/JSX closing brackets go on their own line
bracketSpacingtrueSpaces inside object braces: { foo: bar } not {foo: bar}
endOfLine'lf'Unix-style line endings; protects against Windows CRLF drift
htmlWhitespaceSensitivity'css'Respect each tag's CSS display property when collapsing whitespace
printWidth80Wrap lines at 80 characters
proseWrap'preserve'Don't reflow Markdown prose lines
quoteProps'as-needed'Quote object keys only when required
semitrueAlways end statements with semicolons
singleQuotetrueUse single quotes for strings
tabWidth22 spaces per indentation level
trailingComma'all'Trailing commas everywhere multi-line allows
useTabsfalseUse spaces, not tabs
vueIndentScriptAndStylefalseDon't indent content of <script> and <style> blocks in Vue SFCs

All options are stated explicitly so the config is self-documenting; defaults are not assumed.

Versioning

This package follows semver. Breaking changes (renamed options, removed plugins) bump major; new options or plugins bump minor; everything else patch.

版本与发布记录

@aleph-alpha/prettier-config-frontend 共发布 129 个版本,首次发布于 2025/03/10;过去 12 个月发布了 86 个版本。

版本发布日期距今
2.1.1latest2026/08/102 个月前
2.1.02026/05/115 个月前
2.0.02026/04/306 个月前
1.0.02026/04/296 个月前
0.4.12026/04/296 个月前
0.4.02025/12/1810 个月前

其他发布通道:canary → 0.2.2-canary.6a2fa49c.0。

关于 @aleph-alpha/prettier-config-frontend 的常见问题

@aleph-alpha/prettier-config-frontend 是什么?

Shared Prettier configuration for Aleph Alpha frontend projects.

如何安装 @aleph-alpha/prettier-config-frontend?

在项目目录运行 npm install @aleph-alpha/prettier-config-frontend,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:prettier(>=3.3.0 <4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@aleph-alpha/prettier-config-frontend 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/aleph-alpha__prettier-config-frontend 是否存在。

@aleph-alpha/prettier-config-frontend 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@aleph-alpha/prettier-config-frontend 可以商用吗?

@aleph-alpha/prettier-config-frontend 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aleph-alpha/prettier-config-frontend 的下载量有多少?

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

@aleph-alpha/prettier-config-frontend 还在维护吗?

最新版本 2.1.1 发布于 2026/08/10(2 个月前);至今共发布 129 个版本,其中过去 12 个月发布了 86 个;首次发布于 2025/03/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。