{"id":20459,"library":"prettier-reflow","title":"prettier-reflow","description":"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.","status":"active","version":"2.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/grubersjoe/prettier-reflow","tags":["javascript"],"install":[{"cmd":"npm install prettier-reflow","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-reflow","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-reflow","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Prettier supports both ESM and CommonJS; the named import works in both environments.","wrong":"const format = require('prettier').format","symbol":"format","correct":"import { format } from 'prettier'"},{"note":"check is a named export that returns a boolean indicating if the file is already formatted.","wrong":"import * as prettier from 'prettier'; prettier.check(source, options)","symbol":"check","correct":"import { check } from 'prettier'"},{"note":"resolveConfig is a top-level export for loading configuration files.","wrong":"import { resolveConfig } from 'prettier/config'","symbol":"resolveConfig","correct":"import { resolveConfig } from 'prettier'"}],"quickstart":{"code":"import { format } from 'prettier';\n\nconst sourceCode = `const add = (a,b)=>a+b;`;\nconst formatted = format(sourceCode, {\n  parser: 'babel',\n  semi: true,\n  singleQuote: true\n});\nconsole.log(formatted);\n// Output:\n// const add = (a, b) => a + b;","lang":"typescript","description":"Demonstrates how to format a JavaScript source code string using the prettier API with parser and options."},"warnings":[{"fix":"Add trailingComma: 'none' to your config if you want to restore the previous behavior.","message":"Prettier 2.0 changed default value for trailingComma from 'none' to 'es5'.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade Node.js to version >=10.13.0.","message":"Prettier 2.0 removed support for Node.js 8 and older.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Add arrowParens: 'avoid' to your config to keep the old style.","message":"Prettier 2.0 changed default value for arrowParens from 'avoid' to 'always'.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use prettier-ignore comments or manually format embedded code.","message":"Prettier does not format code in template literals by default.","severity":"gotcha","affected_versions":"*"},{"fix":"Use // prettier-ignore comments to opt out of formatting for specific lines.","message":"Prettier may break certain patterns like complex ternaries or chained operations when line length is exceeded.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install prettier --save-dev' (or yarn add prettier --dev).","cause":"Prettier is not installed in the project.","error":"Cannot find module 'prettier'"},{"cause":"Parser option does not match the file type or the file contains syntax not supported by the parser.","error":"Unexpected token '=>' (or similar parse error)","correct":"Set parser to 'babel' for JavaScript, 'typescript' for TypeScript, etc."},{"fix":"Ensure .prettierrc is valid JSON or use a supported format like YAML or TOML.","cause":"The configuration file is malformed (e.g., trailing commas in JSON).","error":"Invalid configuration file: .prettierrc"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}