-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Add support for formatting json files when prettier is used #676
Comments
Just came here to log the exact same issue. To add to the original post, I think this functionality would ideally be used to format all types of files that prettier supports - I can of course still use prettier's formatting directly for these other files, but it complicated my config (and the point of xo is of course to simplify things). I need an additional extension enabled for prettier in my IDE, and need additional IDE settings: {
"xo.format.enable": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "samverschueren.linter-xo"
},
"[javascriptreact]": {
"editor.defaultFormatter": "samverschueren.linter-xo"
},
"[typescript]": {
"editor.defaultFormatter": "samverschueren.linter-xo"
},
"[typescriptreact]": {
"editor.defaultFormatter": "samverschueren.linter-xo"
}
} |
I noticed the
but when I add |
Just a note: xo is an eslint wrapper. Prettier is not used directly, it is just a convenience option where we internally add the prettier eslint plugin to work with eslint. -- You can add eslint plugins for json and css. There is nothing stopping you from configuring this yourself anytime without any changes to the xo library. |
This seems to be possible but it requires extra plugins which don't seem to be otherwise useful in XO Closing for now |
Add support formatting json files when prettier is used (prettier option set to true). My suggestion is to add an config option formatJson which is a boolean and default value is false. If this implemented xo-vscode extension should also be updated to reflect the change. I could do all these be myself but would be nice if this library supports it
example
The text was updated successfully, but these errors were encountered: