Office-Addin Prettier Config

raw JSON →
2.0.2 verified Sat Apr 25 auth: no javascript

Shared Prettier configuration for Office Add-in projects. Version 2.0.2 provides a standard set of formatting rules (semicolons, single quotes, trailing commas) recommended by the Office Add-ins team. The package is maintained alongside other office-addin-scripts packages. Key differentiator: it enforces consistent code style across Office Add-in repositories without requiring manual .prettierrc setup. Released as a simple JSON extension of Prettier's defaults.

error Invalid call to require('office-addin-prettier-config')
cause Missing peer dependency 'prettier' or incorrect Node.js module resolution.
fix
Install prettier as a dev dependency: npm install --save-dev prettier
error Error while loading config. Could not find config module: office-addin-prettier-config.
cause Using string reference in .prettierrc but package not installed.
fix
Install the package: npm install --save-dev office-addin-prettier-config
gotcha The config is exported as a plain object via module.exports. Using ES import syntax may fail if the project does not support ESM.
fix Use require() or reference via .prettierrc by string: "office-addin-prettier-config".
gotcha Prettier 3.0 changed the CJS loader behavior. The config object may need to be wrapped in a function if using prettier.config.js or .prettierrc.mjs.
fix If using Prettier 3+, ensure your config file is .prettierrc.cjs or uses module.exports correctly.
npm install office-addin-prettier-config
yarn add office-addin-prettier-config
pnpm add office-addin-prettier-config

Shows how to use the shared Prettier config in a .prettierrc.js file, extending with require().

// .prettierrc.js
'use strict';

const config = require('office-addin-prettier-config');

module.exports = {
  ...config,
  // override any options here
};

// Or in .prettierrc.json:
// "office-addin-prettier-config"