Open philsp opened 1 year ago
I downgrade prettier to 2.8.8 and it works. see https://github.com/tailwindlabs/prettier-plugin-tailwindcss/issues/176
The problem still persists with prettier 3. It's probably related to the prettier dependency of codegen-openapi
I have found a workaround and it seems to be working You can use an environment variable to detect when codegen by RTK Query is running and opt-out the prettier-plugin-tailwindcss
// package.json
{
"scripts": {
"openapi:gen": "RTK_QUERY_CODEGEN=true rtk-query-codegen-openapi openapi.config.ts"
}
}
// .prettierrc.cjs
const RTK_QUERY_CODEGEN = process.env.RTK_QUERY_CODEGEN;
module.exports = {
plugins: RTK_QUERY_CODEGEN ? [] : ['prettier-plugin-tailwindcss']
};
https://github.com/reduxjs/redux-toolkit/releases/tag/%40rtk-query%2Fcodegen-openapi%402.0.0-alpha.0 has an option to point to an alternate Prettier Please try it out and let us know if it works!
Adding Tailwind plugin to Prettier breaks codegen
Output