migrate-oxfmt by oxc-project/oxc
npx skills add https://github.com/oxc-project/oxc --skill migrate-oxfmt此技能将指导您将 JavaScript/TypeScript 项目从 Prettier 或 Biome 迁移到 Oxfmt。
Oxfmt 是一个高性能、兼容 Prettier 的代码格式化工具。大多数 Prettier 选项都直接支持。
oxfmt 内置了一个自动化迁移工具,支持将 Prettier 和 Biome 作为迁移源。
npx oxfmt@latest --migrate prettier
这将:
.oxfmtrc.json.prettierignore 中的模式迁移到 ignorePatternsprettier-plugin-tailwindcss 选项迁移到 sortTailwindcssprettier-plugin-packagejson 并启用 广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
sortPackageJsonnpx oxfmt@latest --migrate biome
这将:
biome.json 或 biome.jsonc.oxfmtrc.jsonfiles.includes 中的否定模式迁移到 ignorePatternsformatter.* 和 javascript.formatter.*)映射到 oxfmt 选项Biome 选项映射:
| Biome | oxfmt |
|---|---|
formatter.indentStyle ("tab"/"space") | useTabs (true/false) |
formatter.indentWidth | tabWidth |
formatter.lineWidth | printWidth |
javascript.formatter.quoteStyle | singleQuote |
javascript.formatter.jsxQuoteStyle | jsxSingleQuote |
javascript.formatter.quoteProperties ("asNeeded") | quoteProps ("as-needed") |
javascript.formatter.trailingCommas | trailingComma |
javascript.formatter.semicolons ("always"/"asNeeded") | semi (true/false) |
javascript.formatter.arrowParentheses ("asNeeded") | arrowParens ("avoid") |
formatter.bracketSameLine | bracketSameLine |
formatter.bracketSpacing | bracketSpacing |
formatter.attributePosition ("multiline") | singleAttributePerLine (true) |
注意事项(两种源):
.oxfmtrc.json 已存在,则迁移会失败。如需重新运行,请先删除它。.oxfmtrc.json。overrides 都无法自动迁移,必须手动转换。迁移后,请检查生成的 .oxfmtrc.json 中的以下关键差异:
Prettier 和 Biome 的默认值是 80,oxfmt 的默认值是 100。如果您的源配置中未指定,迁移工具会设置 printWidth: 80。请决定是保留 80 还是采用 100。
这些 Prettier 选项在迁移过程中会被跳过:
| 选项 | 状态 |
|---|---|
endOfLine: "auto" | 不支持。请明确使用 "lf" 或 "crlf" |
experimentalTernaries | 在 JS/TS 文件中尚不支持 |
experimentalOperatorPosition | 在 JS/TS 文件中尚不支持 |
在 oxfmt 中默认启用,但迁移工具会禁用它,除非检测到 prettier-plugin-packagejson。请检查您是否希望启用此功能。
注意:Oxfmt 的排序算法与 prettier-plugin-packagejson 不同。
嵌入式语言格式化(例如 CSS-in-JS)通常有效,但某些格式化可能与 Prettier 不同。
overrides 字段无法从 Prettier 或 Biome 自动迁移。请手动转换:
{
"overrides": [
{
"files": ["*.md"],
"options": { "tabWidth": 4 }
}
]
}
Oxfmt 不支持嵌套配置文件(例如,子目录中的单独 .oxfmtrc.json)。如果您的项目使用了按目录的 Prettier 或 Biome 配置,请使用带有文件通配符模式的 overrides 来合并它们,或者在不同的工作目录下为每个目录单独运行 oxfmt。
这些选项直接转移,行为相同:tabWidth, useTabs, semi, singleQuote, jsxSingleQuote, quoteProps, trailingComma, arrowParens, bracketSpacing, bracketSameLine, endOfLine, proseWrap, htmlWhitespaceSensitivity, singleAttributePerLine, vueIndentScriptAndStyle
Oxfmt 提供了 Prettier 不具备的功能:
对 import 语句进行排序,灵感来源于 eslint-plugin-perfectionist/sort-imports(默认禁用):
{
"sortImports": {
"partitionByNewline": true,
"newlinesBetween": false
}
}
替代 prettier-plugin-tailwindcss。使用重命名的选项自动迁移:
| Prettier(顶级) | oxfmt (sortTailwindcss.*) |
|---|---|
tailwindConfig | config |
tailwindStylesheet | stylesheet |
tailwindFunctions | functions |
tailwindAttributes | attributes |
tailwindPreserveWhitespace | preserveWhitespace |
tailwindPreserveDuplicates | preserveDuplicates |
| 选项 | 默认值 | 描述 |
|---|---|---|
insertFinalNewline | true | 是否在文件末尾添加一个空行 |
sortPackageJson | true | 对 package.json 的键进行排序。设置 { "sortScripts": true } 以同时对 scripts 进行排序 |
将格式化命令替换为 oxfmt:
# 之前(Prettier)
npx prettier --write .
npx prettier --check .
# 之前(Biome)
npx biome format --write .
npx biome check .
# 之后
npx oxfmt@latest
npx oxfmt@latest --check
| Prettier / Biome | oxfmt |
|---|---|
prettier --write . / biome format --write . | oxfmt (默认:cwd, --write 模式) |
prettier --check . / biome check . | oxfmt --check |
prettier --list-different . | oxfmt --list-different |
prettier --config path | oxfmt --config path |
prettier --ignore-path .prettierignore | oxfmt --ignore-path .prettierignore |
| `cat file | prettier --stdin-filepath=file.ts` |
npx oxfmt 时).editorconfig 以获取 useTabs、tabWidth、endOfLine、insertFinalNewline 和 printWidth。.oxfmtrc.json 中的选项优先级更高。npx oxfmt@latest --check 在 CI 中强制执行格式化。oxfmt --lsp 以通过语言服务器协议进行编辑器集成。.oxfmtrc.json 中添加 "$schema": "./node_modules/oxfmt/configuration_schema.json" 以获得编辑器自动补全。npx oxfmt@latest --init 以创建一个默认的 .oxfmtrc.json,无需迁移。每周安装量
438
代码仓库
GitHub 星标数
20.3K
首次出现
2026年3月6日
安全审计
已安装于
github-copilot430
gemini-cli427
codex427
cursor427
kimi-cli426
amp426
This skill guides you through migrating a JavaScript/TypeScript project from Prettier or Biome to Oxfmt.
Oxfmt is a high-performance, Prettier-compatible code formatter. Most Prettier options are supported directly.
An automated migration tool is built into oxfmt, supporting both Prettier and Biome as migration sources.
npx oxfmt@latest --migrate prettier
This will:
.oxfmtrc.json with migrated options.prettierignore patterns to ignorePatternsprettier-plugin-tailwindcss options to sortTailwindcssprettier-plugin-packagejson and enable sortPackageJsonnpx oxfmt@latest --migrate biome
This will:
biome.json or biome.jsonc.oxfmtrc.json with migrated optionsfiles.includes to ignorePatternsformatter.* and javascript.formatter.*) to oxfmt optionsBiome option mapping:
| Biome | oxfmt |
|---|---|
formatter.indentStyle ("tab"/"space") | useTabs (true/false) |
formatter.indentWidth | tabWidth |
formatter.lineWidth |
Notes (both sources):
.oxfmtrc.json already exists. Delete it first if you want to re-run..oxfmtrc.json instead.overrides cannot be auto-migrated for either source and must be converted manually.After migration, review the generated .oxfmtrc.json for these key differences:
Prettier and Biome default is 80, oxfmt default is 100. The migration tool sets printWidth: 80 if not specified in your source config. Decide whether to keep 80 or adopt 100.
These Prettier options are skipped during migration:
| Option | Status |
|---|---|
endOfLine: "auto" | Not supported. Use "lf" or "crlf" explicitly |
experimentalTernaries | Not supported in JS/TS files yet |
experimentalOperatorPosition | Not supported in JS/TS files yet |
Enabled by default in oxfmt, but the migration tool disables it unless prettier-plugin-packagejson was detected. Review whether you want this enabled.
Note: Oxfmt's sorting algorithm differs from prettier-plugin-packagejson.
Embedded language formatting (e.g., CSS-in-JS) generally works, but some formatting may differ from Prettier.
The overrides field cannot be auto-migrated from either Prettier or Biome. Convert manually:
{
"overrides": [
{
"files": ["*.md"],
"options": { "tabWidth": 4 }
}
]
}
Oxfmt does not support nested configuration files (e.g., a separate .oxfmtrc.json in a subdirectory). If your project used per-directory Prettier or Biome configs, consolidate them using overrides with file glob patterns, or run oxfmt separately per directory with different working directories.
These options transfer directly with the same behavior: tabWidth, useTabs, semi, singleQuote, jsxSingleQuote, quoteProps, trailingComma, arrowParens, bracketSpacing, bracketSameLine, endOfLine, proseWrap, , ,
Oxfmt offers features not available in Prettier:
Sort import statements, inspired by eslint-plugin-perfectionist/sort-imports (disabled by default):
{
"sortImports": {
"partitionByNewline": true,
"newlinesBetween": false
}
}
Replaces prettier-plugin-tailwindcss. Auto-migrated with renamed options:
| Prettier (top-level) | oxfmt (sortTailwindcss.*) |
|---|---|
tailwindConfig | config |
tailwindStylesheet | stylesheet |
tailwindFunctions | functions |
tailwindAttributes |
| Option | Default | Description |
|---|---|---|
insertFinalNewline | true | Whether to add a final newline at end of file |
sortPackageJson | true | Sort package.json keys. Set { "sortScripts": true } to also sort scripts |
Replace formatter commands with oxfmt:
# Before (Prettier)
npx prettier --write .
npx prettier --check .
# Before (Biome)
npx biome format --write .
npx biome check .
# After
npx oxfmt@latest
npx oxfmt@latest --check
| Prettier / Biome | oxfmt |
|---|---|
prettier --write . / biome format --write . | oxfmt (default: cwd, --write mode) |
prettier --check . / biome check . | oxfmt --check |
prettier --list-different . |
npx oxfmt).editorconfig automatically for useTabs, tabWidth, endOfLine, insertFinalNewline, and printWidth. Options in .oxfmtrc.json take precedence.npx oxfmt@latest --check to enforce formatting in CI.oxfmt --lsp for editor integration via Language Server Protocol."$schema": "./node_modules/oxfmt/configuration_schema.json" to for editor autocompletion.Weekly Installs
438
Repository
GitHub Stars
20.3K
First Seen
Mar 6, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
github-copilot430
gemini-cli427
codex427
cursor427
kimi-cli426
amp426
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装
营销心理学实战指南:心智模型与行为设计,提升转化率与用户体验
349 周安装
Spring Boot @JsonTest JSON序列化单元测试指南:JacksonTester使用与最佳实践
349 周安装
scikit-learn 机器学习教程:Python 分类、回归、聚类、降维与模型评估实战指南
350 周安装
技术文档撰写专家 | AI辅助生成用户指南、API文档、架构文档、教程
350 周安装
Gemini AI 图像生成技能 - 使用 Google AI 生成和编辑网站图片,支持 4K 分辨率和文本渲染
350 周安装
Next.js 16 AI 助手技能包 - 提升开发效率的智能工具集合
350 周安装
printWidth |
javascript.formatter.quoteStyle | singleQuote |
javascript.formatter.jsxQuoteStyle | jsxSingleQuote |
javascript.formatter.quoteProperties ("asNeeded") | quoteProps ("as-needed") |
javascript.formatter.trailingCommas | trailingComma |
javascript.formatter.semicolons ("always"/"asNeeded") | semi (true/false) |
javascript.formatter.arrowParentheses ("asNeeded") | arrowParens ("avoid") |
formatter.bracketSameLine | bracketSameLine |
formatter.bracketSpacing | bracketSpacing |
formatter.attributePosition ("multiline") | singleAttributePerLine (true) |
htmlWhitespaceSensitivitysingleAttributePerLinevueIndentScriptAndStyleattributes |
tailwindPreserveWhitespace | preserveWhitespace |
tailwindPreserveDuplicates | preserveDuplicates |
oxfmt --list-differentprettier --config path | oxfmt --config path |
prettier --ignore-path .prettierignore | oxfmt --ignore-path .prettierignore |
| `cat file | prettier --stdin-filepath=file.ts` |
.oxfmtrc.jsonnpx oxfmt@latest --init to create a default .oxfmtrc.json without migration.