{"id":26996113,"url":"https://github.com/mlane/prettier-plugin-astro-attributes","last_synced_at":"2025-04-04T01:17:19.734Z","repository":{"id":285273852,"uuid":"957272221","full_name":"mlane/prettier-plugin-astro-attributes","owner":"mlane","description":"A Prettier plugin to automatically sort HTML attributes alphabetically in .astro files for consistent code formatting.","archived":false,"fork":false,"pushed_at":"2025-03-30T18:43:03.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T18:43:47.728Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/mlane.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2025-03-30T00:24:52.000Z","updated_at":"2025-03-30T18:43:07.000Z","dependencies_parsed_at":"2025-03-30T18:43:52.369Z","dependency_job_id":"9e50cb0c-43e9-4736-801b-4909ba99f3f3","html_url":"https://github.com/mlane/prettier-plugin-astro-attributes","commit_stats":null,"previous_names":["mlane/prettier-plugin-astro-attributes"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlane%2Fprettier-plugin-astro-attributes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlane%2Fprettier-plugin-astro-attributes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlane%2Fprettier-plugin-astro-attributes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlane%2Fprettier-plugin-astro-attributes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlane","download_url":"https://codeload.github.com/mlane/prettier-plugin-astro-attributes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247103296,"owners_count":20884024,"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":[],"created_at":"2025-04-04T01:17:19.308Z","updated_at":"2025-04-04T01:17:19.720Z","avatar_url":"https://github.com/mlane.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prettier Plugin for Sorting HTML Attributes in Astro Files\n\nA **Prettier plugin** that **automatically sorts HTML attributes alphabetically** in `.astro` files to ensure clean, consistent code formatting.\n\n## 🎥 Demo\n[Watch the Demo](https://github.com/user-attachments/assets/06de8a0b-4037-49d7-8156-cf8bba6f4141)\n\n---\n\n## Installation\n\n### 1. Install Dependencies\n\n```bash\nnpm install -D prettier prettier-plugin-astro prettier-plugin-astro-attributes\n```\n\n### 2. Configure Prettier\n\nIn your `.prettierrc` or `prettier.config.js` file, add the plugin:\n\n- Add the following configuration to your Prettier setup:\n\n```json\n{\n  \"overrides\": [\n    {\n      \"files\": \"*.astro\",\n      \"options\": {\n        \"parser\": \"astro\"\n      }\n    }\n  ],\n  \"plugins\": [\"prettier-plugin-astro\", \"prettier-plugin-astro-attributes\"]\n}\n```\n\n\u003e **Note:** This plugin extends the official [prettier-plugin-astro](https://github.com/withastro/prettier-plugin-astro) parser. It is designed to work **only** with the official Astro plugin. It is not compatible with other Astro formatting plugins such as `prettier-plugin-tailwindcss`. If you have any Tailwind-related Prettier plugins installed, please remove them to avoid conflicts.\n\n## Usage\n\nOnce installed and configured, run Prettier to format your `.astro` files:\n\n- Run `npx prettier --write .`\n\nThe plugin will automatically sort **HTML attributes** in your `.astro` files alphabetically, ensuring consistent and readable code.\n\n## Features\n\n- **Alphabetical Sorting:**  \n  Sorts attributes in HTML tags (such as `\u003cmeta\u003e`, `\u003clink\u003e`, etc.) alphabetically by attribute name.\n\n- **Easy Integration:**  \n  Works seamlessly with **Prettier** when used in combination with the official Astro plugin.\n\n- **Supports `.astro` Files:**  \n  Specifically designed for **Astro projects**.\n\n## Benefits\n\n- **Consistency:**  \n  Enforces a consistent style for attribute ordering across your Astro files.\n\n- **Cleaner Code:**  \n  Improves the readability and maintainability of your `.astro` templates.\n\n- **Time-Saving:**  \n  Automates the formatting process, reducing manual code adjustments.\n\n## Compatibility Notice\n\nThis plugin extends the official [prettier-plugin-astro](https://github.com/withastro/prettier-plugin-astro) to sort HTML attributes. It is **only compatible** with the official Astro plugin. If you use other plugins (e.g. `prettier-plugin-tailwindcss`), this plugin may not work as expected.\n\nIf you discover a solution that allows compatibility with Tailwind or other plugins, please open an issue or submit a pull request. Your help is appreciated!\n\n## Contributing\n\nFeel free to open an issue or pull request if you have suggestions, bug reports, or improvements. We welcome contributions!\n\n## License\n\nThis project is licensed under the [MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlane%2Fprettier-plugin-astro-attributes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlane%2Fprettier-plugin-astro-attributes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlane%2Fprettier-plugin-astro-attributes/lists"}