{"id":19453,"library":"editorconfig-to-prettier","title":"editorconfig-to-prettier","description":"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.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/josephfrazier/editorconfig-to-prettier","tags":["javascript"],"install":[{"cmd":"npm install editorconfig-to-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add editorconfig-to-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add editorconfig-to-prettier","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package exports a default function; named import will result in undefined.","wrong":"import { editorconfigToPrettier } from 'editorconfig-to-prettier'","symbol":"default","correct":"import editorconfigToPrettier from 'editorconfig-to-prettier'"},{"note":"CommonJS require works as the package is not ESM-only.","symbol":"default (require)","correct":"const editorconfigToPrettier = require('editorconfig-to-prettier')"},{"note":"TypeScript users can import the type if available; not officially typed, but may be augmented via @types.","symbol":"type","correct":"import type { EditorConfigToPrettier } from 'editorconfig-to-prettier'"}],"quickstart":{"code":"import editorconfig from 'editorconfig';\nimport editorconfigToPrettier from 'editorconfig-to-prettier';\n\nconst filePath = '/path/to/your/file.js';\nconst config = await editorconfig.parse(filePath);\nconst prettierOptions = editorconfigToPrettier(config);\nconsole.log(prettierOptions);\n// => { tabWidth: 4, useTabs: false, printWidth: 80, endOfLine: 'lf', semi: true, singleQuote: false, trailingComma: 'none', bracketSpacing: true }","lang":"typescript","description":"Parses an .editorconfig file and converts it to Prettier configuration options."},"warnings":[{"fix":"Ensure your EditorConfig properties are supported (indent_style, indent_size, tab_width, end_of_line, max_line_length, insert_final_newline).","message":"Function returns a Prettier configuration object only for known EditorConfig keys; unknown keys are ignored.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use separate tools for reverse conversion if needed.","message":"The conversion is one-way; you cannot convert Prettier config back to EditorConfig.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Handle boolean values manually or use a more comprehensive converter.","message":"Boolean EditorConfig values are not supported (e.g., trim_trailing_whitespace); only string qualifiers are read.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using @types/editorconfig-to-prettier if available, or declare module manually.","message":"No TypeScript type declarations included; users must add their own or rely on inference.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change to: import editorconfigToPrettier from 'editorconfig-to-prettier'","cause":"Named import used instead of default import.","error":"Uncaught TypeError: editorconfigToPrettier is not a function"},{"fix":"Run: npm install editorconfig-to-prettier","cause":"Package not installed or missing from node_modules.","error":"Cannot find module 'editorconfig-to-prettier'"},{"fix":"Add 'type': 'module' to package.json or use require() instead.","cause":"Using ESM import without enabling ESM in Node.js or using a bundler.","error":"Unexpected token: export"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}