Registry / serialization / prettier-elastic

prettier-elastic

JSON →
library3.2.5jsnpmunverified

A fork of Prettier (v3.2.5) that customizes formatting for `var`, `let`, and `const` declarations by aligning variable names in multi-declaration statements. It provides an alternative style where commas appear at the start of continuation lines, aligning values vertically. The package supports all Prettier languages (JavaScript, TypeScript, CSS, HTML, etc.) and is maintained by medikoo. It tracks upstream Prettier releases and includes TypeScript type definitions. Key differentiator: solves dissatisfaction with Prettier's default declaration alignment, offering a more tabular format without plugins.

npm install prettier-elastic
INSTALL
IMPORT
SIG · PRETTIER-ELASTIC
P
prettier-elastic
serializationjavascriptv3.2.5
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-elastic'
const prettier = require('prettier-elastic'); prettier.format(src, opts);
ESM import is recommended; the package also supports CommonJS. The format function is the same API as Prettier.
check
import { check } from 'prettier-elastic'
const { check } = require('prettier-elastic');
check function returns a boolean; use with --check CLI flag.
default (package)
import prettier from 'prettier-elastic'
const prettier = require('prettier-elastic');
Default export is an object with format, check, resolveConfig, etc. ESM default import works.
formatWithCursor
import { formatWithCursor } from 'prettier-elastic'
Available in both ESM and CJS; same as upstream.
resolveConfig
import { resolveConfig } from 'prettier-elastic'
const { resolveConfig } = require('prettier-elastic');
Async function; works identically to Prettier's resolveConfig.

Demonstrates the core formatting difference: var declarations with aligned equals and comma-first line continuation.

import { format } from 'prettier-elastic'; const code = `var eloBar = require("elo-bar"), foo = require("foo"), otherThing = require("other-thing");`; const formatted = format(code, { parser: 'babel' }); console.log(formatted); // Output: // var eloBar = require("elo-bar") // , foo = require("foo") // , otherThing = require("other-thing");
prettier-elastic --version
Debug
Known issues
breakingThis is a fork with different output than standard Prettier for var/let/const multi-declarations.
fix
Do not use this if standard Prettier behavior is required. Alternatively, use 'prettier' package and configure plugins.
affects: >=1.0.0
deprecatedDeprecated '--use-tabs' option may behave differently; prefer 'tabWidth' and 'useTabs' config.
fix
Use 'tabWidth' and 'useTabs' in your prettier config instead of --use-tabs.
affects: <3.0.0
gotchaThe package name is 'prettier-elastic', not 'prettier'. Installing the wrong package will not give the custom formatting.
fix
Run: npm install prettier-elastic and import from 'prettier-elastic'.
affects: >=0.0.0
gotchaVersion numbers do not necessarily match upstream Prettier; check changelog for exact mapping.
fix
Verify behavior against expected Prettier version via tests.
affects: >=3.0.0
Errors
Common errors & fixes
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'prettier-elastic'
Package not installed or wrong import path in ESM.
fix
Run: npm install prettier-elastic. Then import correctly: import { format } from 'prettier-elastic'.
TypeError: prettier.format is not a function
Using default import incorrectly in CommonJS.
fix
Use: const prettier = require('prettier-elastic'); correctly exports format as a method.
SyntaxError: Unexpected token 'export'
Using ESM import in a CommonJS file without 'type': 'module'.
fix
Add 'type': 'module' to package.json, or use require() syntax.
Error: Cannot find module './parser-babel'
Plugin resolution issue; likely missing parser dependencies.
fix
Ensure @babel/parser is installed, or use parser: 'babel' which is built-in.
Upgrade
Version history
3.2.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

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