{"id":15478429,"url":"https://github.com/neoki07/prettier-plugin-astro-organize-imports","last_synced_at":"2025-08-18T06:31:58.972Z","repository":{"id":176717751,"uuid":"658083113","full_name":"neoki07/prettier-plugin-astro-organize-imports","owner":"neoki07","description":"A Prettier plugin for formatting imports in Astro files","archived":false,"fork":false,"pushed_at":"2024-06-15T15:53:35.000Z","size":1671,"stargazers_count":30,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-15T17:12:25.260Z","etag":null,"topics":["astro","formatter","plugin","prettier","sort-imports"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/prettier-plugin-astro-organize-imports","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neoki07.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-24T17:59:49.000Z","updated_at":"2024-06-15T17:12:44.515Z","dependencies_parsed_at":"2023-10-15T04:32:48.815Z","dependency_job_id":"c16df5ff-8435-4487-93ee-1e2c230ff500","html_url":"https://github.com/neoki07/prettier-plugin-astro-organize-imports","commit_stats":null,"previous_names":["ot07/prettier-plugin-astro-organize-imports","ne-oki/prettier-plugin-astro-organize-imports","neokidev/prettier-plugin-astro-organize-imports","neoki07/prettier-plugin-astro-organize-imports"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoki07%2Fprettier-plugin-astro-organize-imports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoki07%2Fprettier-plugin-astro-organize-imports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoki07%2Fprettier-plugin-astro-organize-imports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoki07%2Fprettier-plugin-astro-organize-imports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neoki07","download_url":"https://codeload.github.com/neoki07/prettier-plugin-astro-organize-imports/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229910991,"owners_count":18143227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astro","formatter","plugin","prettier","sort-imports"],"created_at":"2024-10-02T04:04:15.369Z","updated_at":"2024-12-18T02:13:49.816Z","avatar_url":"https://github.com/neoki07.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Prettier](https://prettier.io/) Plugin: Organize Imports for [Astro](https://astro.build/)\n\n[![license](https://img.shields.io/github/license/neoki07/prettier-plugin-astro-organize-imports)](https://github.com/neoki07/prettier-plugin-astro-organize-imports/blob/main/LICENSE)\n[![npm](https://img.shields.io/npm/v/prettier-plugin-astro-organize-imports.svg)](https://www.npmjs.com/package/prettier-plugin-astro-organize-imports)\n[![npm downloads](https://img.shields.io/npm/dm/prettier-plugin-astro-organize-imports)](https://www.npmjs.com/package/prettier-plugin-astro-organize-imports)\n[![ci](https://github.com/neoki07/prettier-plugin-astro-organize-imports/actions/workflows/ci.yml/badge.svg)](https://github.com/neoki07/prettier-plugin-astro-organize-imports/actions/workflows/ci.yml)\n\nA plugin that makes Prettier organize your imports (i. e. sorts, combines and removes unused ones) in Astro files using the `organizeImports` feature of the TypeScript language service API.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/images/demo.gif\" alt=\"Demo\" /\u003e\n\u003c/p\u003e\n\n## Installation\n\n```shell\nnpm install -D prettier prettier-plugin-astro-organize-imports\n```\n\n### Recommended configuration\n\n\u003c!-- prettier-ignore --\u003e\n```json5\n// .prettierrc\n{\n  \"plugins\": [\"prettier-plugin-astro-organize-imports\"],\n  \"overrides\": [\n    {\n      \"files\": \"*.astro\",\n      \"options\": {\n        \"parser\": \"astro\"\n      }\n    }\n  ]\n}\n```\n\n\u003c!-- prettier-ignore-end --\u003e\n\n## Usage\n\nAfter following the steps in the 'Installation' section, the plugin will function when you run the Prettier formatting command.\n\nFiles containing the substring `// organize-imports-ignore` or `// tslint:disable:ordered-imports` will be skipped and won't be processed by this plugin.\n\nThe plugin provides an option named `astroOrganizeImportsMode` that lets you choose the mode of formatting. The available options are:\n\n- `All`: This is the default option. It removes unused imports, coalesces imports from the same module, and sorts imports.\n- `SortAndCombine`: This option coalesces imports from the same module and sorts imports.\n- `RemoveUnused`: This option removes the unused imports.\n\nYou can specify the mode in your Prettier configuration file as follows:\n\n\u003c!-- prettier-ignore --\u003e\n```json5\n// .prettierrc\n{\n  // ..\n  \"astroOrganizeImportsMode\": \"All\" // or \"SortAndCombine\" or \"RemoveUnused\"\n}\n```\n\n\u003c!-- prettier-ignore-end --\u003e\n\nRemember to replace \"All\" with \"SortAndCombine\" or \"RemoveUnused\" depending on your preferences.\n\n## Compatibility with other Prettier plugins\n\nThis plugin uses Prettier APIs that can only be used by one plugin at a time, making it incompatible with other Prettier plugins implemented the same way. To solve this we've added explicit per-plugin workarounds that enable compatibility with the following Prettier plugins:\n\n- `prettier-plugin-astro`\n- `prettier-plugin-tailwindcss`\n\nOne limitation with this approach is that `prettier-plugin-astro-organize-imports` must be loaded last. You can do this by listing each of your Prettier plugins in the `plugins` array:\n\n\u003c!-- prettier-ignore --\u003e\n```json5\n// .prettierrc\n{\n  // ..\n  \"plugins\": [\n    \"prettier-plugin-astro\",\n    \"prettier-plugin-tailwindcss\",\n    \"prettier-plugin-astro-organize-imports\" // MUST come last\n  ],\n  \"overrides\": [\n    {\n      \"files\": \"*.astro\",\n      \"options\": {\n        \"parser\": \"astro\"\n      }\n    }\n  ]\n}\n```\n\n\u003c!-- prettier-ignore-end --\u003e\n\n## Related Prettier plugins\n\nThis plugin is heavily inspired by following plugins:\n\n- [prettier-plugin-organize-imports](https://github.com/simonhaenisch/prettier-plugin-organize-imports)\n\nAnd, for implementation reference, the following plugins:\n\n- [prettier-plugin-astro](https://github.com/withastro/prettier-plugin-astro)\n- [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoki07%2Fprettier-plugin-astro-organize-imports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneoki07%2Fprettier-plugin-astro-organize-imports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoki07%2Fprettier-plugin-astro-organize-imports/lists"}