New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incompatible with @trivago/prettier-plugin-sort-imports
#9
Comments
I'm hacking around this at the moment with this temp plugin below where the imports are aliased. So You can install aliases like this Here is the config and plugin: .prettierrc.js module.exports = {
printWidth: 120,
semi: true,
singleQuote: true,
tabWidth: 4,
trailingComma: 'es5',
endOfLine: 'auto',
plugins: ['./prettier-plugins.js'],
}; prettier-plugins.js const tailwindPlugin = require('sort-classes');
const tidyImportsPlugin = require('tidy-imports');
module.exports = {
parsers: {
typescript: {
...tailwindPlugin.parsers.typescript,
preprocess: tidyImportsPlugin.parsers.typescript.preprocess,
},
},
}; |
Hey! Thanks for reporting this. I've created a new issue (#31) dedicated to keeping track of Prettier plugins that are not compatible with this plugin. Closing this issue in favor of that 👍 |
PS — please feel free to share this as a comment in that thread, it would be great to have it there for quick reference. |
@Mattinton thanks for the workaround, I had to make a small change because it was giving me const tailwindPlugin = require("prettier-plugin-tailwindcss");
const sortImportsPlugin = require("@trivago/prettier-plugin-sort-imports");
module.exports = {
parsers: {
typescript: {
...tailwindPlugin.parsers.typescript,
preprocess: sortImportsPlugin.parsers.typescript.preprocess,
},
},
options: {
...sortImportsPlugin.options,
},
}; |
Update on this one — we've added support for this plugin in the latest (beta) version of our Prettier plugin. You can read more about that here: #31 (comment) |
In case anyone else runs into this. If you import a type with the same name as an exported function. Prettier will throw this exact same error. Example: import { RandomName } from './page'
// other code
export default function RandomName () {
// more code
} |
prettier
version: 2.5.1@trivago/prettier-plugin-sort-imports
version: 3.1.1tailwindcss
version: 2.2.17My .prettierrc.json
Only import sorting works
The text was updated successfully, but these errors were encountered: