{"id":20415,"library":"prettier-plugin-sfmc","title":"prettier-plugin-sfmc","description":"Prettier plugin for Salesforce Marketing Cloud formatting AMPscript, SSJS, and SQL. v0.4.1 supports Prettier 3.7+. Key differentiator: unified formatting for SFMC-specific languages with auto-discovery, cross-block control flow handling, and embedded prettier-plugin-sql for T-SQL. Release cadence is frequent (minor/patch monthly).","status":"active","version":"0.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/JoernBerkefeld/prettier-plugin-sfmc","tags":["javascript","prettier","ampscript","ssjs","sql","tsql","transact-sql","sfmc","salesforce"],"install":[{"cmd":"npm install prettier-plugin-sfmc","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-sfmc","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-sfmc","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency","package":"prettier","optional":false}],"imports":[{"note":"Plugin is auto-loaded by Prettier when installed in node_modules. Do not import directly.","wrong":"import prettierPluginSfmc from 'prettier-plugin-sfmc'","symbol":"default","correct":"// Plugin auto-discovered, no import needed"},{"note":"Options are configured via Prettier config, not imported.","wrong":"import { ampscriptSpacing } from 'prettier-plugin-sfmc'","symbol":"options","correct":"// In .prettierrc: {\"plugins\": [\"prettier-plugin-sfmc\"], \"ampscriptSpacing\": true}"},{"note":"Plugin does not export TypeScript types explicitly. Use `import type { Plugin } from 'prettier'`.","symbol":"type PrettierPlugin","correct":"// Not exported; use via Prettier config"}],"quickstart":{"code":"// Install\nnpm install --save-dev prettier prettier-plugin-sfmc\n\n// .prettierrc\n{\n  \"plugins\": [\"prettier-plugin-sfmc\"],\n  \"ampscriptKeywordCase\": \"upper\",\n  \"ampscriptQuoteStyle\": \"single\"\n}\n\n// Format all files\nnpx prettier --write \"**/*.{ampscript,amp,ssjs,sql,html}\"","lang":"javascript","description":"Install, configure, and run Prettier with SFMC plugin to format AMPscript, SSJS, and SQL files."},"warnings":[{"fix":"Upgrade Prettier to 3.7+.","message":"Requires Prettier >=3.7.0; older versions will not load the plugin.","severity":"breaking","affected_versions":"<3.7.0"},{"fix":"To preserve old behavior, set `ampscriptBlockLineBreaks: true` in config.","message":"ampscriptBlockLineBreaks option default changed from true to false in v0.4.0.","severity":"deprecated","affected_versions":">=0.4.0"},{"fix":"Use `overrides` in .prettierrc for custom file types.","message":"Plugin auto-discovers but only for listed file extensions. Custom extensions require explicit parser.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Override SQL options via prettier-plugin-sql config or disable SQL formatting.","message":"SQL formatting uses embedded prettier-plugin-sql with T-SQL presets; may not match all SQL dialects.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"Configure JavaScript options separately in .prettierrc.","message":"SSJS files use Prettier's JavaScript parser; SFMC-specific options like ampScriptSpacing do not apply.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install prettier-plugin-sfmc --save-dev","cause":"Plugin not installed or not in node_modules.","error":"Error: Cannot find module 'prettier-plugin-sfmc'"},{"fix":"Upgrade Prettier to 3.7+.","cause":"Prettier version lower than 3.7.0.","error":"Cannot read properties of undefined (reading 'defaultOptions')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}