Closed exneval closed 5 months ago
Is there a reason you're typing as PluginOptions
from our plugin rather than Options
from prettier?
e.g. /** @type {import('prettier').Options} */
Is there a reason you're typing as
PluginOptions
from our plugin rather thanOptions
from prettier?e.g.
/** @type {import('prettier').Options} */
It happened to be in a config from this project
can you give a recommendation for how to use it start from 0.6.3?
@exneval
if you're using an isolated prettier module like in t3's monorepo example, you can get around this by adding a types.d.ts to the prettier package and set it yourself until it gets resolved, like this
//prettier/types.d.ts
declare module "prettier-plugin-tailwindcss" {
export interface PluginOptions {
/**
* Path to the Tailwind config file.
*/
tailwindConfig?: string;
/**
* Path to the Tailwind entry point (v4+)
*/
tailwindEntryPoint?: string;
/**
* List of custom function and tag names that contain classes.
*/
tailwindFunctions?: string[];
/**
* List of custom attributes that contain classes.
*/
tailwindAttributes?: string[];
}
}
@exneval @biohackerellie If you have control over the config you should just remove the import and the typedef. The definitions will still show up and click through will still work. It's the entire reason we have the declare module 'prettier' { … }
code in the types:
I'm going to merge in a fix for this and push a patch release out because it's an unintentional breaking change — but as far as I know there should never be a reason for a project to need to import or use that type.
Fix released in v0.6.4
Aside: I just created a project with that template and it indeed doesn't work by default. Something must be going on with the typescript config there because it's supposed to work.
Adding a reference comment in the file fixes this tho:
/// <reference types="prettier-plugin-tailwindcss" />
Tagging @juliusmarminge here since this should be updated in t3-turbo as well
Tagging @juliusmarminge here since this should be updated in t3-turbo as well
File a PR :)
What version of
prettier-plugin-tailwindcss
are you using?v0.6.3
What version of Tailwind CSS are you using?
v3.4.4
What version of Node.js are you using?
v20.13.1
What package manager are you using?
pnpm
What operating system are you using?
Ubuntu
Reproduction URL
-
Describe your issue
Found typing issue with 0.6.3
/** @typedef {import("prettier-plugin-tailwindcss").PluginOptions} TailwindConfig */
the line above not working anymore
0.6.2 index.d.ts
0.6.3 index.d.ts