prettier-plugin-tailwindcss icon indicating copy to clipboard operation
prettier-plugin-tailwindcss copied to clipboard

Remove `declare` to clean up global scope

Open drake-nathan opened this issue 10 months ago • 0 comments

Description

As described in the issue I filed, this declare statement is polluting the global scope. It's providing autocomplete in prettier.config.js files, but offers no real type safety. For instance, if you install the plugin but never add it to your plugins, the tailwind options will appear and cause a config error.

Importing the types like this is far safer.

/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */

You might consider this a breaking change, but I don't think a major is necessary. Since there's no actual type-checking in .js files, this shouldn't cause any errors. You'd just lose out on intellisense until you imported the type above. Users with a .json config won't notice anything at all.

drake-nathan avatar Mar 14 '25 19:03 drake-nathan