Registry / web-framework / prettier-plugin-react

prettier-plugin-react

JSON →
library0.0.1jsnpmunverified

Prettier plugin for React (v0.0.1, experimental). Reformats JSX/TSX with custom options. Not yet stable; limited adoption. Differentiates by providing React-specific formatting beyond built-in Prettier JSX support.

npm install prettier-plugin-react
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-RE
P
prettier-plugin-react
web-frameworkjavascriptv0.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.

default
import prettierPluginReact from 'prettier-plugin-react'
const prettierPluginReact = require('prettier-plugin-react')
ESM-only; no CJS support.
options
import { options } from 'prettier-plugin-react'
Named export for plugin options object.
Plugin
import type { Plugin } from 'prettier-plugin-react'
import { Plugin } from 'prettier-plugin-react'
TypeScript: use `import type` to avoid runtime import.

Shows how to use the plugin with Prettier API to format JSX code with custom options.

import prettier from 'prettier'; import prettierPluginReact from 'prettier-plugin-react'; const code = `const App = () => <div>Hello</div>;`; prettier.format(code, { parser: 'babel', plugins: [prettierPluginReact], jsxSingleQuote: true, }).then(result => console.log(result)); // Output: const App = () => <div>Hello</div>;
Debug
Known issues
breakingPlugin may not work with Prettier v3+
fix
Use Prettier v2.x or check compatibility.
affects: >=0.0.1
gotchaNo stable release; API may change
fix
Pin to exact version and test upgrades.
affects: >=0.0.1
deprecatedESM-only; no CommonJS bundle
fix
Use dynamic import or ESM project.
affects: >=0.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported.
Using CommonJS require() on ESM-only package.
fix
Use `import prettierPluginReact from 'prettier-plugin-react'` or dynamic import.
TypeError: prettierPluginReact is not a plugin
Plugin not included in plugins array or wrong import.
fix
Ensure plugin is imported and passed in `plugins` array when calling prettier.format.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
prettier-plugin-react — npm install prettier-plugin-react · libregistry