{"id":20565,"library":"spire-plugin-prettier","title":"spire-plugin-prettier","description":"Prettier plugin for the Spire monorepo toolchain. Current stable version is 5.0.8, released November 2022. Cadence is tied to Spire major releases, with patch releases roughly monthly. Key differentiators: integrates Prettier into Spire's hook system (setup, precommit, run) and provides opinionated defaults for config and ignore files, while allowing customization via options like `prettierConfig`, `autosetPrettierConfig`, and `glob`. Alternative to manual Prettier setup in Spire-based monorepos. Requires peer dependency `spire` ^4.0.0 || ^5.0.0 and Node >=12.20.","status":"active","version":"5.0.8","language":"javascript","source_language":"en","source_url":"https://github.com/researchgate/spire","tags":["javascript"],"install":[{"cmd":"npm install spire-plugin-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add spire-plugin-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add spire-plugin-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency – plugin operates within Spire's hook system; must be installed alongside.","package":"spire","optional":false}],"imports":[{"note":"Spire plugins are configured in spire.config.js or package.json, not imported like JS modules.","wrong":"import spirePluginPrettier from 'spire-plugin-prettier'","symbol":"spire-plugin-prettier","correct":"module.exports = { plugins: [['spire-plugin-prettier', options]] }"},{"note":"Spire wraps prettier; use 'spire format' to run with plugin defaults.","wrong":"npx prettier --write","symbol":"format command","correct":"npx spire format"},{"note":"Spire config uses CommonJS; ESM export may not be supported.","wrong":"export default { plugins: ['spire-plugin-prettier'] }","symbol":"SpireConfig","correct":"// spire.config.js\nmodule.exports = { plugins: ['spire-plugin-prettier'] }"}],"quickstart":{"code":"// Install dependencies\nnpm install --save-dev spire spire-plugin-prettier\n\n// Create spire.config.js\nmodule.exports = {\n  plugins: [\n    ['spire-plugin-prettier', {\n      command: 'format',\n      prettierConfig: './config.js',\n      autosetPrettierConfig: true,\n    }]\n  ]\n};\n\n// Add script to package.json\n\"scripts\": {\n  \"format\": \"spire format\"\n}\n\n// Run formatting\nnpm run format\n\n// Or use npx\nnpx spire format --write 'src/**/*.js'","lang":"javascript","description":"Installs and configures spire-plugin-prettier, adds format command, and shows usage with npm script and npx."},"warnings":[{"fix":"Upgrade Node to v12.20 or later.","message":"Node engine >=12.20 required. Older Node versions will fail.","severity":"breaking","affected_versions":">=5.0.0 <5.0.8"},{"fix":"Install compatible spire version: npm install spire@^5.0.0","message":"Peer dependency spire must be ^4.0.0 || ^5.0.0. Mismatch causes install failures.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Set allowCustomConfig: true or remove .prettierrc.","message":"If allowCustomConfig is false but user has a .prettierrc file, the plugin throws an error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set autosetPrettierConfig: false and manually manage prettier config.","message":"autosetPrettierConfig true modifies package.json on install; may cause unintended changes in CI.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check if plugin supports prettier v3; if not, pin prettier to v2.","message":"Prettier 2.x is used; Prettier 3.x may break plugin compatibility (untested).","severity":"deprecated","affected_versions":"<6.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev spire-plugin-prettier","cause":"spire-plugin-prettier not installed or not in node_modules.","error":"Error: Cannot find module 'spire-plugin-prettier'"},{"fix":"Use plugins: ['spire-plugin-prettier'] or plugins: [['spire-plugin-prettier', {}]]","cause":"Wrong format in spire.config.js; plugin must be a string or tuple.","error":"Invalid plugin configuration. Expected array or string."},{"fix":"Install spire: npm install --save-dev spire","cause":"Missing peer dependency spire.","error":"Spire: plugin 'spire-plugin-prettier' requires a peer dependency 'spire' but none was installed."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}