Registry / devops / prettier-plugin-astro-organize-imports

prettier-plugin-astro-organize-imports

JSON →
library0.4.12jsnpmunverified

A Prettier plugin that organizes imports in Astro files by removing unused imports, coalescing duplicate imports, and sorting them using the TypeScript language service API's organizeImports feature. The current stable version is 0.4.12. It is actively maintained with frequent releases. Differentiators: specifically for Astro files, provides explicit compatibility with prettier-plugin-astro and prettier-plugin-tailwindcss through per-plugin workarounds, and supports configurable modes (All, SortAndCombine, RemoveUnused).

npm install prettier-plugin-astro-organize-imports
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-AS
P
prettier-plugin-astro-organize-imports
devopsjavascriptv0.4.12
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
No import needed; declare in .prettierrc plugins array
Not a module to import in code
prettier-plugin-astro-organize-imports
In .prettierrc: "plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss", "prettier-plugin-astro-organize-imports"]
Using require('prettier-plugin-astro-organize-imports') in code file
This is a Prettier plugin, not a runtime module. Configure via .prettierrc or programmatic Prettier options.

Configuration to enable the plugin for Astro files, with recommended order and mode set to All.

// .prettierrc { "plugins": [ "prettier-plugin-astro", "prettier-plugin-tailwindcss", "prettier-plugin-astro-organize-imports" ], "overrides": [ { "files": "*.astro", "options": { "parser": "astro" } } ], "astroOrganizeImportsMode": "All" }
Debug
Known issues
gotchaPlugin must be last in the plugins array to ensure compatibility with prettier-plugin-astro and prettier-plugin-tailwindcss.
fix
List prettier-plugin-astro-organize-imports as the final entry in the plugins array in .prettierrc.
affects: >=0.4.0
breakingIn v0.4.12, TypeScript 6 organizeImports API change causes semicolons to be added to import statements.
fix
Ensure you use TypeScript >=6 or apply a workaround; see release notes.
affects: >=0.4.12
gotchaFiles containing '// organize-imports-ignore' or '// tslint:disable:ordered-imports' are skipped and not processed.
fix
Remove those comments from files you intend to format.
affects: >=0.1.0
deprecatedThe astroOrganizeImportsInScriptTags option added in v0.4.9 may be deprecated in future versions.
fix
Use astroOrganizeImportsMode instead if available.
affects: 0.4.9
Errors
Common errors & fixes
Error: @astrojs/compiler must be installed to use this plugin
Missing dependency or peer dependency on prettier-plugin-astro which provides Astro compiler.
fix
Install prettier-plugin-astro: npm install -D prettier-plugin-astro
Cannot find module 'prettier-plugin-astro-organize-imports'
Plugin not installed or incorrect package name in .prettierrc.
fix
Install the plugin: npm install -D prettier-plugin-astro-organize-imports. Ensure spelling matches in .prettierrc.
Error: Failed to load plugin 'prettier-plugin-astro-organize-imports'
Incompatible Prettier version (< 3.0) or misconfiguration.
fix
Update Prettier to v3 or later: npm install -D prettier@^3
Upgrade
Version history
0.4.12latest on npm
Audit
Dependencies
prettierrequiredpeer dependency: requires Prettier ^3.0
prettier-plugin-astrooptionalpeer dependency: required for Astro file parsing
prettier-plugin-tailwindcssoptionalpeer dependency: optional compatibility with Tailwind CSS plugin
Agent activity
2 hits · last 30 days
node
2
Resources
prettier-plugin-astro-organize-imports — npm install prettier-plugin-astro-organize-imports · libregistry