-
Notifications
You must be signed in to change notification settings - Fork 67
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 compatibility #224
Comments
Note: There are some discussions that prettier might change to use tabs in the next major version (I cannot find an official response how decided it is): |
FYI: eslint maintainers recommend using prettier for code formatting rather than eslint, and using I'd advocate this approach as well, possibly also enabling |
Is it mentioned in main docs too? https://eslint.org/ Generally prettier has a wide community of users and I would advocate using it just wondering if eslint officially mentioned this in docs? In main README:
|
Ref: Example Vue: https://github.com/vuejs/vue/blob/main/.prettierrc
Vite: https://github.com/vitejs/vite/blob/main/.prettierrc.json {
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "none",
"overrides": [
{
"files": ["*.json5"],
"options": {
"singleQuote": false,
"quoteProps": "preserve"
}
},
{
"files": ["*.yml"],
"options": {
"singleQuote": false
}
}
]
} React: https://github.com/facebook/react/blob/main/.prettierrc.js {
bracketSpacing: false,
singleQuote: true,
jsxBracketSameLine: true,
trailingComma: 'es5',
printWidth: 80,
parser: 'babel',
overrides: [
{
files: esNextPaths,
options: {
trailingComma: 'all',
},
},
],
} |
Nope, I can't find anything in the docs. But 🔈this is worth a listen. |
Hi! @typescript-eslint maintainer here: yup, summarizing my words on 🔈the podcast, our recommendation is to use We haven't added the recommendation to typescript-eslint.io yet, but here's a work-in-progress PR with more written explanation: JoshuaKGoldberg/typescript-eslint#141 Edit (July 2023): https://typescript-eslint.io/linting/troubleshooting/formatting
I would personally recommend against using eslint-plugin-prettier. While it's nice to simplify the number of extensions users need, it slows Prettier formatting down to the however fast ESLint is able to run -- which can be quite slow if you have compute-intensive rules. Which happens a lot for TypeScript users. |
Is there an update on this issue? I see the official nuxt recommendation is still to use Visual Studio on-save trigger to run prettier/eslint, but I'd really like to have it called as part of nuxi dev. |
In my experience most people want to use ESLint and prettier together. They have similar amount of downloads (more than angular, react and vue combined), so we're talking about huge communities. Using them together also gives the best DX: developers only see lint errors for things that really matter, while formatting is automatically taken care of by prettier. Even though there isn't a post in the official ESLint docs recommending prettier, they are clearly not prioritizing stylistic rules:
Stylelint maintainers went further and deprecated all of their stylistic rules recently:
But a single config won't be enough if nuxt/cli#53 is implemented (witch would be great for developers), in this case there could be separate configs for those projects that choses to use ESLint but not prettier during the scaffolding process. Create Svelte handles this pretty well by having different templates for different scenarios: |
Just wanted to let people know that ESLint is actively trying to not support code formatting going forward. See https://eslint.org/blog/2023/10/deprecating-formatting-rules/. As such, I think it becomes more important to have tooling which works with ESLint and Prettier together. I don't know if a particular config project will be needed for prettier or not. Still, I am attempting to only install prettier and some config dependencies and things seems to work for now. The below is my
|
Indeed we need to find a proper standard formatted for nuxt repos. However, I'm not sure there are enough merits/interest from the nuxt team, in general, to have prettier as the preferred tool so closing this. |
Hi @pi0 since this is closed. Will this "No Prettier" need to be reworded? |
I use Prettier with no issues :) Feel free to open a PR to remove links to this issue. |
@aeadedoyin Just to clarify, the documentation link is talking about contribution to nuxt/nuxt, which we would very much discourage using prettier on. We should remove the link, as @pi0 says. |
We can choose to slightly change prettier defaults as docs and config in templates or adjust the eslint config to work with defaults out of the box.
The biggest changes are to remove configuration:
;
''
to""
Comparing to other popular repos: #224 (comment) (It seems most choose to customize formatting)
The text was updated successfully, but these errors were encountered: