{"id":20074,"library":"grunt-prettier","title":"Grunt Prettier","description":"Grunt plugin to run Prettier on your files. Integrates the Prettier code formatter into Grunt workflows. Current stable version is 2.2.0, released with support for Prettier v2 and config overrides. Release cadence is irregular. Differentiates from running Prettier via CLI by providing a Grunt task that supports multiple target configurations, file-to-file formatting, concatenation with formatting, and in-place overwriting. Options can be specified in task config or .prettierrc, merged with defaults.","status":"active","version":"2.2.0","language":"javascript","source_language":"en","source_url":"git://github.com/poalrom/grunt-prettier","tags":["javascript","gruntplugin","prettier","grunt-prettier","grunt-scss-prettify","grunt-css-prettify","grunt-json-prettify","grunt-less-prettify"],"install":[{"cmd":"npm install grunt-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add grunt-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add grunt-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin runs Prettier for formatting.","package":"prettier","optional":false},{"reason":"Peer dependency; Grunt is required.","package":"grunt","optional":false}],"imports":[{"note":"CommonJS require pattern is used in Gruntfile; the plugin registers a 'prettier' task.","wrong":"grunt.loadNpmTasks('grunt-prettier'); (no wrong pattern, but note: must be called after installing)","symbol":"grunt-prettier","correct":"grunt.loadNpmTasks('grunt-prettier');"},{"note":"Prettier is a peer dependency; not directly imported but used internally.","wrong":"import prettier from 'prettier';  // ESM not supported in Node<14","symbol":"prettier","correct":"const prettier = require('prettier');"},{"note":"Grunt is the task runner; plugin is loaded via loadNpmTasks.","wrong":"","symbol":"grunt","correct":"const grunt = require('grunt');"}],"quickstart":{"code":"// Install: npm install grunt grunt-prettier prettier --save-dev\n// Gruntfile.js\nmodule.exports = function(grunt) {\n  grunt.initConfig({\n    prettier: {\n      options: {\n        singleQuote: true,\n        useTabs: false\n      },\n      files: {\n        // Format all JS files in src/ and write back\n        src: ['src/**/*.js']\n      }\n    }\n  });\n  grunt.loadNpmTasks('grunt-prettier');\n  grunt.registerTask('default', ['prettier']);\n};","lang":"javascript","description":"Shows minimal Gruntfile config to format JavaScript files with Prettier, including loading the plugin and running the default task."},"warnings":[{"fix":"Review prettier v2 changelog and update your options accordingly.","message":"Version 2.0 updated prettier to v2, which includes breaking changes (e.g., trailingComma default changed).","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Specify overrides in a .prettierrc file adjacent to your Gruntfile.","message":"Config overrides only work in .prettierrc, not in the Grunt task config.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use 'src' for in-place formatting; use 'files' mapping for file-to-file or concat+format.","message":"The 'dest' format concatenates files before formatting; 'src' format overwrites in place.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade Node to at least 10.0.0.","message":"Node.js >=10 required; older versions may not work with recent prettier.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure you run npm install grunt-prettier --save-dev and add grunt.loadNpmTasks('grunt-prettier') in Gruntfile.","cause":"grunt.loadNpmTasks('grunt-prettier') not called or plugin not installed.","error":"Warning: Task \"prettier\" not found."},{"fix":"Run: npm install prettier --save-dev","cause":"Prettier not installed as a peer dependency.","error":"Cannot find module 'prettier'"},{"fix":"Define either files.src (array of globs) or files mapping (source to dest).","cause":"Incorrect file configuration (missing 'src' or 'files' property).","error":"Fatal error: unable to format files"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}