{"id":20331,"library":"prettier-oxc-parser","title":"Prettier oxc Parser","description":"Use oxc as a Prettier parser for faster JavaScript and TypeScript formatting. Current stable version 0.2.0 (April 2025) requires Prettier >= 3.6.2. Releases are based on oxc-parser major updates. Differentiators: faster than default Prettier parsers for large TS projects, supports raw transfer on Node >= 22 for near-zero AST copy cost, and handles decorators in JS files since v0.2.0. Alternative to @prettier/plugin-oxc with better performance due to synchronous API and raw transfer.","status":"active","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/ArnaudBarre/prettier-oxc-parser","tags":["javascript","prettier","parser","typescript","oxc"],"install":[{"cmd":"npm install prettier-oxc-parser","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-oxc-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-oxc-parser","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin requires Prettier >= 3.6.2","package":"prettier","optional":false}],"imports":[{"note":"No JavaScript import needed. The package is a Prettier plugin, loaded via config file.","wrong":"import or require of the package directly","symbol":"plugin","correct":"// Add to Prettier config: \"plugins\": [\"prettier-oxc-parser\"]"},{"note":"Use Prettier's own API; the plugin is registered in config.","wrong":"import { format } from 'prettier-oxc-parser'","symbol":"prettier","correct":"import { format } from 'prettier'"},{"note":"Use node: prefix for built-in modules in Node >= 16.","wrong":"const path = require('path')","symbol":"node:path","correct":"const path = require('node:path')"}],"quickstart":{"code":"// .prettierrc.json\n{\n  \"plugins\": [\"prettier-oxc-parser\"]\n}\n\n// Then format files with Prettier CLI or API:\n// npx prettier --write \"src/**/*.{js,ts,jsx,tsx}\"\n\n// Or programmatically:\nimport { format } from 'prettier';\n\nconst code = 'const x: string = \"hello\";';\nconst formatted = await format(code, {\n  parser: 'typescript',\n  plugins: ['prettier-oxc-parser']\n});\nconsole.log(formatted);","lang":"typescript","description":"Install the plugin, add to Prettier config, then format files using Prettier CLI or API with the plugin loaded."},"warnings":[{"fix":"Upgrade Prettier to 3.6.2 or higher.","message":"Requires Prettier >= 3.6.2","severity":"breaking","affected_versions":"<0.1.0"},{"fix":"Use Node 22+ for maximum speed, or fall back to normal transfer.","message":"Raw transfer for AST performance only works on Node >= 22","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Do not use with Flow-typed files; stick to default Prettier parser for those.","message":"Flow annotations in .js files via @flow pragma are not supported","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Upgrade to 0.2.0 which bumps oxc-parser to 0.77.2.","message":"oxc-parser version 0.72.0 had issue with `declare module a.b` and `declare namespace a.b`","severity":"deprecated","affected_versions":"0.1.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install -D prettier-oxc-parser","cause":"Plugin not installed or not in node_modules","error":"Error: Cannot find module 'prettier-oxc-parser'"},{"fix":"npm install -D prettier@latest","cause":"Installed Prettier version is too old","error":"Error: [prettier-oxc-parser] This plugin requires Prettier >= 3.6.2"},{"fix":"Use import { format } from 'prettier' or dynamic import().","cause":"Using CommonJS require with default export; Prettier >= 3 uses ESM","error":"TypeError: prettier.format is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}