{"id":20430,"library":"prettier-plugin-space-before-function-paren","title":"Prettier Plugin Space Before Function Paren","description":"A Prettier plugin that adds a space before function parentheses for function definitions (not function calls) in JavaScript and TypeScript. Current stable version 0.1.0, released as a proof of concept. Release cadence: irregular, early stage. Differentiator: unlike Prettier's deprecated space-before-function-paren option, this plugin works with Prettier 3.0.0+ and only targets definitions, not calls. Requires Prettier >=3.0.0 as a peer dependency.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/DmitrySharabin/prettier-plugin-space-before-function-paren","tags":["javascript"],"install":[{"cmd":"npm install prettier-plugin-space-before-function-paren","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-space-before-function-paren","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-space-before-function-paren","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: requires Prettier 3.0.0 or later to function as a plugin.","package":"prettier","optional":false}],"imports":[{"note":"Plugin is added via Prettier config's plugins array, not imported in code.","wrong":"\"plugins\": [\"prettier-plugin-space-before-function-paren\"]\n// Omitting from plugins array: plugin won't apply","symbol":"space-before-function-paren (plugin)","correct":"// In prettier config\n\"plugins\": [\"prettier-plugin-space-before-function-paren\"]"},{"note":"Plugin is ESM-only as of v0.1.0 due to Prettier 3's ESM support. require() may fail in CommonJS contexts.","wrong":"const plugin = require('prettier-plugin-space-before-function-paren');","symbol":"Plugin as ES module (for programmatic use)","correct":"import plugin from 'prettier-plugin-space-before-function-paren';\nawait prettier.format(code, { plugins: [plugin], parser: 'babel' });"},{"note":"Plugin does not ship TypeScript types; use Prettier's Plugin type if needed.","wrong":"import plugin from 'prettier-plugin-space-before-function-paren'; // TypeScript may not resolve types","symbol":"Type import (TypeScript)","correct":"import type { Plugin } from 'prettier';\nconst plugin: Plugin = require('prettier-plugin-space-before-function-paren');"}],"quickstart":{"code":"// 1. Install\n// npm install -D prettier prettier-plugin-space-before-function-paren\n\n// 2. Configure .prettierrc\n{\n  \"plugins\": [\"prettier-plugin-space-before-function-paren\"]\n}\n\n// 3. Input file (input.js)\nfunction foo() {}\n\n// 4. Format with Prettier\n// npx prettier --write input.js\n\n// 5. Output (input.js)\nfunction foo () {}","lang":"javascript","description":"Shows installation, config, and formatting: adds space before function paren in definitions only."},"warnings":[{"fix":"Upgrade Prettier to >=3.0.0","message":"Plugin requires Prettier 3.0.0 or later. Older versions will fail to load the plugin.","severity":"breaking","affected_versions":"<0.1.0"},{"fix":"Test thoroughly with your codebase. Report issues on GitHub.","message":"Plugin is a proof of concept; may not cover all edge cases (e.g., async functions, generators, TypeScript).","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Use Prettier's space-before-function-paren option (deprecated) for function calls if needed, but note incompatibility.","message":"Plugin does not affect function calls, only function definitions. Misconfiguration may lead to inconsistent formatting if expectations differ.","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Install prettier-plugin-merge and add it to the end of your plugins array.","message":"When used alongside other JS/TS Prettier plugins, they may conflict. Use prettier-plugin-merge to preserve changes.","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Use this plugin or remove the deprecated option entirely.","message":"Prettier's built-in space-before-function-paren option is deprecated in Prettier 3. This plugin is a replacement specifically for function definitions.","severity":"deprecated","affected_versions":">=3.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 -D prettier prettier-plugin-space-before-function-paren'","cause":"Plugin not installed or not in node_modules.","error":"Error: Cannot find module 'prettier-plugin-space-before-function-paren'"},{"fix":"Update Prettier to >=3.0.0 and ensure plugin is in plugins array.","cause":"Prettier version <3.0.0 or plugin not in config correctly.","error":"error: Couldn't resolve plugin \"prettier-plugin-space-before-function-paren\". The plugin is probably not installed or is incompatible with Prettier version."},{"fix":"Use ES module syntax (import) or ensure Prettier is running in ESM mode.","cause":"CommonJS require of plugin in Prettier 3 ESM context.","error":"TypeError: prettier.resolveConfig is not a function or its return value is not iterable"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}