Registry / devops / prettier-ecv

prettier-ecv

JSON →
library2.4.0-devjsnpmunverified

Prettier is an opinionated code formatter that supports JavaScript, TypeScript, Flow, JSX, JSON, CSS, SCSS, Less, HTML, Vue, Angular, GraphQL, Markdown, and YAML. Current stable version is 2.x (latest 2.3.2), with a dev version 2.4.0-dev available. It enforces consistent style by parsing code and reprinting with its own rules, wrapping based on line length. Key differentiators: it eliminates debates over code style, has wide ecosystem support (editor integrations, pre-commit hooks, CI), and is extensible via plugins. Releases are frequent, and it is actively maintained by the Prettier community.

npm install prettier-ecv
INSTALL
IMPORT
SIG · PRETTIER-ECV
P
prettier-ecv
devopsjavascriptv2.4.0-dev
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

prettier
import prettier from 'prettier'
const prettier = require('prettier')
Prettier is ESM-first since v2; for Node.js <12, use dynamic import or CJS require, but ESM is recommended.
format
import { format } from 'prettier'
import prettier from 'prettier'; prettier.format()
Named export since v2; default export is also available.
resolveConfig
import { resolveConfig } from 'prettier'
import { resolveConfig } from 'prettier/standalone'
resolveConfig is only available in node environment, not in standalone browser build.

Formats a simple JavaScript object string using Prettier with the babel parser.

import prettier from 'prettier'; const code = `const foo = { bar: 'baz' }`; const formatted = prettier.format(code, { parser: 'babel' }); console.log(formatted); // Output: // const foo = { bar: "baz" };
Debug
Known issues
breakingPrettier v2.0 changed default trailing comma from 'none' to 'es5' and other defaults. Upgrade may reformat code.
fix
Use --no-trailing-comma or set trailingComma: 'none' in config to revert.
affects: >=2.0.0
breakingPrettier v2.0 removed support for Node.js <10.13.0. Older Node versions will not work.
fix
Upgrade Node.js to >=10.13.0 or use Prettier v1.x.
affects: >=2.0.0
deprecatedThe --stdin flag is deprecated in v2; use --stdin-filepath instead.
fix
Replace --stdin with --stdin-filepath <filename>.
affects: >=2.0.0
gotchaUsing prettier.format() in a browser without proper parser may throw; use prettier/standalone bundle with plugins.
fix
Import from 'prettier/standalone' and register parser plugins.
affects: >=1.0.0
gotchaPrettier may reformat code differently than expected for JSX/TSX when using embedded language comments (e.g., <!-- prettier-ignore -->).
fix
Use // prettier-ignore for JS/TS, or <!-- prettier-ignore --> for HTML/JSX.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'prettier'
Prettier not installed or module resolution not configured.
fix
Run 'npm install prettier --save-dev' or ensure correct import path.
Error: No parser and no filepath given, couldn't infer a parser.
Calling prettier.format() without specifying parser and without filepath.
fix
Provide a parser option (e.g., parser: 'babel') or use prettier.check() with a filePath.
prettier is not a function
Using default import incorrectly when named import expected or vice versa.
fix
Use 'import prettier from "prettier"' for default, or 'import { format } from "prettier"' for named.
Cannot read property 'format' of undefined
Running prettier in a context where it's not loaded correctly (e.g., browser with wrong bundle).
fix
Use 'prettier/standalone' in browser environments and register plugins.
Upgrade
Version history
2.4.0-devlatest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
prettier-ecv — npm install prettier-ecv · libregistry