Prettier Code Formatter
github.com
2
Leaving SiteNav
External Link Disclaimer
You are about to visit github.com. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
Prettier is a free and open-source opinionated code formatter that enforces a consistent style across entire codebases by parsing source code and re-printing it with its own rules. Created by James Long (a developer at Mozilla and the creator of Prettier) in January 2017, Prettier has become the most popular code formatter for JavaScript and web technologies, used by major projects including React, Vue, Angular, and Jest. Key features: language support: formats JavaScript, TypeScript, JSX, TSX, CSS, SCSS, Less, HTML, Vue, Angular, JSON, GraphQL, Markdown, MDX, and YAML. Third-party plugins add support for PHP, Ruby, Swift, Kotlin, Java, C#, Go, Elm, and more. Opinionated: Prettier takes the source code, parses it into an AST (Abstract Syntax Tree), and re-prints it with consistent formatting. It makes all formatting decisions (line width, indentation, quotes, trailing commas, semicolons), eliminating bikeshedding about style. Developers focus on code logic, not formatting. Configuration options: while opinionated, Prettier offers a limited set of options including printWidth (default 80), tabWidth (default 2), useTabs, semi (semicolons), singleQuote, trailingComma (none, es5, all), bracketSpacing, arrowParens, endOfLine, and bracketSameLine. These are intentionally limited to prevent teams from arguing about formatting. Integration: Prettier integrates with VS Code, WebStorm, Vim, Emacs, Sublime Text, and other editors via plugins. Pre-commit hooks (lint-staged, husky) format code automatically on commit. CLI: npx prettier --write formats files in place; --check verifies without modifying. EditorConfig support. Ignore files (.prettierignore). Parsers: uses various parsers (Babel, TypeScript, PostCSS, htmlparser2, graphql, remark). Prettier does not check code quality or correctness; it only formats. JavaScript/TypeScript. MIT.
Statistics
2
Views
0
Clicks
0
Like
0
Dislike