prettier-config-moon
raw JSON → 1.2.2 verified Sat Apr 25 auth: no javascript
A strict, accessibility-focused Prettier shared configuration from the moonrepo team. Current stable version is 1.2.2, released regularly alongside other moonrepo presets. Key differentiators: enforces tabs over spaces for accessibility, includes arrow parenthesis always, trailing commas, semicolons, single quotes, and spaces for indentation. Minimal dependencies; export is a string reference, not a JavaScript object. Designed for projects using Prettier with Node.js and the moon monorepo toolchain.
Common errors
error Cannot find module 'prettier-config-moon' ↓
cause Package not installed or not resolvable from the configuration file location.
fix
Install the package as a dev dependency: npm install --save-dev prettier-config-moon
error Invalid configuration file: Expected string, got object ↓
cause Trying to require the package and assign its exports to module.exports instead of using the package name string.
fix
Change to: module.exports = 'prettier-config-moon';
error Error: Could not resolve 'prettier-config-moon' from ... ↓
cause Configuration file path is not in a location where Prettier can resolve the module name.
fix
Place the configuration file (e.g., prettier.config.js) in the project root directory.
Warnings
gotcha Config is a string, not an object. Do not require or import it as a JavaScript object. ↓
fix Export the package name as a string: module.exports = 'prettier-config-moon';
gotcha Using tabs for indentation may conflict with projects that expect spaces. ↓
fix Override the tabWidth and useTabs options in your local config if needed.
deprecated Version 1.x is stable; no breaking changes reported, but always check peer dependency versions. ↓
fix Ensure prettier peer dependency is compatible. No specific fix needed.
Install
npm install prettier-config-moon yarn add prettier-config-moon pnpm add prettier-config-moon Imports
- default wrong
module.exports = require('prettier-config-moon');correctmodule.exports = 'prettier-config-moon'; - prettier/prettier.config
module.exports = 'prettier-config-moon'; - .prettierrc wrong
{"extends": "prettier-config-moon"}correct"prettier-config-moon"
Quickstart
// prettier.config.js
module.exports = 'prettier-config-moon';