-
Notifications
You must be signed in to change notification settings - Fork 129
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
Prettier next (2.6.0) + import order plugin @trivago/prettier-plugin-sort-imports Error Ignored unknown option { importOrderSeparation: true } #131
Comments
Are you guys still investigating this issue? |
I downgraded my project back to old version of prettier to be able to support prettier-plugin-sort-imports. Unfortunately seems to be prettier-plugin-sort-imports has no support |
@alex-athenian, I have added the following to my .prettierrc Edit: "prettier": "^2.6.2"
"@trivago/prettier-plugin-sort-imports": "^3.2.0"
"eslint-plugin-prettier": "^4.0.0" |
It's working in webstorm, but not working in my vscode, error is Cannot find module '@trivago/prettier-plugin-sort-imports', have you ever facing this issue? I tried to reinstall prettier, reboot, it still not working for vscode prettier version 2.6.2, @trivago/prettier-plugin-sort-imports version 3.2.0 here is my prettier config file {
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"],
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrder": ["^@server/(.*)$", "^@ui/(.*)$", "<THIRD_PARTY_MODULES>", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 120
} here is my prettier error log
|
@RihuaChen I'm having the exact same problem with VS Code but I found a solution. The way I managed to get around this issue was by moving from JSON config format module.exports = {
"printWidth": 80,
"tabWidth": 4,
"trailingComma": "all",
"singleQuote": true,
"semi": true,
"plugins": [require.resolve("@trivago/prettier-plugin-sort-imports")],
"importOrder": ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderCaseInsensitive": true
} This way it works in VS Code and in command-line (JSON config format was already working in command-line). |
Adding the following to the prettier.js solved the problem for me "plugins": [require.resolve("@trivago/prettier-plugin-sort-imports")], |
Please use require while loading the plugin if you use it pnpm. Something like this https://github.com/verdaccio/verdaccio/blob/c9bd22dcaa2f0d919338fb387ae261992f0e1116/prettier.config.js#L10 Feel free to re-open if the issue still exists. |
Amazing! :) |
Your Environment
Describe the bug
I am moving from stable version of Prettier 2.0.5 to next version of Prettier 2.6.0 which is different from stable version. And got problem with @trivago/prettier-plugin-sort-imports plugin which was working with prettier 2.0.5 but does not with 2.6.0. As only 2.6.0 version supports this param https://prettier.io/docs/en/next/options.html#single-attribute-per-line. I have updated @trivago/prettier-plugin-sort-imports to last version and did migration to 3x according to https://github.com/trivago/prettier-plugin-sort-imports/blob/master/docs/MIGRATION.md
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
package.json
.prettierrc
Error log
Contribute to @trivago/prettier-plugin-sort-imports
The text was updated successfully, but these errors were encountered: