{"_id":"@duclonghoang/prettier-config","_rev":"3-4db89860cf9ae487b729e48af1083c32","name":"@duclonghoang/prettier-config","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@duclonghoang/prettier-config","version":"1.0.0","keywords":["prettier","prettier-config","config","formatter","astro","tailwindcss"],"author":{"name":"Duc Long Hoang"},"license":"MIT","_id":"@duclonghoang/prettier-config@1.0.0","maintainers":[{"name":"duclonghoang","email":"duclonghoang.dlh+npm@gmail.com"}],"homepage":"https://gitlab.com/DucLongHoang/config-packages/-/tree/master/packages/prettier-config","bugs":{"url":"https://gitlab.com/DucLongHoang/config-packages/-/issues"},"dist":{"shasum":"9f42544bd50dd6fb41f9921a5ed5037789f3d3ae","tarball":"https://registry.npmjs.org/@duclonghoang/prettier-config/-/prettier-config-1.0.0.tgz","fileCount":5,"integrity":"sha512-Y71JNN4AUu96DA1wQcMt8YERrNkdX4wJ1Wcmpak+Copf7YrHX4YOMujPt7V1EFHKftdMKUEhtAd8tpTGCCQHow==","signatures":[{"sig":"MEYCIQDHVA3UeVCuEArJmn77e4fuyua/g8f999iXj224QTA9fQIhAN753Oq+x/gLiDry/m7oHlSkxsf/Zy18PPvg55Of+Yyj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13244},"main":"./index.js","type":"module","_from":"file:duclonghoang-prettier-config-1.0.0.tgz","types":"./index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./package.json":"./package.json"},"_npmUser":{"name":"duclonghoang","email":"duclonghoang.dlh+npm@gmail.com"},"_resolved":"/tmp/6b3156c22cc07b0c3e295556e4ec628d/duclonghoang-prettier-config-1.0.0.tgz","_integrity":"sha512-Y71JNN4AUu96DA1wQcMt8YERrNkdX4wJ1Wcmpak+Copf7YrHX4YOMujPt7V1EFHKftdMKUEhtAd8tpTGCCQHow==","repository":{"url":"git+https://gitlab.com/DucLongHoang/config-packages.git","type":"git","directory":"packages/prettier-config"},"_npmVersion":"10.9.3","description":"Shared Prettier configuration for Astro and other files Biome does not format","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","dependencies":{"prettier-plugin-astro":"^0.14.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"prettier":">=3.6","prettier-plugin-tailwindcss":">=0.6"},"peerDependenciesMeta":{"prettier-plugin-tailwindcss":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/prettier-config_1.0.0_1788685337275_0.1286962457139551","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@duclonghoang/prettier-config","version":"1.0.1","keywords":["prettier","prettier-config","config","formatter","astro","tailwindcss"],"author":{"name":"Duc Long Hoang"},"license":"MIT","_id":"@duclonghoang/prettier-config@1.0.1","maintainers":[{"name":"duclonghoang","email":"duclonghoang.dlh+npm@gmail.com"}],"homepage":"https://gitlab.com/DucLongHoang/config-packages/-/tree/master/packages/prettier-config","bugs":{"url":"https://gitlab.com/DucLongHoang/config-packages/-/issues"},"dist":{"shasum":"dacb0371334dce64f4993a4dfeab590dfe4131bd","tarball":"https://registry.npmjs.org/@duclonghoang/prettier-config/-/prettier-config-1.0.1.tgz","fileCount":5,"integrity":"sha512-mhxPm68Ek7Dqy/HdD1TdDiZ/eukp3IpW+ePEfaZ+HNcqP0UEOjtvtKKu2XOihk+hqTqY6Q/LJf4q6zl6qOVhhA==","signatures":[{"sig":"MEUCIEFs7rtZRRYWYzKre0aaIpXgrliZenLdjdCfFwWIHmiJAiEA4uEQnyQn73PkVX+k++MMmrNEN6L6l3jZbtQQGfgzdOU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13244},"main":"./index.js","type":"module","_from":"file:duclonghoang-prettier-config-1.0.1.tgz","types":"./index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./package.json":"./package.json"},"_npmUser":{"name":"GitLab CI/CD","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"gitlab","oidcConfigId":"oidc:12ae5293-91f5-45cc-a552-4f2142b7b0bb"}},"_resolved":"/tmp/2e724b4a2b27ce6c4e88adab3b0ffaa3/duclonghoang-prettier-config-1.0.1.tgz","_integrity":"sha512-mhxPm68Ek7Dqy/HdD1TdDiZ/eukp3IpW+ePEfaZ+HNcqP0UEOjtvtKKu2XOihk+hqTqY6Q/LJf4q6zl6qOVhhA==","repository":{"url":"git+https://gitlab.com/DucLongHoang/config-packages.git","type":"git","directory":"packages/prettier-config"},"_npmVersion":"11.19.0","description":"Shared Prettier configuration for Astro and other files Biome does not format","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","dependencies":{"prettier-plugin-astro":"^0.14.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"prettier":">=3.6","prettier-plugin-tailwindcss":">=0.6"},"peerDependenciesMeta":{"prettier-plugin-tailwindcss":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/prettier-config_1.0.1_1788687699311_0.4265964163331346","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@duclonghoang/prettier-config","version":"1.0.2","description":"Shared Prettier configuration for Astro and other files Biome does not format","license":"MIT","author":{"name":"Duc Long Hoang"},"repository":{"type":"git","url":"git+https://gitlab.com/DucLongHoang/config-packages.git","directory":"packages/prettier-config"},"homepage":"https://gitlab.com/DucLongHoang/config-packages/-/tree/master/packages/prettier-config","bugs":{"url":"https://gitlab.com/DucLongHoang/config-packages/-/issues"},"keywords":["prettier","prettier-config","config","formatter","astro","tailwindcss"],"type":"module","exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./package.json":"./package.json"},"main":"./index.js","types":"./index.d.ts","dependencies":{"prettier-plugin-astro":"^0.14.1"},"peerDependencies":{"prettier":">=3.6","prettier-plugin-tailwindcss":">=0.6"},"peerDependenciesMeta":{"prettier-plugin-tailwindcss":{"optional":true}},"publishConfig":{"access":"public"},"engines":{"node":">=20.19.0"},"sideEffects":false,"_id":"@duclonghoang/prettier-config@1.0.2","_integrity":"sha512-cVKTIXWvjt0++GSqqFO5XUISYGqeI4s22iAE4ihPlUa5pMqhIz7Vm1iEFIIAiaTOuK3c9z2TQJw54UZBkpob/A==","_resolved":"/tmp/b594864e1ac72828526537926aa74e46/duclonghoang-prettier-config-1.0.2.tgz","_from":"file:duclonghoang-prettier-config-1.0.2.tgz","_nodeVersion":"24.20.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-cVKTIXWvjt0++GSqqFO5XUISYGqeI4s22iAE4ihPlUa5pMqhIz7Vm1iEFIIAiaTOuK3c9z2TQJw54UZBkpob/A==","shasum":"cc8fb4ae18010369265800639e2b30b560df8db5","tarball":"https://registry.npmjs.org/@duclonghoang/prettier-config/-/prettier-config-1.0.2.tgz","fileCount":5,"unpackedSize":13439,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBf+YSUMehhMNCqDVPbsSDZpJ+OCsBndhcgGicXs/6uVAiEA7w1Wl/fuEtOcomPuqigHlWOjfedhQX9nK/u3LtGtbP8="}]},"_npmUser":{"name":"GitLab CI/CD","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"gitlab","oidcConfigId":"oidc:12ae5293-91f5-45cc-a552-4f2142b7b0bb"}},"directories":{},"maintainers":[{"name":"duclonghoang","email":"me@duclonghoang.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/prettier-config_1.0.2_1788689263275_0.5294427717742276"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-06T09:02:17.041Z","modified":"2026-09-06T10:07:43.550Z","1.0.0":"2026-09-06T09:02:17.404Z","1.0.1":"2026-09-06T09:41:39.443Z","1.0.2":"2026-09-06T10:07:43.402Z"},"bugs":{"url":"https://gitlab.com/DucLongHoang/config-packages/-/issues"},"author":{"name":"Duc Long Hoang"},"license":"MIT","homepage":"https://gitlab.com/DucLongHoang/config-packages/-/tree/master/packages/prettier-config","keywords":["prettier","prettier-config","config","formatter","astro","tailwindcss"],"repository":{"type":"git","url":"git+https://gitlab.com/DucLongHoang/config-packages.git","directory":"packages/prettier-config"},"description":"Shared Prettier configuration for Astro and other files Biome does not format","maintainers":[{"name":"duclonghoang","email":"me@duclonghoang.com"}],"readme":"# @duclonghoang/prettier-config\n\nShared Prettier configuration.\n\nPrettier is the single formatter for **Astro** projects, where it formats everything: `.astro`, `.ts`, `.tsx`, `.json`, `.css`, `.md`. Node, Next.js and TanStack projects use [`@duclonghoang/biome-config`](https://www.npmjs.com/package/@duclonghoang/biome-config) instead.\n\nThe two packages encode **the same style** — same line width, indentation, quotes, semicolons, trailing commas and arrow parens — so a project can move between them without reformatting. They are alternatives, never used together in one project.\n\n## Installation\n\n```bash\npnpm add -D @duclonghoang/prettier-config prettier\n```\n\n`prettier-plugin-astro` ships as a dependency of this package, so `.astro` support works with no extra install.\n\n## Usage\n\n`prettier.config.mjs`:\n\n```js\nexport { default } from '@duclonghoang/prettier-config'\n```\n\nOr via `package.json`:\n\n```json\n{\n  \"prettier\": \"@duclonghoang/prettier-config\"\n}\n```\n\n```json\n{\n  \"scripts\": {\n    \"format\": \"prettier --write .\",\n    \"format:check\": \"prettier --check .\"\n  }\n}\n```\n\nPrettier already skips `node_modules`. Add a `.prettierignore` for build output:\n\n```gitignore\ndist\n.astro\n.vercel\n```\n\n### Tailwind class sorting\n\nPrettier's Tailwind plugin has to load last, so it is opt-in through `createConfig`:\n\n```bash\npnpm add -D prettier-plugin-tailwindcss\n```\n\n```js\nimport { createConfig } from '@duclonghoang/prettier-config'\n\nexport default createConfig({\n  tailwind: true,\n  tailwindStylesheet: './src/styles/global.css',\n})\n```\n\n### Options\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `astro` | `true` | Register `prettier-plugin-astro`. |\n| `tailwind` | `false` | Register `prettier-plugin-tailwindcss` last. |\n| `tailwindStylesheet` | – | Tailwind v4 entry stylesheet. |\n| `plugins` | `[]` | Extra plugins, appended before the Tailwind plugin. |\n\nAny other Prettier option is passed straight through, and `overrides` you supply are appended after the built-in ones so they win:\n\n```js\nimport { createConfig } from '@duclonghoang/prettier-config'\n\nexport default createConfig({\n  printWidth: 100,\n  overrides: [{ files: '*.astro', options: { printWidth: 120 } }],\n})\n```\n\nChanging a formatting option here makes this config disagree with `@duclonghoang/biome-config`. That is fine for a single project, but if the change is meant to be the house style, make the matching change in both packages.\n\n## Settings\n\n| | Value | Biome counterpart |\n| --- | --- | --- |\n| Print width | 120 | `formatter.lineWidth` |\n| Indentation | 2 spaces | `formatter.indentStyle` / `indentWidth` |\n| Line endings | LF | `formatter.lineEnding` |\n| Semicolons | none | `javascript.formatter.semicolons` |\n| Quotes | single | `javascript.formatter.quoteStyle` |\n| JSX quotes | single | `javascript.formatter.jsxQuoteStyle` |\n| Trailing commas | all | `javascript.formatter.trailingCommas` |\n| Arrow parens | always | `javascript.formatter.arrowParentheses` |\n| Quoted props | as needed | `javascript.formatter.quoteProperties` |\n\nPer-language overrides, none of which diverge from Biome — they cover file types Biome does not format at all:\n\n- **`.astro`** — the `astro` parser from `prettier-plugin-astro`.\n- **`.jsonc` / `tsconfig*.json` / `jsconfig*.json` / `.vscode/*.json`** — the `jsonc` parser, so comments survive.\n- **`.md` / `.mdx`** — `proseWrap: preserve`, because trailing whitespace is a hard line break in Markdown and reflowing prose would change the rendered output.\n\n## Known quirk: two passes on badly formatted markup\n\n`prettier-plugin-astro` is not always idempotent in a single pass on `.astro` markup whose tags are jammed together with no whitespace (`<body><h1>…`). The first `prettier --write` leaves it one step short, and a second run settles it. This is upstream behavior, not a setting in this preset — plain Prettier with default options reproduces it.\n\nIt only shows up on markup that was never formatted. Normally written `.astro` files are stable in one pass and left untouched, so it affects the first run after adopting the config and nothing after that. If `prettier --check` fails in CI immediately after a first-time format, run `prettier --write .` once more and commit.\n\nSetting `htmlWhitespaceSensitivity: 'ignore'` avoids it, but that lets Prettier add and remove whitespace around inline elements, which can change what the page renders. The preset keeps Prettier's default `'css'` instead.\n\n## Why plugins are resolved to absolute paths\n\nPrettier resolves bare plugin names relative to the config file that names them. Under pnpm's non-flat `node_modules`, `prettier-plugin-astro` is not visible from a consumer's project root, so `plugins: ['prettier-plugin-astro']` fails there. This preset calls `require.resolve` from inside the package and hands Prettier an absolute path instead.\n\n## Editor setup\n\n```bash\ncode --install-extension esbenp.prettier-vscode\ncode --install-extension astro-build.astro-vscode\n```\n\n```json\n{\n  \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n  \"editor.formatOnSave\": true,\n  \"biome.enabled\": false\n}\n```\n\nDisable the Biome extension so it cannot format files behind Prettier's back.\n\n## TypeScript version\n\nAstro projects must stay on TypeScript 6 — `astro check` and the Astro VS Code extension do not support the TypeScript 7 native compiler yet. See the [typescript-config README](https://gitlab.com/DucLongHoang/config-packages/-/blob/master/packages/typescript-config/README.md#astro-and-typescript-versions).\n\n## License\n\nMIT © Duc Long Hoang\n\n## Links\n\n- [npm Package](https://www.npmjs.com/package/@duclonghoang/prettier-config)\n- [Source Code](https://gitlab.com/DucLongHoang/config-packages/-/tree/master/packages/prettier-config)\n- [Prettier Documentation](https://prettier.io/docs/options)\n- [Report Issues](https://gitlab.com/DucLongHoang/config-packages/-/issues)\n","readmeFilename":"README.md"}