-
-
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
Request: respect Prettier default settings #491
Comments
You're using eslint and prettier through XO, it makes complete sense that both of them follow XO’s style, not the other way around, otherwise there's no point in running Prettier through XO. If you prefer Prettier’s defaults, use |
I personally don't agree to @fregante. Prettier is maybe the best formatter available, still - and that's brought up in the prettier docs, it makes sense to use linters - just for the static code analysis part. This finally means that linters have then to be reconfigured to follow prettiers style configuration. In addition, people have prettier often running locally (format on save), but linters running in their CI. So We just noticed that xo does not consider prettiers defaults even though We fixed this by defining a .prettierrc.js with specifying all default values we found in the prettier docs, here. module.exports = {
printWidth: 80,
tabWidth: 2,
semi: true,
singleQuote: false,
quoteProps: "as-needed",
jsxSingleQuote: false,
trailingComma: "es5",
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: "always",
requirePragma: false,
insertPragma: false,
useTabs: false,
proseWrap: "preserve",
htmlWhitespaceSensitivity: "css",
vueIndentScriptAndStyle: false,
endOfLine: "lf",
embeddedLanguageFormatting: "auto",
rangeStart: 0,
rangeEnd: Number.POSITIVE_INFINITY,
}; This works great, but still, if they add/change options in prettier we will have to update our configuration again. That's why having xo falling back to prettier defaults dynamically as described would be really great. Just my 2 cents. TBH I couldn't follow your thoughts fregante @Rashad-j fyi In addition, and that's maybe the more useful part for XO itself: Why not having a configuration flag |
... and for the other way around, when thinking about the Also here, it might be worth to again point to the idea of a configuration option "noStyleChecks" as perfect solution to separate styling checks and static code analysis checks, but yes, it is then no longer about using xo standalone. But, do you plan to keep adding further formatters as dependencies of xo and further flags like Finally, I guess this then also depends on eslint iself supporting such a possibility. :-) |
XO infers rules from prettier in a way that I don't think is the best. From readme:
I think that
trailingComma
,singleQuote
,bracketSpacing
andjsxBracketSameLine
should pick the same defaults from Prettier instead of having another predefined default choice made by xo.The current behavior caused some confusion to me and someone else in #440.
The text was updated successfully, but these errors were encountered: