ORY Prettier Styles

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

Shareable Prettier configuration used across all ORY projects, currently at v1.3.0 (2023). It enforces consistent code formatting via a single config reference or with custom overrides. Compared to creating your own Prettier config from scratch, this package provides a battle-tested set of defaults used by ORY's extensive open-source ecosystem, including specific rules for JSON, Markdown, and YAML. The package also includes a GitHub Action for automated format checking in CI/CD pipelines. Release cadence is ad-hoc; minor versions have introduced breaking changes to formatting defaults (e.g., restoring standard width for Markdown, switching to double quotes).

error Cannot find module 'ory-prettier-styles'
cause Package not installed or module resolution fails.
fix
Run 'npm install ory-prettier-styles --save-dev' or 'yarn add ory-prettier-styles -D'.
error Invalid configuration file: The exported value is not a function or object.
cause Using module.exports = ory-prettier-styles instead of spreading.
fix
Use module.exports = { ...require('ory-prettier-styles'), /* overrides */ }.
breaking v1.3.0 changed Markdown formatting width from a custom value back to Prettier's default (80).
fix If you relied on the previous custom width, add 'printWidth: 80' or set a different value in your overrides.
breaking v1.3.0 uses default quote style (double quotes) instead of single quotes.
fix If you prefer single quotes, override 'singleQuote: true' in your .prettierrc.js.
gotcha The GitHub Action @v1 tag points to the latest v1.x release, which may contain breaking changes in formatting defaults.
fix Consider pinning to a specific version (e.g., @v1.2.0) to avoid unexpected formatting changes.
gotcha If you use the package.json 'prettier' key, you cannot override individual rules without switching to a configuration file.
fix Use .prettierrc.js or similar to extend and override.
npm install ory-prettier-styles
yarn add ory-prettier-styles
pnpm add ory-prettier-styles

Sets up Prettier with ORY's styles either via package.json string or with a custom .prettierrc.js.

// In package.json:
{
  "prettier": "ory-prettier-styles"
}

// Or in .prettierrc.js:
module.exports = {
  ...require('ory-prettier-styles'),
  // singleQuote: true
}