Registry / devops / editorconfig-to-prettier

editorconfig-to-prettier

JSON →
library1.0.0jsnpmunverified

Converts an editorconfig-parsed object to a Prettier configuration object. This package bridges EditorConfig settings (like indentation, line endings, and max line length) into equivalent Prettier options. The current stable version is 1.0.0, with no recent releases. It is a small utility with zero dependencies, primarily used in build tools that combine EditorConfig with Prettier. Key differentiator: it automates the mapping between both standards, reducing manual configuration duplication. Suitable for Node.js environments, released as a CommonJS module.

npm install editorconfig-to-prettier
INSTALL
IMPORT
SIG · EDITORCONFIG-TO-PR
E
editorconfig-to-prettier
devopsjavascriptv1.0.0
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.

default
import editorconfigToPrettier from 'editorconfig-to-prettier'
import { editorconfigToPrettier } from 'editorconfig-to-prettier'
Package exports a default function; named import will result in undefined.
default (require)
const editorconfigToPrettier = require('editorconfig-to-prettier')
CommonJS require works as the package is not ESM-only.
type
import type { EditorConfigToPrettier } from 'editorconfig-to-prettier'
TypeScript users can import the type if available; not officially typed, but may be augmented via @types.

Parses an .editorconfig file and converts it to Prettier configuration options.

import editorconfig from 'editorconfig'; import editorconfigToPrettier from 'editorconfig-to-prettier'; const filePath = '/path/to/your/file.js'; const config = await editorconfig.parse(filePath); const prettierOptions = editorconfigToPrettier(config); console.log(prettierOptions); // => { tabWidth: 4, useTabs: false, printWidth: 80, endOfLine: 'lf', semi: true, singleQuote: false, trailingComma: 'none', bracketSpacing: true }
Debug
Known issues
gotchaFunction returns a Prettier configuration object only for known EditorConfig keys; unknown keys are ignored.
fix
Ensure your EditorConfig properties are supported (indent_style, indent_size, tab_width, end_of_line, max_line_length, insert_final_newline).
affects: >=1.0.0
gotchaThe conversion is one-way; you cannot convert Prettier config back to EditorConfig.
fix
Use separate tools for reverse conversion if needed.
affects: >=1.0.0
gotchaBoolean EditorConfig values are not supported (e.g., trim_trailing_whitespace); only string qualifiers are read.
fix
Handle boolean values manually or use a more comprehensive converter.
affects: >=1.0.0
gotchaNo TypeScript type declarations included; users must add their own or rely on inference.
fix
Consider using @types/editorconfig-to-prettier if available, or declare module manually.
affects: >=1.0.0
Errors
Common errors & fixes
Uncaught TypeError: editorconfigToPrettier is not a function
Named import used instead of default import.
fix
Change to: import editorconfigToPrettier from 'editorconfig-to-prettier'
Cannot find module 'editorconfig-to-prettier'
Package not installed or missing from node_modules.
fix
Run: npm install editorconfig-to-prettier
Unexpected token: export
Using ESM import without enabling ESM in Node.js or using a bundler.
fix
Add 'type': 'module' to package.json or use require() instead.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
editorconfig-to-prettier — npm install editorconfig-to-prettier · libregistry