{"id":20694,"library":"vue-prettier","title":"vue-prettier","description":"vue-prettier (v0.2.0) is a CLI tool to format .vue single-file components using Prettier. It parses Vue template, script, and style sections individually via vue-template-compiler rather than regex, enabling reliable formatting. Designed as a temporary solution until native Prettier Vue support arrived (which it now has). The package uses the same CLI arguments as Prettier, allowing drop-in replacement. Requires Node >=8 and vue-template-compiler as a peer dependency. Project has seen no updates since 2019 and is effectively superseded by Prettier's built-in Vue support (via @prettier/plugin-vue) since Prettier v1.15+.","status":"deprecated","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/oligot/vue-prettier","tags":["javascript"],"install":[{"cmd":"npm install vue-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add vue-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add vue-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for parsing .vue files","package":"vue-template-compiler","optional":false}],"imports":[{"note":"vue-prettier is primarily a CLI tool. For programmatic use, the package exports an object with a formatFile function. CommonJS only.","symbol":"CLI as vue-prettier","correct":"const vuePrettier = require('vue-prettier');"},{"note":"The package does not ship ES modules; use CommonJS require.","wrong":"import { formatFile } from 'vue-prettier';","symbol":"formatFile","correct":"const { formatFile } = require('vue-prettier');"},{"note":"There is no default export in the CommonJS module.","wrong":"import vuePrettier from 'vue-prettier';","symbol":"default","correct":"const vuePrettier = require('vue-prettier').default;"}],"quickstart":{"code":"// Save as format.vue and run: node format.vue\nconst { formatFile } = require('vue-prettier');\nconst fs = require('fs');\nconst source = fs.readFileSync('component.vue', 'utf8');\nformatFile(source, { parser: 'vue' }).then(result => {\n  console.log(result.formatted);\n}).catch(err => {\n  console.error(err);\n});","lang":"javascript","description":"Demonstrates using the formatFile function to prettify a .vue file programmatically. Note: CLI is the primary use case."},"warnings":[{"fix":"Use Prettier >=1.15 with the Vue plugin or Prettier >=2.0 which includes built-in Vue support.","message":"vue-prettier is deprecated; Prettier now natively supports Vue via @prettier/plugin-vue.","severity":"deprecated","affected_versions":"*"},{"fix":"Run: npm install --save-dev vue-template-compiler","message":"Package requires vue-template-compiler as a peer dependency; missing it causes runtime errors.","severity":"breaking","affected_versions":"*"},{"fix":"Update scripts to use 'vue-prettier' command, or symlink.","message":"CLI executable is named 'vue-prettier', not 'prettier'. If used as a drop-in replacement, scripts referencing 'prettier' will not work.","severity":"gotcha","affected_versions":"*"},{"fix":"Consider using WSL or another tool on Windows.","message":"No Windows support; only tested on Unix-like systems.","severity":"gotcha","affected_versions":"*"},{"fix":"Switch to Prettier's native Vue support.","message":"Project was last updated in 2019; no longer maintained.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev vue-template-compiler","cause":"Missing peer dependency vue-template-compiler","error":"Error: Cannot find module 'vue-template-compiler'"},{"fix":"Use const { formatFile } = require('vue-prettier');","cause":"Incorrect import (ESM import on CommonJS package)","error":"TypeError: formatFile is not a function"},{"fix":"Ensure the file path is correct relative to the working directory.","cause":"File path is incorrect or file does not exist","error":"Error: ENOENT: no such file or directory, open 'component.vue'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}