diff --git a/CHANGELOG.md b/CHANGELOG.md index f3613f5..fc10b6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +- Don't augment global Prettier `ParserOptions` and `RequiredOptions` types ([#354](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/354)) ## [0.6.14] - 2025-07-09 diff --git a/README.md b/README.md index 4724523..1eb9526 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,17 @@ Then add the plugin to your [Prettier configuration](https://prettier.io/docs/en } ``` +When using a JavaScript config, you can import the types for IntelliSense: + +```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). diff --git a/src/index.ts b/src/index.ts index 3be204b..f9a86ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1288,8 +1288,3 @@ export interface PluginOptions { */ tailwindPreserveDuplicates?: boolean } - -declare module 'prettier' { - interface RequiredOptions extends PluginOptions {} - interface ParserOptions extends PluginOptions {} -} diff --git a/src/internal.d.ts b/src/internal.d.ts index f7b7108..f4a30c0 100644 --- a/src/internal.d.ts +++ b/src/internal.d.ts @@ -1,4 +1,6 @@ -export interface InternalOptions { +import type { PluginOptions } from '.' + +export interface InternalOptions extends PluginOptions { printer: Printer /** diff --git a/src/options.ts b/src/options.ts index 889856e..3cf11b0 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,6 +1,5 @@ import type { RequiredOptions, SupportOption } from 'prettier' import type { Customizations } from './types' -import './index' export const options: Record = { tailwindConfig: {