Closed mattiaz9 closed 2 years ago
Unfortunately this is a known issue since both plugins use some of the same APIs. You can read more, with some workarounds, in https://github.com/tailwindlabs/prettier-plugin-tailwindcss/issues/9.
@IanVS thanks for the info, but unfortunately that workaround isn't working for me
@IanVS yes that worked, thank you! 🎉
That fix didn't work for me due to
TypeError: Cannot read properties of undefined (reading 'map').
This workaround solved it.
const baseConfig = require('../../prettier.config.cjs');
const pluginSortImports = require('@ianvs/prettier-plugin-sort-imports');
const pluginTailwindcss = require('prettier-plugin-tailwindcss');
/** @type {import("prettier").Plugin} */
const mixedPlugin = {
parsers: {
typescript: {
...pluginTailwindcss.parsers.typescript,
preprocess: pluginSortImports.parsers.typescript.preprocess,
},
},
options: {
...pluginSortImports.options,
},
};
module.exports = {
...baseConfig,
tailwindConfig: './tailwind.config.cjs',
plugins: [mixedPlugin],
};
Your Environment
Describe the bug
It seems like this plugin is conflicting with
prettier-plugin-tailwindcss
and by uninstallingprettier-plugin-sort-imports
it starts to work again.To Reproduce
Expected behavior
I expect the tailwind plugin to sort all my classes.
Screenshots, code sample, etc
Before installing prettier-plugin-sort-imports:
After installing prettier-plugin-sort-imports:
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
Error log
no errors