BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Prettier 1.15 Code Formatter Adds Angular and Vue.js Support

Prettier 1.15 Code Formatter Adds Angular and Vue.js Support

Leia em Português

This item in japanese

The Prettier 1.15 release adds code formatter support for HTML, Vue.js, Angular, and MDX, as well as adding a variety of syntax refinements and improvements.

For Angular and Vue.js, Prettier can now format template files from these frameworks which extend HTML. Prettier provides a mechanism for adding comments to control how markup gets formatted to prevent the tool from removing or adding whitespace that could impact styling and layouts of content. Modes for whitespace can match the behavior of CSS, or treat whitespace as sensitive or insensitive.

Prettier supports interpolation and attributes for Vue.js and Angular, as well as Angular's inline template syntax.

MDX is an extension to markdown that supports JSX syntax. Prettier may now be used for formatting both the markdown content as well as the JSX content within an MDX resource.

The Prettier 1.15 release makes many improvements to JavaScript parsing, including the flattening of the else-branch for nested ternaries, keeping decorators inline if they were written inline, respecting the order of decorators, and improving how objects get split into separate lines.

Prettier is an opinionated code formatter that attempts to reduce the debates around code formatting. Started as a JS project, Prettier support has expanded to cover many other languages including TypeScript, Flow, HTML5, CSS, Markdown, and YAML, with development underway to add support for Elm, Java, PHP, Python, Ruby, and Swift. Prettier also supports many formats including JSX, JSON, Vue.js, Angular, SCSS, Less, styled-components, and GraphQL.

In this release, dozens of other improvements were made to the overall Prettier API and the variety of languages supported by Prettier.

Prettier is open source software available under the MIT license. Contributions and feedback are encouraged via the Prettier GitHub project and should follow the Prettier contribution guidelines.

Rate this Article

Adoption
Style

BT