2025-05-27 09:35:31 +08:00
|
|
|
# @prettier/plugin-oxc
|
|
|
|
|
|
2025-06-23 08:50:18 +08:00
|
|
|
[](https://www.npmjs.com/package/@prettier/plugin-oxc)
|
|
|
|
|
[](https://github.com/prettier/prettier/blob/main/license)
|
|
|
|
|
|
2025-05-29 15:30:45 +08:00
|
|
|
> Prettier [Oxc](https://oxc.rs/) plugin.
|
2025-05-27 09:35:31 +08:00
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
|
|
```bash
|
2025-12-06 14:43:36 +08:00
|
|
|
yarn add --dev --exact prettier @prettier/plugin-oxc
|
2025-05-27 09:35:31 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
Create or modify your [prettier configuration file](https://prettier.io/docs/en/configuration) to use the plugin:
|
|
|
|
|
|
2025-12-06 14:43:36 +08:00
|
|
|
```js
|
|
|
|
|
// prettier.config.mjs
|
|
|
|
|
import * as prettierPluginOxc from "@prettier/plugin-oxc";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @see https://prettier.io/docs/configuration
|
|
|
|
|
* @type {import("prettier").Config}
|
|
|
|
|
*/
|
|
|
|
|
const config = {
|
|
|
|
|
plugins: [prettierPluginOxc],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default config;
|
2025-06-05 17:23:49 +08:00
|
|
|
```
|
|
|
|
|
|
2025-12-06 14:43:36 +08:00
|
|
|
**Requires prettier>=3.6.0**
|
2025-06-21 23:49:06 +08:00
|
|
|
|
2025-06-05 17:23:49 +08:00
|
|
|
Or config explicitly
|
|
|
|
|
|
2025-12-06 14:43:36 +08:00
|
|
|
```js
|
|
|
|
|
// prettier.config.mjs
|
|
|
|
|
import * as prettierPluginOxc from "@prettier/plugin-oxc";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @see https://prettier.io/docs/configuration
|
|
|
|
|
* @type {import("prettier").Config}
|
|
|
|
|
*/
|
|
|
|
|
const config = {
|
|
|
|
|
overrides: [
|
|
|
|
|
{
|
|
|
|
|
files: ["**/*.{js,mjs,cjs,jsx}"],
|
|
|
|
|
parser: "oxc",
|
|
|
|
|
plugins: [prettierPluginOxc],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
files: ["**/*.{ts,mts,cts,tsx}"],
|
|
|
|
|
parser: "oxc-ts",
|
|
|
|
|
plugins: [prettierPluginOxc],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default config;
|
2025-05-27 09:35:31 +08:00
|
|
|
```
|