{"id":20338,"library":"prettier-plugin-autocorrect","title":"Prettier Plugin AutoCorrect","description":"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.","status":"active","version":"0.4.3","language":"javascript","source_language":"en","source_url":"https://github.com/un-ts/prettier","tags":["javascript","autocorrect","copywriting","spaces","punctuations","CJK","typescript"],"install":[{"cmd":"npm install prettier-plugin-autocorrect","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-autocorrect","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-autocorrect","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - plugin requires Prettier >=3.0.3 to function","package":"prettier","optional":false}],"imports":[{"note":"This is a Prettier plugin, not a regular Node module. Import is not required; instead, declare it in Prettier config.","wrong":"import { prettier-plugin-autocorrect } from 'prettier-plugin-autocorrect' (no named import)","symbol":"prettier-plugin-autocorrect","correct":"Add to .prettierrc: { \"plugins\": [\"prettier-plugin-autocorrect\"] }"},{"note":"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.","wrong":"const prettierPluginAutocorrect = require('prettier-plugin-autocorrect') (may not work in CJS)","symbol":"AutocorrectPlugin","correct":"const { AutocorrectPlugin } = require('prettier-plugin-autocorrect')"},{"note":"Plugin options are configured via Prettier's own config, not imported directly.","wrong":"import { options } from 'prettier-plugin-autocorrect' (no such export)","symbol":"options","correct":"// No import needed, use Prettier options in config: { \"autocorrectOptions\": { ... } }"}],"quickstart":{"code":"// Install\nyarn add -D prettier prettier-plugin-autocorrect\n\n// .prettierrc\n{\n  \"plugins\": [\"prettier-plugin-autocorrect\"]\n}\n\n// Format a file\nnpx prettier --write \"src/**/*.md\"","lang":"javascript","description":"Install the plugin as a dev dependency, add it to Prettier's plugin list in .prettierrc, and run Prettier to format Markdown files."},"warnings":[{"fix":"Update Prettier to version 3.0.3 or higher.","message":"Requires Prettier 3.x; not compatible with Prettier 2.x.","severity":"breaking","affected_versions":">=0.0.0 <1.0.0"},{"fix":"Review formatted output manually or disable plugin for specific files where needed.","message":"Plugin output may not always match Prettier's formatting conventions, especially in edge cases.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade Node.js to v16 or later, as recommended by the package.","message":"Node.js 14 is EOL; future versions may drop support.","severity":"deprecated","affected_versions":">=0.4.0"},{"fix":"Ensure your file extensions are in the autocorrect list; otherwise, plugin may not apply.","message":"Plugin only works with file types supported by autocorrect (Markdown, plain text, etc).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install -D prettier prettier-plugin-autocorrect' or 'yarn add -D prettier prettier-plugin-autocorrect'.","cause":"Plugin not installed as a devDependency or not resolved correctly.","error":"Cannot find module 'prettier-plugin-autocorrect'"},{"fix":"Add '\"plugins\": [\"prettier-plugin-autocorrect\"]' to .prettierrc and ensure Prettier >=3.0.3.","cause":"Plugin is not declared in .prettierrc's plugins array or Prettier version is too old.","error":"Error: Couldn't resolve plugin \"prettier-plugin-autocorrect\""},{"fix":"Use 'const { AutocorrectPlugin } = require('prettier-plugin-autocorrect')' if available, or switch to ESM imports. Prefer adding to Prettier config instead of requiring directly.","cause":"Trying to require the plugin in CommonJS (CJS) when it is ESM-only.","error":"SyntaxError: Invalid or unexpected token (using require)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}