From 9e572221b7636a1f8ba5d08be829400f4f93558a Mon Sep 17 00:00:00 2001 From: Nathan Drake Date: Fri, 14 Mar 2025 12:30:58 -0500 Subject: [PATCH 1/2] refactor(types): Remove dangerous `declare` so prettier types aren't polluted globally --- src/index.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7e4c647..1267300 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1228,8 +1228,3 @@ export interface PluginOptions { */ tailwindPreserveDuplicates?: boolean } - -declare module 'prettier' { - interface RequiredOptions extends PluginOptions {} - interface ParserOptions extends PluginOptions {} -} From efffd92cd90975ee3100ce7bf8c2f41c89d420ef Mon Sep 17 00:00:00 2001 From: Nathan Drake Date: Fri, 14 Mar 2025 14:55:20 -0500 Subject: [PATCH 2/2] add docs example --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index cbc82e9..2163993 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,17 @@ Then add the plugin to your [Prettier configuration](https://prettier.io/docs/en } ``` +If using a JavaScript config, you can import the types for intellisense/autocomplete: + +```js +// prettier.config.js + +/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */ +export default { + plugins: ["prettier-plugin-tailwindcss"], +} +``` + ## Upgrading to v0.5.x As of v0.5.x, this plugin now requires Prettier v3 and is ESM-only. This means it cannot be loaded via `require()`. For more information see our [upgrade guide](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/issues/207#issuecomment-1698071122).