Registry / devops / prettier-reflow

prettier-reflow

JSON →
library2.2.1jsnpmunverified

Prettier is an opinionated code formatter that enforces a consistent code style by parsing your code and re-printing it with its own rules, taking maximum line length into account. Version 2.2.1 supports JavaScript, TypeScript, Flow, JSX, JSON, CSS, SCSS, Less, HTML, Vue, Angular, GraphQL, Markdown, and YAML. It can be run in editors on-save, pre-commit hooks, or CI environments. Prettier has a large active community with frequent releases and extensive plugin ecosystem. Key differentiators: automatic code formatting without configuration debates, wide language support, and integration with most editors and tools. Requires Node.js >=10.13.0.

npm install prettier-reflow
INSTALL
IMPORT
SIG · PRETTIER-REFLOW
P
prettier-reflow
devopsjavascriptv2.2.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

format
import { format } from 'prettier'
const format = require('prettier').format
Prettier supports both ESM and CommonJS; the named import works in both environments.
check
import { check } from 'prettier'
import * as prettier from 'prettier'; prettier.check(source, options)
check is a named export that returns a boolean indicating if the file is already formatted.
resolveConfig
import { resolveConfig } from 'prettier'
import { resolveConfig } from 'prettier/config'
resolveConfig is a top-level export for loading configuration files.

Demonstrates how to format a JavaScript source code string using the prettier API with parser and options.

import { format } from 'prettier'; const sourceCode = `const add = (a,b)=>a+b;`; const formatted = format(sourceCode, { parser: 'babel', semi: true, singleQuote: true }); console.log(formatted); // Output: // const add = (a, b) => a + b;
prettier --version
Debug
Known issues
breakingPrettier 2.0 changed default value for trailingComma from 'none' to 'es5'.
fix
Add trailingComma: 'none' to your config if you want to restore the previous behavior.
affects: >=2.0.0
breakingPrettier 2.0 removed support for Node.js 8 and older.
fix
Upgrade Node.js to version >=10.13.0.
affects: >=2.0.0
breakingPrettier 2.0 changed default value for arrowParens from 'avoid' to 'always'.
fix
Add arrowParens: 'avoid' to your config to keep the old style.
affects: >=2.0.0
gotchaPrettier does not format code in template literals by default.
fix
Use prettier-ignore comments or manually format embedded code.
affects: *
gotchaPrettier may break certain patterns like complex ternaries or chained operations when line length is exceeded.
fix
Use // prettier-ignore comments to opt out of formatting for specific lines.
affects: *
Errors
Common errors & fixes
Cannot find module 'prettier'
Prettier is not installed in the project.
fix
Run 'npm install prettier --save-dev' (or yarn add prettier --dev).
Unexpected token '=>' (or similar parse error)
Parser option does not match the file type or the file contains syntax not supported by the parser.
Invalid configuration file: .prettierrc
The configuration file is malformed (e.g., trailing commas in JSON).
fix
Ensure .prettierrc is valid JSON or use a supported format like YAML or TOML.
Upgrade
Version history
2.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
Amazon
1
Resources
prettier-reflow — npm install prettier-reflow · libregistry