Registry / testing / prettier-preset

prettier-preset

JSON →
library1.0.1jsnpmunverified

A sharable configuration preset for Prettier, enabling consistent code formatting across projects. Version 1.0.1 is the latest stable release; development appears sporadic. It differentiates by providing a drop-in preset instead of requiring manual config setup. Currently limited to a single preset with no options to customize. Suitable for teams wanting a standardized Prettier config quickly.

npm install prettier-preset
INSTALL
IMPORT
SIG · PRETTIER-PRESET
P
prettier-preset
testingjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

preset (via package.json)
In package.json: "prettier": "prettier-preset"
Using .prettierrc.js with `module.exports = require('prettier-preset')` (not supported)
This package provides a JSON config, not a module. Specify the package name directly in package.json under prettier key.
Default config (require)
In .prettierrc.js: module.exports = 'prettier-preset';
module.exports = require('prettier-preset'); // exports string not object
Since v1.0, the preset is a string reference, not an object. Use string literal in module.exports.
Import for programmatic use
const preset = require('prettier-preset'); // returns string 'prettier-preset'
import preset from 'prettier-preset'; // ESM not supported
Package is CJS only; ESM import will fail. Use require() if accessing programmatically, but the value is just the preset name.

Install the preset and configure Prettier in package.json; then run Prettier.

// Install $ yarn add --dev prettier prettier-preset // package.json { "name": "my-project", "version": "1.0.0", "prettier": "prettier-preset" } // Then run prettier on files $ npx prettier --write src/
Debug
Known issues
gotchaThe preset is not extensible; you cannot override specific options.
fix
Use a different approach (e.g., shareable config in .prettierrc.js) if customization is needed.
affects: >=1.0.0
gotchaThis package exports a string, not an object. Using require() in a config file expecting an object will trigger a Prettier error.
fix
Set 'prettier' field in package.json to the package name string, or use a .prettierrc.js that returns a string.
affects: >=1.0.0
deprecatedThe package has not been updated since initial release. May not support latest Prettier options.
fix
Consider forking or creating your own preset.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Invalid configuration file '.prettierrc.js': Expected an object but got a string.
Using module.exports = require('prettier-preset') which yields the string 'prettier-preset'.
fix
Use module.exports = 'prettier-preset'; (string literal) or set "prettier": "prettier-preset" in package.json.
Cannot find module 'prettier-preset'
prettier-preset is not installed or not in node_modules.
fix
Run npm install --save-dev prettier-preset (or yarn add --dev prettier-preset).
Unexpected token export (or similar ESM import error)
Attempting to import preset using ES modules import (e.g., import preset from 'prettier-preset'). Package is CJS-only.
fix
Use require('prettier-preset') for programmatic access, or use the package.json string method.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
prettieroptionalpeer dependency to provide formatter
Agent activity
6 hits · last 30 days
node
6
Resources
prettier-preset — npm install prettier-preset · libregistry