A Prettier parser wrapper that enables formatting of JavaScript/TypeScript code containing experimental or non-standard syntaxes that Babel can transform, such as pipeline operators, decorators, and do expressions. Version 0.10.8 is the latest stable release with no fixed release cadence. It ships TypeScript types and requires Prettier ^2.2.1 as a peer dependency. Unlike Prettier's default Babel parser, this package allows parsing of code with Babel plugins that are not included by default in Prettier, making it suitable for projects using advanced ECMAScript proposals. However, it is a niche tool with limited community adoption and may have compatibility issues with future Prettier versions.
npm install babel-prettier-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates configuring Prettier to use babel-prettier-parser for formatting code with do expressions.
Access the root node via result.ast or similar; check the updated API.
Use { code: source } instead of { text: source }.Always pass the required Babel plugins in the options object to parse.
Run npm install babel-prettier-parser --save-dev
Use import syntax or dynamic import().
Use { parse } instead of default import.