{"id":13822974,"url":"https://github.com/withastro/prettier-plugin-astro","last_synced_at":"2025-04-11T14:49:37.711Z","repository":{"id":36958290,"uuid":"383910697","full_name":"withastro/prettier-plugin-astro","owner":"withastro","description":"Prettier plugin for Astro","archived":false,"fork":false,"pushed_at":"2024-08-08T10:48:04.000Z","size":1040,"stargazers_count":479,"open_issues_count":22,"forks_count":36,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-10-29T14:27:44.441Z","etag":null,"topics":["astro","formatter","plugin","prettier"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/withastro.png","metadata":{"funding":{"github":"withastro","patreon":null,"open_collective":"astrodotbuild","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2021-07-07T19:55:30.000Z","updated_at":"2024-10-16T08:03:55.000Z","dependencies_parsed_at":"2023-12-20T10:50:52.866Z","dependency_job_id":"66bcbc07-4b52-46f6-9e0c-23c19e6b28aa","html_url":"https://github.com/withastro/prettier-plugin-astro","commit_stats":{"total_commits":271,"total_committers":33,"mean_commits":8.212121212121213,"dds":0.7712177121771218,"last_synced_commit":"1f2b7de2900df251cb9f8674405acbb80d8542b1"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/withastro%2Fprettier-plugin-astro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/withastro%2Fprettier-plugin-astro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/withastro%2Fprettier-plugin-astro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/withastro%2Fprettier-plugin-astro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/withastro","download_url":"https://codeload.github.com/withastro/prettier-plugin-astro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248423588,"owners_count":21101009,"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"],"created_at":"2024-08-04T08:02:27.251Z","updated_at":"2025-04-11T14:49:37.684Z","avatar_url":"https://github.com/withastro.png","language":"TypeScript","funding_links":["https://github.com/sponsors/withastro","https://opencollective.com/astrodotbuild"],"categories":["TypeScript","Tools"],"sub_categories":["Development Tools"],"readme":"# [Prettier](https://prettier.io/) Plugin for [Astro](https://astro.build/)\n\nOfficial Prettier plugin adding support for formatting `.astro` files.\n\n## Installation\n\nFirst install Prettier and the plugin:\n\n```shell\nnpm i --save-dev prettier prettier-plugin-astro\n```\n\nThen add the plugin to your Prettier configuration:\n\n```js\n// .prettierrc.mjs\n/** @type {import(\"prettier\").Config} */\nexport default {\n  plugins: ['prettier-plugin-astro'],\n};\n```\n\n### Recommended configuration\n\nFor optimal compatibility with the different package managers and Prettier plugins, we recommend manually specifying the parser to use for Astro files in your Prettier config as shown in the example below:\n\n```js\n// .prettierrc.mjs\n/** @type {import(\"prettier\").Config} */\nexport default {\n  plugins: ['prettier-plugin-astro'],\n  overrides: [\n    {\n      files: '*.astro',\n      options: {\n        parser: 'astro',\n      },\n    },\n  ],\n};\n```\n\nTo customize formatting behavior, see the [Configuration](#configuration) section below.\n\n## Formatting with the VS Code Prettier extension directly\n\n\u003e **Note** \u003e [The Astro VS Code extension](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode) uses Prettier and this plugin (`prettier-plugin-astro`) to format your code. You will only need to install this plugin separately for formatting if:\n\n- You are not using Astro's VS Code extension.\n- You want to use features of the Prettier extension that not supported by Astro's own VS Code extension, such as the toolbar panel showing Prettier's status.\n\nInstall the [VS Code Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and add the following settings to your VS Code configuration:\n\n```json\n{\n  \"prettier.documentSelectors\": [\"**/*.astro\"],\n  \"[astro]\": {\n    \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n  }\n}\n```\n\nThe settings above ensure that VS Code is aware that Prettier can be used for Astro files, and sets Prettier as the default formatter for Astro files.\n\n### Reporting issues\n\nWhen submitting issues about formatting your `.astro` files in VS Code, please specify which extension you are using to format your files: Astro's own extension or the Prettier extension.\n\n## Configuration\n\nMost [options from Prettier](https://prettier.io/docs/en/options.html) will work with the plugin and can be set in a [configuration file](https://prettier.io/docs/en/configuration.html) or through [CLI flags](https://prettier.io/docs/en/cli.html).\n\n### Astro Allow Shorthand\n\nSet if attributes with the same name as their expression should be formatted to the short form automatically (for example, if enabled `\u003celement name={name} /\u003e` will become simply `\u003celement {name} /\u003e`)\n\n| Default | CLI Override                     | API Override                  |\n| ------- | -------------------------------- | ----------------------------- |\n| `false` | `--astro-allow-shorthand \u003cbool\u003e` | `astroAllowShorthand: \u003cbool\u003e` |\n\n### Astro Skip Frontmatter\n\nIf you are using another tool to format your JavaScript code, like Biome for example, it is possible to skip formatting the frontmatter.\n\n| Default | CLI Override                      | API Override                   |\n| ------- | --------------------------------- | ------------------------------ |\n| `false` | `--astro-skip-frontmatter \u003cbool\u003e` | `astroSkipFrontmatter: \u003cbool\u003e` |\n\n### Example `.prettierrc.cjs`\n\n```js\n{\n  astroAllowShorthand: false;\n  astroSkipFrontmatter: false;\n}\n```\n\n## Contributing\n\nPull requests of any size and any skill level are welcome, no contribution is too small. Changes to the Astro Prettier Plugin are subject to [Astro Governance](https://github.com/withastro/.github/blob/main/GOVERNANCE.md) and should adhere to the [Astro Style Guide](https://github.com/withastro/astro/blob/main/STYLE_GUIDE.md).\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md) for instructions on how to set up your development environment.\n\n## Sponsors\n\nAstro is free, open source software made possible by these wonderful sponsors.\n\n[❤️ Sponsor Astro! ❤️](https://github.com/withastro/.github/blob/main/FUNDING.md)\n\n\u003cp align=\"center\"\u003e\n  \u003ca target=\"_blank\" href=\"https://github.com/sponsors/withastro\"\u003e\n    \u003cimg alt=\"sponsors\" src=\"https://astro.build/sponsors.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwithastro%2Fprettier-plugin-astro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwithastro%2Fprettier-plugin-astro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwithastro%2Fprettier-plugin-astro/lists"}