Registry / devops / prettier-plugin-autocorrect

prettier-plugin-autocorrect

JSON →
library0.4.3jsnpmunverified

A Prettier plugin that integrates AutoCorrect to format copywriting in various file types, automatically adding spaces between CJK and Latin characters, correcting punctuation, and enforcing consistent whitespace. Version 0.4.3 requires Prettier 3.0.3+ and Node.js 14.18+ (LTS). Built on top of the autocorrect library, it aims to be a drop-in formatter but may not always match Prettier's format exactly. Ships TypeScript types. Developed by the un-ts team, part of a collection of Prettier plugins. Currently under active development with a focus on CJK text formatting.

npm install prettier-plugin-autocorrect
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-AU
P
prettier-plugin-autocorrect
devopsjavascriptv0.4.3
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.

prettier-plugin-autocorrect
Add to .prettierrc: { "plugins": ["prettier-plugin-autocorrect"] }
import { prettier-plugin-autocorrect } from 'prettier-plugin-autocorrect' (no named import)
This is a Prettier plugin, not a regular Node module. Import is not required; instead, declare it in Prettier config.
AutocorrectPlugin
const { AutocorrectPlugin } = require('prettier-plugin-autocorrect')
const prettierPluginAutocorrect = require('prettier-plugin-autocorrect') (may not work in CJS)
The package does not export a default; use named export 'AutocorrectPlugin' for programmatic use. ESM-only ensures CJS require only works if the package has a CJS fallback.
options
// No import needed, use Prettier options in config: { "autocorrectOptions": { ... } }
import { options } from 'prettier-plugin-autocorrect' (no such export)
Plugin options are configured via Prettier's own config, not imported directly.

Install the plugin as a dev dependency, add it to Prettier's plugin list in .prettierrc, and run Prettier to format Markdown files.

// Install yarn add -D prettier prettier-plugin-autocorrect // .prettierrc { "plugins": ["prettier-plugin-autocorrect"] } // Format a file npx prettier --write "src/**/*.md"
Debug
Known issues
breakingRequires Prettier 3.x; not compatible with Prettier 2.x.
fix
Update Prettier to version 3.0.3 or higher.
affects: >=0.0.0 <1.0.0
gotchaPlugin output may not always match Prettier's formatting conventions, especially in edge cases.
fix
Review formatted output manually or disable plugin for specific files where needed.
affects: all
deprecatedNode.js 14 is EOL; future versions may drop support.
fix
Upgrade Node.js to v16 or later, as recommended by the package.
affects: >=0.4.0
gotchaPlugin only works with file types supported by autocorrect (Markdown, plain text, etc).
fix
Ensure your file extensions are in the autocorrect list; otherwise, plugin may not apply.
affects: all
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-autocorrect'
Plugin not installed as a devDependency or not resolved correctly.
fix
Run 'npm install -D prettier prettier-plugin-autocorrect' or 'yarn add -D prettier prettier-plugin-autocorrect'.
Error: Couldn't resolve plugin "prettier-plugin-autocorrect"
Plugin is not declared in .prettierrc's plugins array or Prettier version is too old.
fix
Add '"plugins": ["prettier-plugin-autocorrect"]' to .prettierrc and ensure Prettier >=3.0.3.
SyntaxError: Invalid or unexpected token (using require)
Trying to require the plugin in CommonJS (CJS) when it is ESM-only.
fix
Use 'const { AutocorrectPlugin } = require('prettier-plugin-autocorrect')' if available, or switch to ESM imports. Prefer adding to Prettier config instead of requiring directly.
Upgrade
Version history
0.4.3latest on npm
Audit
Dependencies
prettierrequiredpeer dependency - plugin requires Prettier >=3.0.3 to function
Agent activity
4 hits · last 30 days
node
4
Resources
prettier-plugin-autocorrect — npm install prettier-plugin-autocorrect · libregistry